站内信

dev.vehicleGateway
15285 2024-09-22 16:56:32 +08:00
parent 2ad4794e78
commit 9e6ca8a8ff
19 changed files with 337 additions and 47 deletions

View File

@ -45,7 +45,7 @@ public class BaseEntity implements Serializable {
*/ */
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private String createTime;
/** /**
* *
@ -58,7 +58,7 @@ public class BaseEntity implements Serializable {
*/ */
@TableField(fill = FieldFill.UPDATE) @TableField(fill = FieldFill.UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private String updateTime;
/** /**
* *

View File

@ -4,22 +4,25 @@ import cn.hutool.core.date.DateTime;
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.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.web.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor; import lombok.*;
import lombok.Builder; import lombok.experimental.SuperBuilder;
import lombok.Data;
import lombok.NoArgsConstructor; import java.util.Date;
@Data @Data
@Builder @SuperBuilder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName(value = "fault_log",autoResultMap = true) @TableName(value = "fault_log",autoResultMap = true)
public class FaultLog { @EqualsAndHashCode(callSuper = true)
public class FaultLog extends BaseEntity {
/** /**
* ID * ID
*/ */
@TableId(value = "faultLogId", type= IdType.AUTO) @TableId(value = "fault_log_id", type= IdType.AUTO)
@Schema(defaultValue = "日志ID",type = "Long",description = "日志ID") @Schema(defaultValue = "日志ID",type = "Long",description = "日志ID")
private Long faultLogId; private Long faultLogId;
/** /**
@ -31,15 +34,17 @@ public class FaultLog {
* VIN * VIN
*/ */
@Schema(defaultValue = "车辆VIN",type = "String",description = "车辆VIN") @Schema(defaultValue = "车辆VIN",type = "String",description = "车辆VIN")
private String faultLogVIN; private String faultLogVin;
/** /**
* *
*/ */
@Schema(defaultValue = "开始报警时间",type = "DateTime",description = "开始报警时间") @Schema(defaultValue = "开始报警时间",type = "Date",description = "开始报警时间")
private DateTime faultLogStartTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date faultLogStartTime;
/** /**
* *
*/ */
@Schema(defaultValue = "结束报警时间",type = "DateTime",description = "结束报警时间") @Schema(defaultValue = "结束报警时间",type = "Date",description = "结束报警时间")
private DateTime faultLogEndTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date faultLogEndTime;
} }

View File

@ -0,0 +1,48 @@
package com.muyu.fault.common;
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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.Date;
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "fault_message",autoResultMap = true)
public class FaultMessage {
/**
* ID
*/
@TableId(value = "fault_message_id", type= IdType.AUTO)
@Schema(defaultValue = "站内信ID",type = "Long",description = "站内信ID")
private Long faultMessageId;
/**
*
*/
@Schema(defaultValue = "消息发送人",type = "String",description = "消息发送人")
private String faultMessageSendName;
/**
*
*/
@Schema(defaultValue = "消息发送人",type = "String",description = "消息发送人")
private String faultMessageRemoveName;
/**
*
*/
@Schema(defaultValue = "发送时间",type = "String",description = "发送时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date faultMessageSendTime;
/**
* (1:,2:)
*/
@Schema(defaultValue = "消息状态",type = "Integer",description = "消息状态(1:未读,2:已读)")
private Integer faultMessageState;
}

View File

@ -13,22 +13,22 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName(value = "falut_notify",autoResultMap = true) @TableName(value = "fault_notify",autoResultMap = true)
public class FalutNotify { public class FaultNotify {
/** /**
* ID * ID
*/ */
@TableId(value = "falutNotifyId", type= IdType.AUTO) @TableId(value = "fault_notify_id", type= IdType.AUTO)
@Schema(defaultValue = "ID",type = "Long",description = "ID") @Schema(defaultValue = "ID",type = "Long",description = "ID")
private Long falutNotifyId; private Long faultNotifyId;
/** /**
* *
*/ */
@Schema(defaultValue = "通知方",type = "String",description = "通知方") @Schema(defaultValue = "通知方",type = "String",description = "通知方")
private String falutNotifyParty; private String faultNotifyParty;
/** /**
* *
*/ */
@Schema(defaultValue = "联系方式",type = "String",description = "联系方式") @Schema(defaultValue = "联系方式",type = "String",description = "联系方式")
private String falutNotifyManner; private String faultNotifyManner;
} }

View File

@ -20,7 +20,7 @@ public class FaultSeverity extends BaseEntity {
/** /**
* ID * ID
*/ */
@TableId(value = "id", type= IdType.AUTO) @TableId(value = "fault_severity_id", type= IdType.AUTO)
@Schema(defaultValue = "等级ID",type = "Long",description = "等级ID") @Schema(defaultValue = "等级ID",type = "Long",description = "等级ID")
private Long faultSeverityId; private Long faultSeverityId;
/** /**

View File

@ -13,12 +13,12 @@ import lombok.experimental.SuperBuilder;
@SuperBuilder @SuperBuilder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName(value = "falut_type",autoResultMap = true) @TableName(value = "fault_type",autoResultMap = true)
public class FalutType { public class FaultType {
/** /**
* ID * ID
*/ */
@TableId(value = "faultTypeId", type= IdType.AUTO) @TableId(value = "fault_type_id", type= IdType.AUTO)
@Schema(defaultValue = "故障类型ID",type = "Long",description = "故障类型ID") @Schema(defaultValue = "故障类型ID",type = "Long",description = "故障类型ID")
private Long faultTypeId; private Long faultTypeId;
/** /**

View File

@ -5,32 +5,35 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.web.domain.BaseEntity; import com.muyu.common.core.web.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor; import lombok.*;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
@Data @Data
@SuperBuilder @SuperBuilder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName(value = "faultr_rule",autoResultMap = true) @TableName(value = "fault_rule",autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
public class FaultrRule extends BaseEntity { public class FaultrRule extends BaseEntity {
/** /**
* ID * ID
*/ */
@TableId(value = "faultrRuleId", type= IdType.AUTO) @TableId(value = "fault_rule_id", type= IdType.AUTO)
@Schema(defaultValue = "故障规则ID",type = "Long",description = "故障规则ID") @Schema(defaultValue = "故障规则ID",type = "Long",description = "故障规则ID")
private Long faultrRuleId; private Long faultRuleId;
/** /**
* *
*/ */
@Schema(defaultValue = "故障规则名称",type = "String",description = "故障规则名称") @Schema(defaultValue = "故障规则名称",type = "String",description = "故障规则名称")
private String faultrRuleName; private String faultRuleName;
/**
*
*/
@Schema(defaultValue = "故障规则参数",type = "String",description = "故障规则参数")
private String faultRuleParameter;
/** /**
* *
*/ */
@Schema(defaultValue = "故障规则描述",type = "String",description = "故障规则描述") @Schema(defaultValue = "故障规则描述",type = "String",description = "故障规则描述")
private String faultrRuleDescription; private String faultRuleDescription;
} }

View File

@ -5,11 +5,9 @@ import com.muyu.common.core.domain.Result;
import com.muyu.fault.common.FaultLog; import com.muyu.fault.common.FaultLog;
import com.muyu.fault.service.impl.FaultLogService; import com.muyu.fault.service.impl.FaultLogService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List; import java.util.List;
@RestController @RestController
@ -21,9 +19,9 @@ public class FaultLogController{
/** /**
* *
*/ */
@RequestMapping(value = "/logList", method = RequestMethod.GET) @RequestMapping(value = "/faultLogList", method = RequestMethod.GET)
public Result<List<FaultLog>> logList(){ public Result<List<FaultLog>> faultLogList(FaultLog faultLog){
List<FaultLog> list = faultLogService.logList(); List<FaultLog> list = faultLogService.faultLogList(faultLog);
return Result.success(list); return Result.success(list);
} }
@ -32,8 +30,43 @@ public class FaultLogController{
* @param faultLog * @param faultLog
* @return * @return
*/ */
@RequestMapping(value = "/addLog",method = RequestMethod.POST) @RequestMapping(value = "/insertLog",method = RequestMethod.POST)
public Result addLog(@RequestBody FaultLog faultLog){ public Result insertLog(@RequestBody FaultLog faultLog){
return Result.success(faultLogService.save(faultLog)); return Result.success(faultLogService.save(faultLog));
} }
/**
*
* @param faultLog
* @return
*/
@RequestMapping(value = "/updateLog",method = RequestMethod.PUT)
public Result updateLog(@RequestBody FaultLog faultLog){
return Result.success(faultLogService.updateById(faultLog));
}
/**
*
*
* @param ids
* @return
*/
@RequestMapping(value = "/remove/{ids}",method = RequestMethod.DELETE)
public Result remove(@PathVariable("ids") Long[] ids)
{
return Result.success(faultLogService.removeBatchByIds(Arrays.asList(ids)));
}
/**
*
* @param faultLogId
* @return
*/
@RequestMapping(value = "/byidId/{faultLogId}",method = RequestMethod.GET)
public Result byidId(@PathVariable Long faultLogId){
FaultLog byid = faultLogService.byidId(faultLogId);
return Result.success(byid);
}
} }

View File

@ -0,0 +1,61 @@
package com.muyu.fault.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.fault.common.FaultMessage;
import com.muyu.fault.service.impl.FaultMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/message")
public class FaultMessageController {
@Autowired
private FaultMessageService faultMessageService;
/**
*
* @return
*/
@RequestMapping(value = "/faultMessageList",method = RequestMethod.GET)
public Result faultMessageList(){
List<FaultMessage> list = faultMessageService.faultMessageList();
return Result.success(list);
}
/**
*
* @param faultMessage
* @return
*/
@RequestMapping(value = "/insertMessage",method = RequestMethod.POST)
public Result insertMessage(@RequestBody FaultMessage faultMessage){
//消息发送人
faultMessage.setFaultMessageSendName(SecurityUtils.getUsername());
return Result.success(faultMessageService.save(faultMessage));
}
/**
* (faultMessageState==1)
* @param faultMessageId
* @return
*/
@RequestMapping(value = "/selectOne/{faultMessageId}",method = RequestMethod.POST)
public Result selectOne(@PathVariable Long faultMessageId){
List<FaultMessage> one = faultMessageService.selectOne(faultMessageId);
return Result.success(one);
}
/**
*
* @param faultMessageId
* @return
*/
@RequestMapping(value = "/selectTwo/{faultMessageId}",method = RequestMethod.POST)
public Result selectTwo(@PathVariable Long faultMessageId){
List<FaultMessage> one = faultMessageService.selectTwo(faultMessageId);
return Result.success(one);
}
}

View File

@ -0,0 +1,29 @@
package com.muyu.fault.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.fault.common.FaultrRule;
import com.muyu.fault.common.SysCarFault;
import com.muyu.fault.service.impl.FaultrRuleService;
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;
@RestController
@RequestMapping("/rule")
public class FaultrRuleController {
@Autowired
private FaultrRuleService faultrRuleService;
/**
*
*/
@RequestMapping(value = "/faultRuleList", method = RequestMethod.GET)
public Result<List<FaultrRule>> faultRuleList(FaultrRule faultrRule)
{
List<FaultrRule> list = faultrRuleService.faultRuleList(faultrRule);
return Result.success(list);
}
}

View File

