Merge remote-tracking branch 'origin/dev.fault' into dev
commit
aa1d518628
|
@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
|
|
|
@ -72,6 +72,18 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-api-doc</artifactId>
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.carrotsearch.thirdparty</groupId>
|
||||||
|
<artifactId>simple-xml-safe</artifactId>
|
||||||
|
<version>2.7.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.attoparser</groupId>
|
||||||
|
<artifactId>attoparser</artifactId>
|
||||||
|
<version>2.0.7.RELEASE</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -4,22 +4,26 @@ 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 org.springframework.format.annotation.DateTimeFormat;
|
||||||
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 +35,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;
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date faultLogStartTime;
|
||||||
/**
|
/**
|
||||||
* 结束报警时间
|
* 结束报警时间
|
||||||
*/
|
*/
|
||||||
@Schema(defaultValue = "结束报警时间",type = "DateTime",description = "结束报警时间")
|
@Schema(defaultValue = "结束报警时间",type = "Date",description = "结束报警时间")
|
||||||
private DateTime faultLogEndTime;
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date faultLogEndTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
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 org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
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 = "消息内容")
|
||||||
|
private String faultMessageContent;
|
||||||
|
/**
|
||||||
|
* 发送时间
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "发送时间",type = "Date",description = "发送时间")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date faultMessageSendTime;
|
||||||
|
/**
|
||||||
|
* 消息状态(1:未读,2:已读)
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "消息状态",type = "Integer",description = "消息状态(1:未读,2:已读)")
|
||||||
|
private Integer faultMessageState;
|
||||||
|
}
|
|
@ -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;
|
||||||
}
|
}
|
|
@ -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;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.fault.common;
|
||||||
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.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.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -13,12 +14,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;
|
||||||
/**
|
/**
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,8 @@ 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 jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.*;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
|
@ -29,10 +27,10 @@ public class SysCarFault extends BaseEntity {
|
||||||
@Schema(defaultValue = "车辆故障编码",type = "String",description = "车辆故障编码")
|
@Schema(defaultValue = "车辆故障编码",type = "String",description = "车辆故障编码")
|
||||||
private String faultCode;
|
private String faultCode;
|
||||||
/**
|
/**
|
||||||
* 车辆故障类型
|
* 车辆故障类型ID
|
||||||
*/
|
*/
|
||||||
@Schema(defaultValue = "车辆故障类型",type = "String",description = "车辆故障类型")
|
@Schema(defaultValue = "车辆故障类型ID",type = "Integer",description = "车辆故障类型ID")
|
||||||
private String faultType;
|
private Integer faultTypeId;
|
||||||
/**
|
/**
|
||||||
* 故障VIN编码
|
* 故障VIN编码
|
||||||
*/
|
*/
|
||||||
|
@ -71,6 +69,6 @@ public class SysCarFault extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 启用状态(1.待处理 2.处理中 3.已处理 4.忽略)
|
* 启用状态(1.待处理 2.处理中 3.已处理 4.忽略)
|
||||||
*/
|
*/
|
||||||
@Schema(defaultValue = "启用状态",type = "String",description = "启用状态")
|
@Schema(defaultValue = "启用状态",type = "String",description = "启用状态(1.待处理 2.处理中 3.已处理 4.忽略)")
|
||||||
private String state;
|
private String state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,74 @@
|
||||||
package com.muyu.fault.controller;
|
package com.muyu.fault.controller;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import com.muyu.common.core.domain.Result;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import com.muyu.fault.common.FaultLog;
|
||||||
|
import com.muyu.fault.service.FaultLogService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/log")
|
@RequestMapping("/log")
|
||||||
|
@Tag(name = "故障日志",description = "对故障记录日志")
|
||||||
public class FaultLogController{
|
public class FaultLogController{
|
||||||
|
@Autowired
|
||||||
|
private FaultLogService faultLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障日志列表
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/faultLogList", method = RequestMethod.GET)
|
||||||
|
public Result<List<FaultLog>> faultLogList(FaultLog faultLog){
|
||||||
|
List<FaultLog> list = faultLogService.faultLogList(faultLog);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加车辆故障日志
|
||||||
|
* @param faultLog
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/insertLog",method = RequestMethod.POST)
|
||||||
|
public Result insertLog(@RequestBody FaultLog 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
package com.muyu.fault.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
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.FaultMessageService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/message")
|
||||||
|
@Tag(name = "站内信的管理",description = "对站内信息的处理与查看")
|
||||||
|
public class FaultMessageController {
|
||||||
|
@Autowired
|
||||||
|
private FaultMessageService faultMessageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站内信列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/faultMessageList",method = RequestMethod.GET)
|
||||||
|
public Result<List<FaultMessage>> faultMessageList( FaultMessage faultMessage){
|
||||||
|
return Result.success(faultMessageService.faultMessageList(faultMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加消息
|
||||||
|
* @param faultMessage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/insertMessage",method = RequestMethod.POST)
|
||||||
|
public Result insertMessage(@RequestBody FaultMessage faultMessage){
|
||||||
|
String username = SecurityUtils.getUsername();
|
||||||
|
//消息发送人
|
||||||
|
faultMessage.setFaultMessageSendName(username);
|
||||||
|
return Result.success(faultMessageService.save(faultMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询未读状态(faultMessageState==1)信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/selectOne",method = RequestMethod.POST)
|
||||||
|
public Result<List<FaultMessage>> selectOne(){
|
||||||
|
List<FaultMessage> one = faultMessageService.selectOne();
|
||||||
|
return Result.success(one);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已读状态(faultMessageState==2)信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/selectTwo",method = RequestMethod.POST)
|
||||||
|
public Result<List<FaultMessage>> selectTwo(){
|
||||||
|
List<FaultMessage> one = faultMessageService.selectTwo();
|
||||||
|
return Result.success(one);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更改已读状态
|
||||||
|
* @param faultMessageId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/updateTwo/{faultMessageId}",method = RequestMethod.POST)
|
||||||
|
public Result updateTwo(@PathVariable(name = "faultMessageId") Long faultMessageId){
|
||||||
|
LambdaUpdateWrapper<FaultMessage> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.set(FaultMessage::getFaultMessageState,2);
|
||||||
|
updateWrapper.eq(FaultMessage::getFaultMessageId,faultMessageId);
|
||||||
|
faultMessageService.update(updateWrapper);
|
||||||
|
return Result.success(faultMessageId,"消息已读");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除消息
|
||||||
|
* @param faultMessageId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/deleteMessageId/{faultMessageId}",method = RequestMethod.POST)
|
||||||
|
public Result deleteMessageId(@PathVariable(name = "faultMessageId") Long faultMessageId){
|
||||||
|
return Result.success(faultMessageService.removeById(faultMessageId),"删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.fault.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.fault.common.FaultType;
|
||||||
|
import com.muyu.fault.service.FaultTypeService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/type")
|
||||||
|
@Tag(name = "故障类型",description = "对故障类型的定义")
|
||||||
|
public class FaultTypeController {
|
||||||
|
@Autowired
|
||||||
|
private FaultTypeService faultTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障类型表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "faultTypeList",method = RequestMethod.GET)
|
||||||
|
public Result<List<FaultType>> faultTypeList(FaultType faultType){
|
||||||
|
return Result.success(faultTypeService.faultTypeList(faultType));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加故障类型
|
||||||
|
* @param faultType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "insertType",method = RequestMethod.POST)
|
||||||
|
public Result insertType(@RequestBody FaultType faultType){
|
||||||
|
return Result.success(faultTypeService.save(faultType));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改故障类型
|
||||||
|
* @param faultType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "updateType",method = RequestMethod.POST)
|
||||||
|
public Result updateype(@RequestBody FaultType faultType){
|
||||||
|
return Result.success(faultTypeService.updateById(faultType));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除故障类型
|
||||||
|
* @param faultTypeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "deleteType/{faultTypeId}",method = RequestMethod.DELETE)
|
||||||
|
public Result deleteType(@PathVariable(name = "faultTypeId") Long faultTypeId){
|
||||||
|
return Result.success(faultTypeService.removeById(faultTypeId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.muyu.fault.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.fault.common.FaultrRule;
|
||||||
|
import com.muyu.fault.service.FaultrRuleService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/rule")
|
||||||
|
@Tag(name = "故障的规则",description = "对故障数据规则的判断")
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加车辆规则
|
||||||
|
* @param faultrRule
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/insertRule",method = RequestMethod.POST)
|
||||||
|
public Result insertRule(@RequestBody FaultrRule faultrRule){
|
||||||
|
return Result.success(faultrRuleService.save(faultrRule));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆规则
|
||||||
|
* @param faultrRule
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/updateRule",method = RequestMethod.POST)
|
||||||
|
public Result updateRule(@RequestBody FaultrRule faultrRule){
|
||||||
|
return Result.success(faultrRuleService.updateById(faultrRule));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取单条故障规则详细信息
|
||||||
|
* @param faultRuleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/byidRuleId/{faultRuleId}",method = RequestMethod.GET)
|
||||||
|
public Result byidRuleId(@PathVariable Long faultRuleId){
|
||||||
|
FaultrRule byid = faultrRuleService.byidRuleId(faultRuleId);
|
||||||
|
return Result.success(byid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆故障
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/remove/{ids}",method = RequestMethod.DELETE)
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
faultrRuleService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,29 +1,34 @@
|
||||||
package com.muyu.fault.controller;
|
package com.muyu.fault.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
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.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.fault.common.FaultLog;
|
||||||
|
import com.muyu.fault.common.SysCarFault;
|
||||||
|
import com.muyu.fault.service.FaultLogService;
|
||||||
|
import com.muyu.fault.service.SysCarFaultService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.muyu.fault.common.SysCarFault;
|
|
||||||
import com.muyu.fault.service.impl.SysCarFaultService;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/faultInfo")
|
@RequestMapping("/faultInfo")
|
||||||
|
@Tag(name = "故障管理",description = "故障的管理与查看")
|
||||||
public class SysCarFaultController extends BaseController
|
public class SysCarFaultController extends BaseController
|
||||||
{
|
{
|
||||||
@Resource
|
@Resource
|
||||||
private SysCarFaultService sysCarFaultService;
|
private SysCarFaultService sysCarFaultService;
|
||||||
|
@Autowired
|
||||||
|
private FaultLogService faultLogService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆故障列表
|
* 查询车辆故障列表
|
||||||
|
@ -62,10 +67,6 @@ public class SysCarFaultController extends BaseController
|
||||||
public Result<Integer> add(
|
public Result<Integer> add(
|
||||||
@Validated @RequestBody SysCarFault sysCarFault)
|
@Validated @RequestBody SysCarFault sysCarFault)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (sysCarFaultService.checkIdUnique(sysCarFault)) {
|
|
||||||
return error("新增 车辆故障 '" + sysCarFault + "'失败,车辆故障已存在");
|
|
||||||
}
|
|
||||||
String prefix = "GT"; // 随机码的前缀
|
String prefix = "GT"; // 随机码的前缀
|
||||||
int minNumber = 1; // 随机数字的最小值
|
int minNumber = 1; // 随机数字的最小值
|
||||||
int maxNumber = 999; // 随机数字的最大值
|
int maxNumber = 999; // 随机数字的最大值
|
||||||
|
@ -83,6 +84,15 @@ public class SysCarFaultController extends BaseController
|
||||||
//赋值
|
//赋值
|
||||||
sysCarFault.setFaultCode(randomCode);
|
sysCarFault.setFaultCode(randomCode);
|
||||||
sysCarFault.setCreateBy(SecurityUtils.getUsername());
|
sysCarFault.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
FaultLog faultLog = new FaultLog();
|
||||||
|
faultLog.setFaultLogCodes(sysCarFault.getFaultCode());
|
||||||
|
faultLog.setFaultLogVin(sysCarFault.getCarVin());
|
||||||
|
DateTime startTime = DateTime.now(); // 获取当前时间作为开始时间
|
||||||
|
faultLog.setFaultLogStartTime(startTime);
|
||||||
|
faultLogService.save(faultLog);
|
||||||
|
if (sysCarFaultService.checkIdUnique(sysCarFault)) {
|
||||||
|
return error("新增 车辆故障 '" + sysCarFault + "'失败,车辆故障已存在");
|
||||||
|
}
|
||||||
return toAjax(sysCarFaultService.save(sysCarFault));
|
return toAjax(sysCarFaultService.save(sysCarFault));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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> {
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.muyu.fault.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.fault.common.FaultType;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface FaultTypeMapper extends BaseMapper<FaultType> {
|
||||||
|
}
|
|
@ -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> {
|
||||||
|
}
|
|
@ -1,7 +1,14 @@
|
||||||
package com.muyu.fault.service.impl;
|
package com.muyu.fault.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.fault.common.FaultLog;
|
import com.muyu.fault.common.FaultLog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface FaultLogService extends IService<FaultLog> {
|
public interface FaultLogService extends IService<FaultLog> {
|
||||||
|
List<FaultLog> faultLogList(FaultLog faultLog);
|
||||||
|
|
||||||
|
|
||||||
|
FaultLog byidId(Long faultLogId);
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.muyu.fault.service;
|
||||||
|
|
||||||
|
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> selectOne();
|
||||||
|
|
||||||
|
List<FaultMessage> selectTwo();
|
||||||
|
|
||||||
|
List<FaultMessage> faultMessageList(FaultMessage faultMessage);
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.muyu.fault.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.fault.common.FaultType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface FaultTypeService extends IService<FaultType> {
|
||||||
|
List<FaultType> faultTypeList(FaultType faultType);
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.muyu.fault.service;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
FaultrRule byidRuleId(Long faultRuleId);
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.muyu.fault.service.impl;
|
package com.muyu.fault.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
@ -1,10 +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.mapper.FaultLogMapper;
|
import com.muyu.fault.mapper.FaultLogMapper;
|
||||||
|
import com.muyu.fault.service.FaultLogService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
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
|
||||||
|
public List<FaultLog> faultLogList(FaultLog faultLog) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
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.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.fault.common.FaultMessage;
|
||||||
|
import com.muyu.fault.mapper.FaultMessageMapper;
|
||||||
|
import com.muyu.fault.service.FaultMessageService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FaultMessageServiceImpl extends ServiceImpl<FaultMessageMapper, FaultMessage> implements FaultMessageService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FaultMessage> selectOne() {
|
||||||
|
LambdaQueryWrapper<FaultMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
//查询消息状态为1的未读数据
|
||||||
|
queryWrapper.eq(FaultMessage::getFaultMessageState, 1);
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FaultMessage> selectTwo() {
|
||||||
|
LambdaQueryWrapper<FaultMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
//查询消息状态为2的已读数据
|
||||||
|
queryWrapper.eq(FaultMessage::getFaultMessageState, 2);
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FaultMessage> faultMessageList(FaultMessage faultMessage) {
|
||||||
|
String username = SecurityUtils.getUsername();
|
||||||
|
LambdaQueryWrapper<FaultMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(faultMessage.getFaultMessageRemoveName())) {
|
||||||
|
queryWrapper.eq(FaultMessage::getFaultMessageSendName,username);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(String.valueOf(faultMessage.getFaultMessageState()))) {
|
||||||
|
queryWrapper.eq(FaultMessage::getFaultMessageState,faultMessage.getFaultMessageState());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(faultMessage.getFaultMessageSendName())) {
|
||||||
|
queryWrapper.like(FaultMessage::getFaultMessageSendName,faultMessage.getFaultMessageSendName());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
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.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.fault.common.FaultType;
|
||||||
|
import com.muyu.fault.mapper.FaultTypeMapper;
|
||||||
|
import com.muyu.fault.service.FaultTypeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FaultTypeServiceImpl extends ServiceImpl<FaultTypeMapper, FaultType> implements FaultTypeService {
|
||||||
|
@Override
|
||||||
|
public List<FaultType> faultTypeList(FaultType faultType) {
|
||||||
|
LambdaQueryWrapper<FaultType> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(faultType.getFaultTypeName())) {
|
||||||
|
queryWrapper.like(FaultType::getFaultTypeName,faultType.getFaultTypeName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(faultType.getFaultTypeDescription())) {
|
||||||
|
queryWrapper.like(FaultType::getFaultTypeDescription,faultType.getFaultTypeDescription());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
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.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.fault.common.FaultrRule;
|
||||||
|
import com.muyu.fault.mapper.FaultrRuleMapper;
|
||||||
|
import com.muyu.fault.service.FaultrRuleService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
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<>();
|
||||||
|
if (StringUtils.isNotEmpty(faultrRule.getFaultRuleName())) {
|
||||||
|
queryWrapper.eq(FaultrRule::getFaultRuleName,faultrRule.getFaultRuleName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(faultrRule.getFaultRuleParameter())) {
|
||||||
|
queryWrapper.eq(FaultrRule::getFaultRuleParameter,faultrRule.getFaultRuleParameter());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FaultrRule byidRuleId(Long faultRuleId) {
|
||||||
|
LambdaQueryWrapper<FaultrRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(faultRuleId, "规则ID不可为空");
|
||||||
|
queryWrapper.eq(FaultrRule::getFaultRuleId, faultRuleId);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package com.muyu.fault.service.impl;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.muyu.fault.common.SysCarFault;
|
import com.muyu.fault.common.SysCarFault;
|
||||||
|
import com.muyu.fault.service.SysCarFaultService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.muyu.fault.mapper.SysCarFaultMapper;
|
import com.muyu.fault.mapper.SysCarFaultMapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
@ -41,12 +42,10 @@ public class SysCarFaultServiceImpl
|
||||||
public List<SysCarFault> selectSysCarFaultList(SysCarFault sysCarFault)
|
public List<SysCarFault> selectSysCarFaultList(SysCarFault sysCarFault)
|
||||||
{
|
{
|
||||||
LambdaQueryWrapper<SysCarFault> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysCarFault> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(sysCarFault.getFaultType()),
|
queryWrapper.eq(StringUtils.isNotEmpty(String.valueOf(sysCarFault.getFaultTypeId())),
|
||||||
SysCarFault::getFaultType, sysCarFault.getFaultType());
|
SysCarFault::getFaultTypeId, sysCarFault.getFaultTypeId());
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getState()),
|
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getState()),
|
||||||
SysCarFault::getState, sysCarFault.getState());
|
SysCarFault::getState, sysCarFault.getState());
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultType()),
|
|
||||||
SysCarFault::getFaultType, sysCarFault.getFaultType());
|
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(sysCarFault.getCarVin()),
|
queryWrapper.like(StringUtils.isNotEmpty(sysCarFault.getCarVin()),
|
||||||
SysCarFault::getCarVin, sysCarFault.getCarVin());
|
SysCarFault::getCarVin, sysCarFault.getCarVin());
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultWarn()),
|
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultWarn()),
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
import org.simpleframework.xml.Text;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Text
|
||||||
|
public class Text01 {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// String prefix = "GT"; // 随机码的前缀
|
||||||
|
// int minNumber = 1; // 随机数字的最小值
|
||||||
|
// int maxNumber = 999; // 随机数字的最大值
|
||||||
|
// Random random = new Random(); // 创建一个随机对象
|
||||||
|
// // 生成一个随机数字
|
||||||
|
// int number = random.nextInt(maxNumber - minNumber + 1) + minNumber;
|
||||||
|
// // 将数字格式化为三位字符串,不足三位前面补0
|
||||||
|
// String formattedNumber = String.format("%03d", number);
|
||||||
|
// // 生成一个随机字母
|
||||||
|
// String alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
// String randomLetter = alphabets.charAt(random.nextInt(alphabets.length())) + "";
|
||||||
|
// // 拼接前缀、随机字母和随机数字
|
||||||
|
// String randomCode = prefix + randomLetter + formattedNumber;
|
||||||
|
// System.out.println(randomCode); // 输出随机码
|
||||||
|
// LocalDateTime startTime = LocalDateTime.now(); // 开始时间
|
||||||
|
// LocalDateTime endTime = startTime.plusHours(2); // 结束时间设置为开始时间后2小时
|
||||||
|
//
|
||||||
|
// System.out.println("Start Time: " + startTime);
|
||||||
|
// System.out.println("End Time: " + endTime);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue