parent
02f71d7baf
commit
00b4350289
|
@ -0,0 +1,47 @@
|
|||
package com.zhilian.common.resolver.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
/**
|
||||
* @ClassName ResolverMalfunctionLog
|
||||
* @Description 解析故障日志
|
||||
* @Author Can.J
|
||||
* @Date 2024/4/10 11:10
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ResolverMalfunctionLog {
|
||||
/**
|
||||
* 故障主键id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 故障码
|
||||
*/
|
||||
private String malfunctionCode;
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
private String malfunctionVin;
|
||||
/**
|
||||
* 开始报警时间
|
||||
*/
|
||||
private Date startTime;
|
||||
/**
|
||||
* 故障类型
|
||||
*/
|
||||
private String breakType;
|
||||
/**
|
||||
* 结束报警时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 故障标签
|
||||
*/
|
||||
private String malfunctionTag;
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.zhilian.resolver.controller;
|
||||
|
||||
import com.zhilian.common.core.domain.Result;
|
||||
import com.zhilian.common.resolver.domain.ResolverMalfunctionLog;
|
||||
import com.zhilian.resolver.service.MalfunctionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
/**
|
||||
* @ClassName MalfunctionController
|
||||
* @Description 解析故障日志控制层 测试
|
||||
* @Author Can.J
|
||||
* @Date 2024/4/10 11:13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/malfunction")
|
||||
public class MalfunctionController {
|
||||
@Autowired
|
||||
private MalfunctionService malfunctionService;
|
||||
|
||||
/**
|
||||
* 解析故障日志添加 测试
|
||||
* @param resolverMalfunctionLog
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/resolverMalfunctionInsert")
|
||||
public Result resolverMalfunctionInsert(@RequestBody ResolverMalfunctionLog resolverMalfunctionLog){
|
||||
Result resolverMalfunctionInsert =malfunctionService.resolverMalfunctionInsert(resolverMalfunctionLog);
|
||||
return resolverMalfunctionInsert;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.zhilian.resolver.mapper;
|
||||
|
||||
import com.zhilian.common.core.domain.Result;
|
||||
import com.zhilian.common.resolver.domain.ResolverMalfunctionLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MalfunctionMapper {
|
||||
Result resolverMalfunctionInsert(ResolverMalfunctionLog resolverMalfunctionLog);
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.zhilian.resolver.service;
|
||||
|
||||
import com.zhilian.common.core.domain.Result;
|
||||
import com.zhilian.common.resolver.domain.ResolverMalfunctionLog;
|
||||
|
||||
public interface MalfunctionService {
|
||||
Result resolverMalfunctionInsert(ResolverMalfunctionLog resolverMalfunctionLog);
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.zhilian.resolver.service.impl;
|
||||
|
||||
import com.zhilian.common.core.domain.Result;
|
||||
import com.zhilian.common.resolver.domain.ResolverMalfunctionLog;
|
||||
import com.zhilian.resolver.mapper.MalfunctionMapper;
|
||||
import com.zhilian.resolver.service.MalfunctionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
* @ClassName MalfunctionServiceImpl
|
||||
* @Description 解析故障日志业务实现层 测试
|
||||
* @Author Can.J
|
||||
* @Date 2024/4/10 11:12
|
||||
*/
|
||||
@Service
|
||||
public class MalfunctionServiceImpl implements MalfunctionService {
|
||||
@Autowired
|
||||
private MalfunctionMapper malfunctionMapper;
|
||||
@Override
|
||||
public Result resolverMalfunctionInsert(ResolverMalfunctionLog resolverMalfunctionLog) {
|
||||
return malfunctionMapper.resolverMalfunctionInsert(resolverMalfunctionLog);
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.zhilian.business.domain.BusinessBreak;
|
||||
import com.zhilian.business.remote.RemoteBreakService;
|
||||
import com.zhilian.common.redis.service.RedisService;
|
||||
import com.zhilian.common.resolver.domain.ResolverMalfunctionLog;
|
||||
import com.zhilian.common.resolver.domain.ResolverReportData;
|
||||
import com.zhilian.resolver.mapper.UserMapper;
|
||||
import com.zhilian.resolver.service.ResolverEventService;
|
||||
|
@ -50,6 +51,11 @@ public class MalfunctionEventServiceImpl implements ResolverEventService {
|
|||
|
||||
BusinessBreak businessBreak = new BusinessBreak();
|
||||
businessBreak.setBreakVin(vehicleData.getVin());
|
||||
|
||||
//测试故障日志添加
|
||||
ResolverMalfunctionLog resolverMalfunctionLog = new ResolverMalfunctionLog();
|
||||
resolverMalfunctionLog.setMalfunctionVin(vehicleData.getVin());
|
||||
|
||||
// * 车辆状态 1:正常 0:故障
|
||||
if(vehicleData.getVehicleStatus()==0){
|
||||
businessBreak.setBreakCode("CL001");
|
||||
|
@ -57,6 +63,11 @@ public class MalfunctionEventServiceImpl implements ResolverEventService {
|
|||
businessBreak.setBreakType("车体故障");
|
||||
businessBreak.setBreakState("1");
|
||||
remoteBreakService.add(businessBreak);
|
||||
|
||||
//测试故障日志添加
|
||||
resolverMalfunctionLog.setMalfunctionCode("CL001");
|
||||
|
||||
|
||||
}
|
||||
|
||||
// * 充电状态 1:正常 0:故障
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?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.zhilian.resolver.mapper.MalfunctionMapper">
|
||||
|
||||
<insert id="resolverMalfunctionInsert">
|
||||
INSERT INTO `vehicle-resolver`.`resolver_malfunction_log` (`malfunction_code`, `malfunction_vin`, `start_time`, `break_type`, `end_time`, `malfunction_tag`)
|
||||
VALUES (#{malfunctionCode}, #{malfunctionVin}, #{startTime}, #{breakType}, #{endTime}, #{malfunctionTag});
|
||||
</insert>
|
||||
</mapper>
|
Loading…
Reference in New Issue