@ -85,10 +85,9 @@ public class SysCarFaultController extends BaseController
sysCarFault.setCreateBy(SecurityUtils.getUsername()); sysCarFault.setCreateBy(SecurityUtils.getUsername());
FaultLog faultLog = new FaultLog(); FaultLog faultLog = new FaultLog();
faultLog.setFaultLogCodes(sysCarFault.getFaultCode()); faultLog.setFaultLogCodes(sysCarFault.getFaultCode());
faultLog.setFaultLogVIN(sysCarFault.getCarVin()); faultLog.setFaultLogVin(sysCarFault.getCarVin());
DateTime startTime = DateTime.now(); // 获取当前时间作为开始时间 DateTime startTime = DateTime.now(); // 获取当前时间作为开始时间
faultLog.setFaultLogStartTime(startTime); faultLog.setFaultLogStartTime(startTime);
faultLog.setFaultLogEndTime(startTime);
faultLogService.save(faultLog); faultLogService.save(faultLog);
if (sysCarFaultService.checkIdUnique(sysCarFault)) { if (sysCarFaultService.checkIdUnique(sysCarFault)) {
return error("新增 车辆故障 '" + sysCarFault + "'失败,车辆故障已存在"); return error("新增 车辆故障 '" + sysCarFault + "'失败,车辆故障已存在");

View File

@ -0,0 +1,7 @@
package com.muyu.fault.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.fault.common.FaultMessage;
public interface FaultMessageMapper extends BaseMapper<FaultMessage> {
}

View File

@ -0,0 +1,10 @@
package com.muyu.fault.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.fault.common.FaultrRule;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface FaultrRuleMapper extends BaseMapper<FaultrRule> {
}

View File

@ -6,7 +6,8 @@ import com.muyu.fault.common.FaultLog;
import java.util.List; import java.util.List;
public interface FaultLogService extends IService<FaultLog> { public interface FaultLogService extends IService<FaultLog> {
List<FaultLog> logList(); List<FaultLog> faultLogList(FaultLog faultLog);
FaultLog byidId(Long faultLogId);
} }

View File

@ -1,16 +1,33 @@
package com.muyu.fault.service.impl; package com.muyu.fault.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.fault.common.FaultLog; import com.muyu.fault.common.FaultLog;
import com.muyu.fault.common.SysCarFault;
import com.muyu.fault.mapper.FaultLogMapper; import com.muyu.fault.mapper.FaultLogMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.util.List; import java.util.List;
@Service @Service
public class FaultLogServiceImpl extends ServiceImpl<FaultLogMapper, FaultLog> implements FaultLogService{ public class FaultLogServiceImpl extends ServiceImpl<FaultLogMapper, FaultLog> implements FaultLogService{
@Override @Override
public List<FaultLog> logList() { public List<FaultLog> faultLogList(FaultLog faultLog) {
return null; LambdaQueryWrapper<FaultLog> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtils.isNotEmpty(faultLog.getFaultLogVin()),
FaultLog::getFaultLogVin, faultLog.getFaultLogVin());
queryWrapper.like(StringUtils.isNotEmpty(faultLog.getFaultLogCodes()),
FaultLog::getFaultLogCodes, faultLog.getFaultLogCodes());
return this.list(queryWrapper);
}
@Override
public FaultLog byidId(Long faultLogId) {
LambdaQueryWrapper<FaultLog> queryWrapper = new LambdaQueryWrapper<>();
Assert.notNull(faultLogId, "日志ID不可为空");
queryWrapper.eq(FaultLog::getFaultLogId, faultLogId);
return this.getOne(queryWrapper);
} }
} }

View File

@ -0,0 +1,14 @@
package com.muyu.fault.service.impl;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.fault.common.FaultMessage;
import java.util.List;
public interface FaultMessageService extends IService<FaultMessage> {
List<FaultMessage> faultMessageList();
List<FaultMessage> selectOne(Long faultMessageId);
List<FaultMessage> selectTwo(Long faultMessageId);
}

View File

@ -0,0 +1,34 @@
package com.muyu.fault.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.fault.common.FaultMessage;
import com.muyu.fault.mapper.FaultMessageMapper;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class FaultMessageServiceImpl extends ServiceImpl<FaultMessageMapper, FaultMessage> implements FaultMessageService{
@Override
public List<FaultMessage> faultMessageList() {
LambdaQueryWrapper<FaultMessage> queryWrapper = new LambdaQueryWrapper<>();
return this.list(queryWrapper);
}
@Override
public List<FaultMessage> selectOne(Long faultMessageId) {
LambdaQueryWrapper<FaultMessage> queryWrapper = new LambdaQueryWrapper<>();
//查询消息状态为1的未读数据
queryWrapper.eq(FaultMessage::getFaultMessageState, 1);
return this.list(queryWrapper);
}
@Override
public List<FaultMessage> selectTwo(Long faultMessageId) {
LambdaQueryWrapper<FaultMessage> queryWrapper = new LambdaQueryWrapper<>();
//查询消息状态为2的已读数据
queryWrapper.eq(FaultMessage::getFaultMessageState, 2);
return this.list(queryWrapper);
}
}

View File

@ -0,0 +1,10 @@
package com.muyu.fault.service.impl;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.fault.common.FaultrRule;
import java.util.List;
public interface FaultrRuleService extends IService<FaultrRule> {
List<FaultrRule> faultRuleList(FaultrRule faultrRule);
}

View File

@ -0,0 +1,19 @@
package com.muyu.fault.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.fault.common.FaultrRule;
import com.muyu.fault.mapper.FaultrRuleMapper;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class FaultrRuleServiceImpl extends ServiceImpl<FaultrRuleMapper, FaultrRule> implements FaultrRuleService{
@Override
public List<FaultrRule> faultRuleList(FaultrRule faultrRule) {
LambdaQueryWrapper<FaultrRule> queryWrapper = new LambdaQueryWrapper<>();
return this.list(queryWrapper);
}
}