添加车辆查看故障接口
parent
f6c9db3a2a
commit
5a149dc87f
|
@ -31,7 +31,6 @@ public class SysCarController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/addSysCar")
|
@PostMapping("/addSysCar")
|
||||||
public Result addSysCar(@RequestBody SysCar sysCar){
|
public Result addSysCar(@RequestBody SysCar sysCar){
|
||||||
return Result.success(sysCarService.addSysCar(sysCar));
|
return Result.success(sysCarService.addSysCar(sysCar));
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.muyu.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liuxinyue
|
||||||
|
* @Package:com.muyu.controller
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:TemplateService
|
||||||
|
* @Date:2024/9/22 22:02
|
||||||
|
*/
|
||||||
|
public class TemplateService {
|
||||||
|
|
||||||
|
public void messageParsing(String templateMessage){
|
||||||
|
|
||||||
|
//创建一个JSON对象
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
if(templateMessage.length()<18){
|
||||||
|
throw new RuntimeException("错误VIN码,不存在此车");
|
||||||
|
}
|
||||||
|
|
||||||
|
//将报文进行切割
|
||||||
|
String[] split = templateMessage.split(" ");
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
for (String s : split) {
|
||||||
|
|
||||||
|
int i = Integer.parseInt(s, 16);
|
||||||
|
stringBuilder.append((char)i);
|
||||||
|
|
||||||
|
}
|
||||||
|
//取出车辆的VIN码值
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue