初始化
parent
bdcae66e02
commit
f5b153f32c
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-modules</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-modules-carmanage</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataSource -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-datasource</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataScope -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-datascope</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Log -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 接口模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- XllJob定时任务 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-xxl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-rabbit</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
<artifactId>bcpkix-jdk15on</artifactId>
|
||||||
|
<version>1.70</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.muyu.car;
|
||||||
|
|
||||||
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统模块
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
*/
|
||||||
|
@EnableCustomConfig
|
||||||
|
//@EnableCustomSwagger2
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class CloudCarApplication {
|
||||||
|
public static void main (String[] args) {
|
||||||
|
SpringApplication.run(CloudCarApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.muyu.car.constant;
|
||||||
|
|
||||||
|
public class RedisConstant {
|
||||||
|
|
||||||
|
public static final String MESSAGE_DETAIL = "messageDetail";
|
||||||
|
|
||||||
|
public static final String VEHICLE_ENTERPRISE = "vehicleEnterprise";
|
||||||
|
|
||||||
|
public static final String INDEX_WARNING = "indexWarning";
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
package com.muyu.car.controller;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
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.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.car.domain.SysCar;
|
||||||
|
import com.muyu.car.service.ISysCarService;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆基础信息Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/car")
|
||||||
|
public class SysCarController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysCarService sysCarService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆基础信息列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("car:car:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<SysCar>> list(SysCar sysCar)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysCar> list = sysCarService.selectSysCarList(sysCar);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆基础信息列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("car:car:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysCar sysCar)
|
||||||
|
{
|
||||||
|
List<SysCar> list = sysCarService.selectSysCarList(sysCar);
|
||||||
|
ExcelUtil<SysCar> util = new ExcelUtil<SysCar>(SysCar.class);
|
||||||
|
util.exportExcel(response, list, "车辆基础信息数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆基础信息详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("car:car:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<List<SysCar>> getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(sysCarService.selectSysCarById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆基础信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("car:car:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody SysCar sysCar)
|
||||||
|
{
|
||||||
|
// 获取当前时间(没有时区)
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
// 假设我们使用系统默认时区
|
||||||
|
ZoneId zoneId = ZoneId.systemDefault();
|
||||||
|
// 将LocalDateTime转换为ZonedDateTime(添加了时区信息)
|
||||||
|
ZonedDateTime zdt = now.atZone(zoneId);
|
||||||
|
// 将ZonedDateTime转换为Instant(UTC时间线上的点)
|
||||||
|
Instant instant = zdt.toInstant();
|
||||||
|
// 将Instant转换为Date
|
||||||
|
Date date = Date.from(instant);
|
||||||
|
sysCar.setCarLastJoinTime(date);
|
||||||
|
if (sysCarService.checkIdUnique(sysCar)) {
|
||||||
|
return error("新增 车辆基础信息 '" + sysCar + "'失败,车辆基础信息已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
return toAjax(sysCarService.save(sysCar));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆基础信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("car:car:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody SysCar sysCar)
|
||||||
|
{
|
||||||
|
if (!sysCarService.checkIdUnique(sysCar)) {
|
||||||
|
return error("修改 车辆基础信息 '" + sysCar + "'失败,车辆基础信息不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
return toAjax(sysCarService.updateById(sysCar));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆基础信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("car:car:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
sysCarService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,178 @@
|
||||||
|
package com.muyu.car.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
import com.muyu.car.domain.SysCarMessage;
|
||||||
|
import com.muyu.car.domain.SysMessageType;
|
||||||
|
import com.muyu.car.domain.VO.SysMessageVO;
|
||||||
|
import com.muyu.car.service.ISysCarMessageService;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
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.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文记录Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/messageInfo")
|
||||||
|
public class SysCarMessageController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private ISysCarMessageService sysCarMessageService;
|
||||||
|
@Autowired
|
||||||
|
private HttpSession session;
|
||||||
|
|
||||||
|
static String TEST = "7E 56 45 48 49 43 4C 45 5F 4D 53 47 3A 56 49 4E 31 32 B6 A1 C0 F2 B3 E5 D9 A8 C1 B2 E3 F4 A6 D7 C9 F1 E0 A3 B5 C8 D4 E2 A1 F5 B6 C7 E8 D9 A0 E3 B2 C4 F5 D6 A8 C0 E1 F2 B7 D8 A4 E3 C2 B1 A5 D9 F6 C8 E7 A0 B2 C3 D1 F4 E5 A9 3F 2A 7B D9 1E C8 4D A3 6F 5B 9A 0C 3E 7D F2 8B 46 1A 5E 9F 2D 73 8C 4A B1 6C 5D E2 7E C4 39 0B AD 7C 1F 0E 3C 68 92 B4 5A 7F 6E 81 0D 4B A5 E3 F9 2E 8A 37 6D 14 5C 73 8E D2 04 9B 3A 6C F1 70 BF 29 5F 8C 43 61 24 5D 7A 9C 0A D5 1B 3D 6E F4 78 3E 5B";
|
||||||
|
|
||||||
|
@RequiresPermissions("message:message:test")
|
||||||
|
@GetMapping("/test")
|
||||||
|
public Result test() throws InterruptedException, ExecutionException {
|
||||||
|
List<SysCarMessage> list = (List<SysCarMessage>) session.getAttribute("list");
|
||||||
|
|
||||||
|
// 检查 list 是否为空
|
||||||
|
if (list == null || list.isEmpty()) {
|
||||||
|
return Result.success(new String[0]); // 或者返回一个适当的错误消息
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] test = TEST.split(" ");
|
||||||
|
String[] results = new String[list.size()];
|
||||||
|
|
||||||
|
List<CompletableFuture<String>> futures = new ArrayList<>();
|
||||||
|
|
||||||
|
for (SysCarMessage carMessage : list) {
|
||||||
|
futures.add(CompletableFuture.supplyAsync(() -> {
|
||||||
|
int startIndex = Integer.parseInt(carMessage.getMessageStartIndex()) - 1;
|
||||||
|
int endIndex = Integer.parseInt(carMessage.getMessageEndIndex());
|
||||||
|
StringBuilder hexBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
for (int j = startIndex; j < endIndex; j++) {
|
||||||
|
hexBuilder.append(test[j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
String hex = hexBuilder.toString();
|
||||||
|
char[] result = new char[hex.length() / 2];
|
||||||
|
|
||||||
|
for (int x = 0; x < hex.length(); x += 2) {
|
||||||
|
int high = Character.digit(hex.charAt(x), 16);
|
||||||
|
int low = Character.digit(hex.charAt(x + 1), 16);
|
||||||
|
result[x / 2] = (char) ((high << 4) + low);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new String(result);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < futures.size(); i++) {
|
||||||
|
results[i] = futures.get(i).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.success(results);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆报文记录列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:message:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<SysCarMessage>> list(SysCarMessage sysCarMessage)
|
||||||
|
{
|
||||||
|
List<SysCarMessage> list = sysCarMessageService.selectSysCarMessageList(sysCarMessage);
|
||||||
|
session.setAttribute("list", list);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("message:message:dobList")
|
||||||
|
@GetMapping("/dobList")
|
||||||
|
public Result<List<SysMessageVO>> dobList(SysMessageVO sysMessageVO)
|
||||||
|
{
|
||||||
|
List<SysMessageVO> list = sysCarMessageService.dobList(sysMessageVO);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆报文记录列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:message:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysCarMessage sysCarMessage)
|
||||||
|
{
|
||||||
|
List<SysCarMessage> list = sysCarMessageService.selectSysCarMessageList(sysCarMessage);
|
||||||
|
ExcelUtil<SysCarMessage> util = new ExcelUtil<SysCarMessage>(SysCarMessage.class);
|
||||||
|
util.exportExcel(response, list, "车辆报文记录数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆报文记录详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:message:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<List<SysCarMessage>> getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(sysCarMessageService.selectSysCarMessageById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆报文记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:message:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody SysCarMessage sysCarMessage)
|
||||||
|
{
|
||||||
|
if (sysCarMessageService.checkIdUnique(sysCarMessage)) {
|
||||||
|
return error("新增 车辆报文记录 '" + sysCarMessage + "'失败,车辆报文记录已存在");
|
||||||
|
}
|
||||||
|
return toAjax(sysCarMessageService.save(sysCarMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆报文记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:message:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody SysCarMessage sysCarMessage)
|
||||||
|
{
|
||||||
|
if (!sysCarMessageService.checkIdUnique(sysCarMessage)) {
|
||||||
|
return error("修改 车辆报文记录 '" + sysCarMessage + "'失败,车辆报文记录不存在");
|
||||||
|
}
|
||||||
|
return toAjax(sysCarMessageService.updateById(sysCarMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆报文记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:message:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
sysCarMessageService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
package com.muyu.car.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.car.domain.SysMessageType;
|
||||||
|
import com.muyu.car.service.ISysMessageTypeService;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
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.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文类型Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/messageType")
|
||||||
|
public class SysMessageTypeController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private ISysMessageTypeService sysMessageTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆报文类型列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:messageType:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<SysMessageType>> list(SysMessageType sysMessageType)
|
||||||
|
{
|
||||||
|
List<SysMessageType> list = sysMessageTypeService.selectSysMessageTypeList(sysMessageType);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆报文类型列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:messageType:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysMessageType sysMessageType)
|
||||||
|
{
|
||||||
|
List<SysMessageType> list = sysMessageTypeService.selectSysMessageTypeList(sysMessageType);
|
||||||
|
ExcelUtil<SysMessageType> util = new ExcelUtil<SysMessageType>(SysMessageType.class);
|
||||||
|
util.exportExcel(response, list, "车辆报文类型数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆报文类型详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:messageType:query")
|
||||||
|
@GetMapping(value = "/{messageCode}")
|
||||||
|
public Result<List<SysMessageType>> getInfo(@PathVariable("messageCode") String[] messageCodes)
|
||||||
|
{
|
||||||
|
SysMessageType[] list = new SysMessageType[messageCodes.length]; // 确保数组大小
|
||||||
|
for (int i = 0; i < messageCodes.length; i++) {
|
||||||
|
list[i] = sysMessageTypeService.selectSysMessageTypeByMessageCode(messageCodes[i]);
|
||||||
|
}
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆报文类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:messageType:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody SysMessageType sysMessageType)
|
||||||
|
{
|
||||||
|
if (sysMessageTypeService.checkIdUnique(sysMessageType)) {
|
||||||
|
return error("新增 车辆报文类型 '" + sysMessageType + "'失败,车辆报文类型已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
return toAjax(sysMessageTypeService.save(sysMessageType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆报文类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:messageType:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody SysMessageType sysMessageType)
|
||||||
|
{
|
||||||
|
if (!sysMessageTypeService.checkIdUnique(sysMessageType)) {
|
||||||
|
return error("修改 车辆报文类型 '" + sysMessageType + "'失败,车辆报文类型不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
return toAjax(sysMessageTypeService.updateById(sysMessageType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆报文类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("message:messageType:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
sysMessageTypeService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package com.muyu.car.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆基础信息对象 sys_car
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("sys_car")
|
||||||
|
public class SysCar {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 自增主键 */
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 车辆VIN码 */
|
||||||
|
@Excel(name = "车辆VIN码")
|
||||||
|
private String carVin;
|
||||||
|
|
||||||
|
/** 车辆车牌号 */
|
||||||
|
@Excel(name = "车辆车牌号")
|
||||||
|
private String carPlate;
|
||||||
|
|
||||||
|
/** 车辆品牌 */
|
||||||
|
@Excel(name = "车辆品牌")
|
||||||
|
private String carBrand;
|
||||||
|
|
||||||
|
/** 车辆型号 */
|
||||||
|
@Excel(name = "车辆型号")
|
||||||
|
private String carModel;
|
||||||
|
|
||||||
|
/** 车辆车型(如客车,卡车,公交车等) */
|
||||||
|
@Excel(name = "车辆车型(如客车,卡车,公交车等)")
|
||||||
|
private String carType;
|
||||||
|
|
||||||
|
/** 最后一次连线时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "最后一次连线时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date carLastJoinTime;
|
||||||
|
|
||||||
|
/** 最后一次离线时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "最后一次离线时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date carLastOfflineTime;
|
||||||
|
|
||||||
|
/** 启用状态(1.在线 2.离线 3.已断开 4.待连接 5.维修中 */
|
||||||
|
@Excel(name = "启用状态(1.在线 2.离线 3.已断开 4.待连接 5.维修中")
|
||||||
|
private String state;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("carVin", getCarVin())
|
||||||
|
.append("carPlate", getCarPlate())
|
||||||
|
.append("carBrand", getCarBrand())
|
||||||
|
.append("carModel", getCarModel())
|
||||||
|
.append("carType", getCarType())
|
||||||
|
.append("carLastJoinTime", getCarLastJoinTime())
|
||||||
|
.append("carLastOfflineTime", getCarLastOfflineTime())
|
||||||
|
.append("state", getState())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.muyu.car.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文记录对象 sys_car_message
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("sys_car_message")
|
||||||
|
public class SysCarMessage {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 自增主键 */
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 车辆型号编码 */
|
||||||
|
@Excel(name = "车辆型号编码")
|
||||||
|
private String modelCode;
|
||||||
|
|
||||||
|
/** 车辆报文类型编码 */
|
||||||
|
@Excel(name = "i")
|
||||||
|
private String messageTypeCode;
|
||||||
|
|
||||||
|
/** 开始位下标 */
|
||||||
|
@Excel(name = "开始位下标")
|
||||||
|
private String messageStartIndex;
|
||||||
|
|
||||||
|
/** 结束位下标 */
|
||||||
|
@Excel(name = "结束位下标")
|
||||||
|
private String messageEndIndex;
|
||||||
|
|
||||||
|
/** 报文分类 */
|
||||||
|
@Excel(name = "报文分类")
|
||||||
|
private String messageType;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("modelCode", getModelCode())
|
||||||
|
.append("messageTypeCode", getMessageTypeCode())
|
||||||
|
.append("messageStartIndex", getMessageStartIndex())
|
||||||
|
.append("messageEndIndex", getMessageEndIndex())
|
||||||
|
.append("messageType", getMessageType())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.muyu.car.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文类型对象 sys_message_type
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("sys_message_type")
|
||||||
|
public class SysMessageType {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 自增主键 */
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 报文编码 */
|
||||||
|
@Excel(name = "报文编码")
|
||||||
|
private String messageCode;
|
||||||
|
|
||||||
|
/** 报文名称 */
|
||||||
|
@Excel(name = "报文名称")
|
||||||
|
private String messageName;
|
||||||
|
|
||||||
|
/** 报文分类 */
|
||||||
|
@Excel(name = "报文分类")
|
||||||
|
private String messageType;
|
||||||
|
@Excel(name = "报文字段类型")
|
||||||
|
private String messageClass;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("messageCode", getMessageCode())
|
||||||
|
.append("messageName", getMessageName())
|
||||||
|
.append("messageType", getMessageType())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.muyu.car.domain.VO;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文类型对象 sys_message_type
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysMessageVO {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String modelCode;
|
||||||
|
private String messageTypeCode;
|
||||||
|
private String messageStartIndex;
|
||||||
|
private String messageEndIndex;
|
||||||
|
private String messageType;
|
||||||
|
|
||||||
|
private String messageName;
|
||||||
|
}
|
|
@ -0,0 +1,205 @@
|
||||||
|
package com.muyu.car.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class VehicleMessage extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIN码
|
||||||
|
*/
|
||||||
|
private String carVin;
|
||||||
|
/**
|
||||||
|
* 时间戳
|
||||||
|
*/
|
||||||
|
private Long startTime;
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
private String longitude;
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
private String latitude;
|
||||||
|
/**
|
||||||
|
* 车速
|
||||||
|
*/
|
||||||
|
private String speed;
|
||||||
|
/**
|
||||||
|
* 总里程
|
||||||
|
*/
|
||||||
|
private String totalMileage;
|
||||||
|
/**
|
||||||
|
* 总电压
|
||||||
|
*/
|
||||||
|
private String totalVoltage;
|
||||||
|
/**
|
||||||
|
* 总电流
|
||||||
|
*/
|
||||||
|
private String combinedCurrent;
|
||||||
|
/**
|
||||||
|
* 绝缘电阻
|
||||||
|
*/
|
||||||
|
private String insulationResistance;
|
||||||
|
/**
|
||||||
|
* 档位
|
||||||
|
*/
|
||||||
|
private String gearPosition;
|
||||||
|
/**
|
||||||
|
* 加速踏板行程值
|
||||||
|
*/
|
||||||
|
private String acceleratorPedalTravelValue;
|
||||||
|
/**
|
||||||
|
* 制动踏板行程值
|
||||||
|
*/
|
||||||
|
private String brakePedalTravelValue;
|
||||||
|
/**
|
||||||
|
* 燃料消耗率
|
||||||
|
*/
|
||||||
|
private String specificFuelConsumption;
|
||||||
|
/**
|
||||||
|
* 电机控制器温度
|
||||||
|
*/
|
||||||
|
private String motorControllerTemperature;
|
||||||
|
/**
|
||||||
|
* 电机转速
|
||||||
|
*/
|
||||||
|
private String motorSpeed;
|
||||||
|
/**
|
||||||
|
* 电机转矩
|
||||||
|
*/
|
||||||
|
private String motorTorque;
|
||||||
|
/**
|
||||||
|
* 电机温度
|
||||||
|
*/
|
||||||
|
private String motorTemperature;
|
||||||
|
/**
|
||||||
|
* 电机电压
|
||||||
|
*/
|
||||||
|
private String motorVoltage;
|
||||||
|
/**
|
||||||
|
* 电机电流
|
||||||
|
*/
|
||||||
|
private String motorCurrent;
|
||||||
|
/**
|
||||||
|
* 动力电池剩余电量SOC
|
||||||
|
*/
|
||||||
|
private String powerBatteryRemainingSOC;
|
||||||
|
/**
|
||||||
|
* 当前状态允许的最大反馈功率
|
||||||
|
*/
|
||||||
|
private String maximumPower;
|
||||||
|
/**
|
||||||
|
* 当前状态允许最大放电功率
|
||||||
|
*/
|
||||||
|
private String maximumDischargePower;
|
||||||
|
/**
|
||||||
|
* BMS自检计数器
|
||||||
|
*/
|
||||||
|
private String BMSSelfCheckCounter;
|
||||||
|
/**
|
||||||
|
* 动力电池充放电电流
|
||||||
|
*/
|
||||||
|
private String electricCurrent;
|
||||||
|
/**
|
||||||
|
* 动力电池负载端总电压V3
|
||||||
|
*/
|
||||||
|
private String totalVoltageV3;
|
||||||
|
/**
|
||||||
|
* 单次最大电压
|
||||||
|
*/
|
||||||
|
private String singleMaximumVoltage;
|
||||||
|
/**
|
||||||
|
* 单体电池最低电压
|
||||||
|
*/
|
||||||
|
private String minimumVoltageOfABattery;
|
||||||
|
/**
|
||||||
|
* 单体电池最高温度
|
||||||
|
*/
|
||||||
|
private String maximumBatteryTemperature;
|
||||||
|
/**
|
||||||
|
* 单体电池最低温度
|
||||||
|
*/
|
||||||
|
private String minimumBatteryTemperature;
|
||||||
|
/**
|
||||||
|
* 动力电池可用容量
|
||||||
|
*/
|
||||||
|
private String powerBatteryAvailableCapacity;
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
private String vehicleStatus;
|
||||||
|
/**
|
||||||
|
* 充电状态
|
||||||
|
*/
|
||||||
|
private String chargingState;
|
||||||
|
/**
|
||||||
|
* 运行状态
|
||||||
|
*/
|
||||||
|
private String runningState;
|
||||||
|
/**
|
||||||
|
* SOC
|
||||||
|
*/
|
||||||
|
private String SOC;
|
||||||
|
/**
|
||||||
|
* 可充电储能装置工作状态
|
||||||
|
*/
|
||||||
|
private String workStatus;
|
||||||
|
/**
|
||||||
|
* 驱动电机状态
|
||||||
|
*/
|
||||||
|
private String driveMotorCondition;
|
||||||
|
/**
|
||||||
|
* 定位是否有效
|
||||||
|
*/
|
||||||
|
private String orientation;
|
||||||
|
/**
|
||||||
|
* EAS
|
||||||
|
*/
|
||||||
|
private String eas;
|
||||||
|
/**
|
||||||
|
* PTC
|
||||||
|
*/
|
||||||
|
private String ptc;
|
||||||
|
/**
|
||||||
|
* EPS
|
||||||
|
*/
|
||||||
|
private String eps;
|
||||||
|
/**
|
||||||
|
* ABS
|
||||||
|
*/
|
||||||
|
private String abs;
|
||||||
|
/**
|
||||||
|
* MCU
|
||||||
|
*/
|
||||||
|
private String mcu;
|
||||||
|
/**
|
||||||
|
* 动力电池加热状态
|
||||||
|
*/
|
||||||
|
private String heatingState;
|
||||||
|
/**
|
||||||
|
* 动力电池当前状态
|
||||||
|
*/
|
||||||
|
private String currentStatus;
|
||||||
|
/**
|
||||||
|
* 动力电池保温状态
|
||||||
|
*/
|
||||||
|
private String insulationState;
|
||||||
|
/**
|
||||||
|
* DCDC
|
||||||
|
*/
|
||||||
|
private String dcdc;
|
||||||
|
/**
|
||||||
|
* CHG
|
||||||
|
*/
|
||||||
|
private String chg;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.muyu.car.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.car.domain.SysCar;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆基础信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
public interface SysCarMapper extends BaseMapper<SysCar>{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.muyu.car.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.car.domain.SysCarMessage;
|
||||||
|
import com.muyu.car.domain.VO.SysMessageVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysCarMessageMapper extends BaseMapper<SysCarMessage>{
|
||||||
|
List<SysMessageVO>dobList(SysMessageVO sysMessageVO);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.muyu.car.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.car.domain.SysMessageType;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文类型Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysMessageTypeMapper extends BaseMapper<SysMessageType>{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,157 @@
|
||||||
|
package com.muyu.car.redis;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
|
||||||
|
import com.muyu.car.constant.RedisConstant;
|
||||||
|
import com.muyu.car.domain.VehicleMessage;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class RedisInitialize {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String,String>redisTemplate;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void a() {
|
||||||
|
|
||||||
|
new Thread(()->{
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
}catch (Exception exception){
|
||||||
|
throw new RuntimeException(exception);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
VehicleMessage message1 = new VehicleMessage();
|
||||||
|
message1.setStartTime(System.currentTimeMillis());
|
||||||
|
message1.setSpeed("50");
|
||||||
|
message1.setLongitude("126.397428");
|
||||||
|
message1.setLatitude("37.90923");
|
||||||
|
message1.setTotalMileage("1010");
|
||||||
|
message1.setTotalVoltage("22.5");
|
||||||
|
message1.setAcceleratorPedalTravelValue("1.5");
|
||||||
|
message1.setBrakePedalTravelValue("1.2");
|
||||||
|
message1.setSpecificFuelConsumption("1.8");
|
||||||
|
message1.setMotorControllerTemperature("59");
|
||||||
|
message1.setMotorSpeed("850");
|
||||||
|
message1.setMotorTorque("110");
|
||||||
|
message1.setMotorTemperature("53");
|
||||||
|
message1.setMotorVoltage("12.5");
|
||||||
|
message1.setMotorCurrent("1.1");
|
||||||
|
message1.setPowerBatteryRemainingSOC("88");
|
||||||
|
message1.setMaximumPower("999");
|
||||||
|
message1.setMaximumDischargePower("950");
|
||||||
|
message1.setDcdc("2");
|
||||||
|
message1.setChg("2");
|
||||||
|
message1.setBMSSelfCheckCounter("2");
|
||||||
|
message1.setElectricCurrent("2.3");
|
||||||
|
message1.setTotalVoltageV3("13.1");
|
||||||
|
message1.setSingleMaximumVoltage("14.1");
|
||||||
|
message1.setMinimumVoltageOfABattery("12.2");
|
||||||
|
message1.setMaximumBatteryTemperature("85");
|
||||||
|
message1.setMinimumBatteryTemperature("51");
|
||||||
|
message1.setPowerBatteryAvailableCapacity("560");
|
||||||
|
message1.setCombinedCurrent("1.1");
|
||||||
|
message1.setRunningState("2");
|
||||||
|
message1.setWorkStatus("2");
|
||||||
|
message1.setDriveMotorCondition("1");
|
||||||
|
message1.setVehicleStatus("1");
|
||||||
|
message1.setChargingState("1");
|
||||||
|
message1.setHeatingState("1");
|
||||||
|
message1.setCarVin("1HGCM826X3A004352");
|
||||||
|
|
||||||
|
redisTemplate.opsForValue().set(RedisConstant.VEHICLE_ENTERPRISE + message1.getCarVin(), JSON.toJSONString(message1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initialize() {
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// new Thread(() -> {
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(500);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
// List<VehicleMessageMiddle> vehicleMessageMiddleList = vehicleMessageMiddleService.list();
|
||||||
|
// vehicleMessageMiddleList.forEach(vehicleMessageMiddle -> {
|
||||||
|
// List<MessageDetail> messageDetailList = messageDetailService.list(new LambdaQueryWrapper<>() {{
|
||||||
|
// in(MessageDetail::getId, Arrays.asList(vehicleMessageMiddle.getMessageIds().split(",")));
|
||||||
|
// }});
|
||||||
|
// String jsonString = JSON.toJSONString(messageDetailList);
|
||||||
|
// redisTemplate.opsForHash().put(RedisConstant.MESSAGE_DETAIL, vehicleMessageMiddle.getCarVin(), jsonString);
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
// MessageDetail messageDetail = new MessageDetail();
|
||||||
|
// messageDetail.setKeyCode("1");
|
||||||
|
// messageDetail.setLabel("测试");
|
||||||
|
// messageDetail.setStartBit(0);
|
||||||
|
// messageDetail.setStopBit(8);
|
||||||
|
// messageDetail.setType("1");
|
||||||
|
|
||||||
|
// List<VehicleMessageMiddle> list = vehicleMessageMiddleService.list();
|
||||||
|
// list.forEach(vehicleMessageMiddle -> {
|
||||||
|
// List<MessageDetail> messageDetailList = messageDetailService.list(new LambdaQueryWrapper<>() {{
|
||||||
|
// in(MessageDetail::getId, Arrays.asList(vehicleMessageMiddle.getMessageIds().split(",")));
|
||||||
|
// });
|
||||||
|
// String jsonString = JSON.toJSONString(messageDetailList);
|
||||||
|
// redisTemplate.opsForHash().put(RedisConstant.VEHICLE_ENTERPRISE, message1.getCarVin(), String.valueOf(jsonString));
|
||||||
|
|
||||||
|
new Thread(()->{
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
}catch (Exception exception){
|
||||||
|
throw new RuntimeException(exception);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
VehicleMessage message1 = new VehicleMessage();
|
||||||
|
message1.setStartTime(System.currentTimeMillis());
|
||||||
|
message1.setSpeed("50");
|
||||||
|
message1.setLongitude("116.397428");
|
||||||
|
message1.setLatitude("39.90923");
|
||||||
|
message1.setTotalMileage("1000");
|
||||||
|
message1.setTotalVoltage("12.5");
|
||||||
|
message1.setAcceleratorPedalTravelValue("0.5");
|
||||||
|
message1.setBrakePedalTravelValue("0.2");
|
||||||
|
message1.setSpecificFuelConsumption("0.8");
|
||||||
|
message1.setMotorControllerTemperature("60");
|
||||||
|
message1.setMotorSpeed("800");
|
||||||
|
message1.setMotorTorque("100");
|
||||||
|
message1.setMotorTemperature("70");
|
||||||
|
message1.setMotorVoltage("12.6");
|
||||||
|
message1.setMotorCurrent("1.2");
|
||||||
|
message1.setPowerBatteryRemainingSOC("80");
|
||||||
|
message1.setMaximumPower("1000");
|
||||||
|
message1.setMaximumDischargePower("900");
|
||||||
|
message1.setDcdc("1");
|
||||||
|
message1.setChg("1");
|
||||||
|
message1.setBMSSelfCheckCounter("1");
|
||||||
|
message1.setElectricCurrent("2.5");
|
||||||
|
message1.setTotalVoltageV3("13.5");
|
||||||
|
message1.setSingleMaximumVoltage("14.5");
|
||||||
|
message1.setMinimumVoltageOfABattery("12.0");
|
||||||
|
message1.setMaximumBatteryTemperature("80");
|
||||||
|
message1.setMinimumBatteryTemperature("50");
|
||||||
|
message1.setPowerBatteryAvailableCapacity("800");
|
||||||
|
message1.setCombinedCurrent("1.5");
|
||||||
|
message1.setRunningState("1");
|
||||||
|
message1.setWorkStatus("1");
|
||||||
|
message1.setDriveMotorCondition("1");
|
||||||
|
message1.setVehicleStatus("1");
|
||||||
|
message1.setChargingState("1");
|
||||||
|
message1.setHeatingState("1");
|
||||||
|
message1.setCarVin("1HGCM826X3A004352");
|
||||||
|
|
||||||
|
redisTemplate.opsForValue().set(RedisConstant.VEHICLE_ENTERPRISE + message1.getCarVin(), JSON.toJSONString(message1));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.muyu.car.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.car.domain.SysCarMessage;
|
||||||
|
import com.muyu.car.domain.VO.SysMessageVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文记录Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
public interface ISysCarMessageService extends IService<SysCarMessage> {
|
||||||
|
|
||||||
|
List<SysMessageVO>dobList(SysMessageVO sysMessageVO);
|
||||||
|
/**
|
||||||
|
* 精确查询车辆报文记录
|
||||||
|
*
|
||||||
|
* @param id 车辆报文记录主键
|
||||||
|
* @return 车辆报文记录
|
||||||
|
*/
|
||||||
|
public SysCarMessage selectSysCarMessageById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆报文记录列表
|
||||||
|
*
|
||||||
|
* @param sysCarMessage 车辆报文记录
|
||||||
|
* @return 车辆报文记录集合
|
||||||
|
*/
|
||||||
|
public List<SysCarMessage> selectSysCarMessageList(SysCarMessage sysCarMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 车辆报文记录 id是否唯一
|
||||||
|
* @param sysCarMessage 车辆报文记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Boolean checkIdUnique(SysCarMessage sysCarMessage);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.muyu.car.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.car.domain.SysCar;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆基础信息Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
public interface ISysCarService extends IService<SysCar> {
|
||||||
|
/**
|
||||||
|
* 精确查询车辆基础信息
|
||||||
|
*
|
||||||
|
* @param id 车辆基础信息主键
|
||||||
|
* @return 车辆基础信息
|
||||||
|
*/
|
||||||
|
public SysCar selectSysCarById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆基础信息列表
|
||||||
|
*
|
||||||
|
* @param sysCar 车辆基础信息
|
||||||
|
* @return 车辆基础信息集合
|
||||||
|
*/
|
||||||
|
public List<SysCar> selectSysCarList(SysCar sysCar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 车辆基础信息 id是否唯一
|
||||||
|
* @param sysCar 车辆基础信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Boolean checkIdUnique(SysCar sysCar);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.car.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.car.domain.SysMessageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文类型Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
public interface ISysMessageTypeService extends IService<SysMessageType> {
|
||||||
|
/**
|
||||||
|
* 精确查询车辆报文类型
|
||||||
|
*
|
||||||
|
* @param messageCode 车辆报文类型主键
|
||||||
|
* @return 车辆报文类型
|
||||||
|
*/
|
||||||
|
public SysMessageType selectSysMessageTypeByMessageCode(String messageCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆报文类型列表
|
||||||
|
*
|
||||||
|
* @param sysMessageType 车辆报文类型
|
||||||
|
* @return 车辆报文类型集合
|
||||||
|
*/
|
||||||
|
public List<SysMessageType> selectSysMessageTypeList(SysMessageType sysMessageType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 车辆报文类型 id是否唯一
|
||||||
|
* @param sysMessageType 车辆报文类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Boolean checkIdUnique(SysMessageType sysMessageType);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
package com.muyu.car.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.car.domain.SysCarMessage;
|
||||||
|
import com.muyu.car.domain.VO.SysMessageVO;
|
||||||
|
import com.muyu.car.mapper.SysCarMessageMapper;
|
||||||
|
import com.muyu.car.service.ISysCarMessageService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysCarMessageServiceImpl
|
||||||
|
extends ServiceImpl<SysCarMessageMapper, SysCarMessage>
|
||||||
|
implements ISysCarMessageService {
|
||||||
|
@Autowired
|
||||||
|
private SysCarMessageMapper mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysMessageVO> dobList(SysMessageVO sysMessageVO) {
|
||||||
|
return mapper.dobList(sysMessageVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询车辆报文记录
|
||||||
|
*
|
||||||
|
* @param id 车辆报文记录主键
|
||||||
|
* @return 车辆报文记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysCarMessage selectSysCarMessageById(Long id)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<SysCarMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(id, "id不可为空");
|
||||||
|
queryWrapper.eq(SysCarMessage::getId, id);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆报文记录列表
|
||||||
|
*
|
||||||
|
* @param sysCarMessage 车辆报文记录
|
||||||
|
* @return 车辆报文记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysCarMessage> selectSysCarMessageList(SysCarMessage sysCarMessage)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<SysCarMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(sysCarMessage.getModelCode())){
|
||||||
|
queryWrapper.eq(SysCarMessage::getModelCode, sysCarMessage.getModelCode());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(sysCarMessage.getMessageType())){
|
||||||
|
queryWrapper.eq(SysCarMessage::getMessageType, sysCarMessage.getMessageType());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一 判断
|
||||||
|
* @param sysCarMessage 车辆报文记录
|
||||||
|
* @return 车辆报文记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean checkIdUnique(SysCarMessage sysCarMessage) {
|
||||||
|
LambdaQueryWrapper<SysCarMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(SysCarMessage::getId, sysCarMessage.getId());
|
||||||
|
return this.count(queryWrapper) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.muyu.car.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.car.mapper.SysCarMapper;
|
||||||
|
import com.muyu.car.domain.SysCar;
|
||||||
|
import com.muyu.car.service.ISysCarService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆基础信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysCarServiceImpl
|
||||||
|
extends ServiceImpl<SysCarMapper, SysCar>
|
||||||
|
implements ISysCarService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询车辆基础信息
|
||||||
|
*
|
||||||
|
* @param id 车辆基础信息主键
|
||||||
|
* @return 车辆基础信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysCar selectSysCarById(Long id)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<SysCar> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(id, "id不可为空");
|
||||||
|
queryWrapper.eq(SysCar::getId, id);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆基础信息列表
|
||||||
|
*
|
||||||
|
* @param sysCar 车辆基础信息
|
||||||
|
* @return 车辆基础信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysCar> selectSysCarList(SysCar sysCar)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<SysCar> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(sysCar.getCarVin())){
|
||||||
|
queryWrapper.eq(SysCar::getCarVin, sysCar.getCarVin());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(sysCar.getCarPlate())){
|
||||||
|
queryWrapper.eq(SysCar::getCarPlate, sysCar.getCarPlate());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(sysCar.getCarBrand())){
|
||||||
|
queryWrapper.eq(SysCar::getCarBrand, sysCar.getCarBrand());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(sysCar.getCarModel())){
|
||||||
|
queryWrapper.eq(SysCar::getCarModel, sysCar.getCarModel());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(sysCar.getCarType())){
|
||||||
|
queryWrapper.eq(SysCar::getCarType, sysCar.getCarType());
|
||||||
|
}
|
||||||
|
if (sysCar.getCarLastJoinTime()!= null){
|
||||||
|
queryWrapper.eq(SysCar::getCarLastJoinTime, sysCar.getCarLastJoinTime());
|
||||||
|
}
|
||||||
|
if (sysCar.getCarLastOfflineTime()!= null){
|
||||||
|
queryWrapper.eq(SysCar::getCarLastOfflineTime, sysCar.getCarLastOfflineTime());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(sysCar.getState())){
|
||||||
|
queryWrapper.eq(SysCar::getState, sysCar.getState());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一 判断
|
||||||
|
* @param sysCar 车辆基础信息
|
||||||
|
* @return 车辆基础信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean checkIdUnique(SysCar sysCar) {
|
||||||
|
LambdaQueryWrapper<SysCar> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(SysCar::getId, sysCar.getId());
|
||||||
|
return this.count(queryWrapper) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.muyu.car.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.car.domain.SysMessageType;
|
||||||
|
import com.muyu.car.mapper.SysMessageTypeMapper;
|
||||||
|
import com.muyu.car.service.ISysMessageTypeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆报文类型Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-18
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysMessageTypeServiceImpl
|
||||||
|
extends ServiceImpl<SysMessageTypeMapper, SysMessageType>
|
||||||
|
implements ISysMessageTypeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询车辆报文类型
|
||||||
|
*
|
||||||
|
* @param id 车辆报文类型主键
|
||||||
|
* @return 车辆报文类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysMessageType selectSysMessageTypeByMessageCode(String messageCode)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<SysMessageType> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(messageCode, "messageCode不可为空");
|
||||||
|
queryWrapper.eq(SysMessageType::getMessageCode, messageCode);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆报文类型列表
|
||||||
|
*
|
||||||
|
* @param sysMessageType 车辆报文类型
|
||||||
|
* @return 车辆报文类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysMessageType> selectSysMessageTypeList(SysMessageType sysMessageType)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<SysMessageType> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(sysMessageType.getMessageName())){
|
||||||
|
queryWrapper.like(SysMessageType::getMessageName, sysMessageType.getMessageName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(sysMessageType.getMessageType())){
|
||||||
|
queryWrapper.eq(SysMessageType::getMessageType, sysMessageType.getMessageType());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一 判断
|
||||||
|
* @param sysMessageType 车辆报文类型
|
||||||
|
* @return 车辆报文类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean checkIdUnique(SysMessageType sysMessageType) {
|
||||||
|
LambdaQueryWrapper<SysMessageType> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(SysMessageType::getId, sysMessageType.getId());
|
||||||
|
return this.count(queryWrapper) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.muyu.car.util;
|
||||||
|
|
||||||
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
|
import org.bouncycastle.openssl.PEMKeyPair;
|
||||||
|
import org.bouncycastle.openssl.PEMParser;
|
||||||
|
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
|
||||||
|
|
||||||
|
import javax.net.ssl.KeyManagerFactory;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
import javax.net.ssl.TrustManagerFactory;
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.security.KeyStore;
|
||||||
|
import java.security.Security;
|
||||||
|
import java.security.cert.CertificateFactory;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
|
||||||
|
public class SSLUtils {
|
||||||
|
public static SSLSocketFactory getSocketFactory(final String caCrtFile,
|
||||||
|
final String crtFile, final String keyFile, final String password)
|
||||||
|
throws Exception {
|
||||||
|
Security.addProvider(new BouncyCastleProvider());
|
||||||
|
|
||||||
|
// load CA certificate
|
||||||
|
X509Certificate caCert = null;
|
||||||
|
|
||||||
|
FileInputStream fis = new FileInputStream(caCrtFile);
|
||||||
|
BufferedInputStream bis = new BufferedInputStream(fis);
|
||||||
|
CertificateFactory cf = CertificateFactory.getInstance("X.509");
|
||||||
|
|
||||||
|
while (bis.available() > 0) {
|
||||||
|
caCert = (X509Certificate) cf.generateCertificate(bis);
|
||||||
|
}
|
||||||
|
|
||||||
|
// load client certificate
|
||||||
|
bis = new BufferedInputStream(new FileInputStream(crtFile));
|
||||||
|
X509Certificate cert = null;
|
||||||
|
while (bis.available() > 0) {
|
||||||
|
cert = (X509Certificate) cf.generateCertificate(bis);
|
||||||
|
}
|
||||||
|
|
||||||
|
// load client private key
|
||||||
|
PEMParser pemParser = new PEMParser(new FileReader(keyFile));
|
||||||
|
Object object = pemParser.readObject();
|
||||||
|
JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider("BC");
|
||||||
|
KeyPair key = converter.getKeyPair((PEMKeyPair) object);
|
||||||
|
pemParser.close();
|
||||||
|
|
||||||
|
// CA certificate is used to authenticate server
|
||||||
|
KeyStore caKs = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
|
caKs.load(null, null);
|
||||||
|
caKs.setCertificateEntry("ca-certificate", caCert);
|
||||||
|
TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509");
|
||||||
|
tmf.init(caKs);
|
||||||
|
|
||||||
|
// client key and certificates are sent to server so it can authenticate
|
||||||
|
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
|
ks.load(null, null);
|
||||||
|
ks.setCertificateEntry("certificate", cert);
|
||||||
|
ks.setKeyEntry("private-key", key.getPrivate(), password.toCharArray(),
|
||||||
|
new java.security.cert.Certificate[]{cert});
|
||||||
|
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory
|
||||||
|
.getDefaultAlgorithm());
|
||||||
|
kmf.init(ks, password.toCharArray());
|
||||||
|
|
||||||
|
// finally, create SSL socket factory
|
||||||
|
SSLContext context = SSLContext.getInstance("TLSv1.2");
|
||||||
|
context.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
|
||||||
|
|
||||||
|
return context.getSocketFactory();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,61 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 10010
|
||||||
|
|
||||||
|
# nacos线上地址
|
||||||
|
nacos:
|
||||||
|
addr: 49.235.136.60:8848
|
||||||
|
user-name: nacos
|
||||||
|
password: nacos
|
||||||
|
namespace: wyh
|
||||||
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
amqp:
|
||||||
|
deserialization:
|
||||||
|
trust:
|
||||||
|
all: true
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: cloud-car
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: ${nacos.addr}
|
||||||
|
# # nacos用户名
|
||||||
|
# username: ${nacos.user-name}
|
||||||
|
# # nacos密码
|
||||||
|
# password: ${nacos.password}
|
||||||
|
# 命名空间
|
||||||
|
namespace: ${nacos.namespace}
|
||||||
|
config:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: ${nacos.addr}
|
||||||
|
# # nacos用户名
|
||||||
|
# username: ${nacos.user-name}
|
||||||
|
# # nacos密码
|
||||||
|
# password: ${nacos.password}
|
||||||
|
# 命名空间
|
||||||
|
namespace: ${nacos.namespace}
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
# 系统共享配置
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
# 系统环境Config共享配置
|
||||||
|
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
# xxl-job 配置文件
|
||||||
|
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
# rabbit 配置文件
|
||||||
|
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.muyu.system.mapper: DEBUG
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/cloud-system"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/cloud-system"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.sky.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||||
|
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
|
<Pattern>${log.sky.pattern}</Pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="GRPC_LOG"/>
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/cloud-system"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.sky.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||||
|
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
|
<Pattern>${log.sky.pattern}</Pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="GRPC_LOG"/>
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?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.car.mapper.SysCarMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysCar" id="SysCarResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="carVin" column="car_vin" />
|
||||||
|
<result property="carPlate" column="car_plate" />
|
||||||
|
<result property="carBrand" column="car_brand" />
|
||||||
|
<result property="carModel" column="car_model" />
|
||||||
|
<result property="carType" column="car_type" />
|
||||||
|
<result property="carLastJoinTime" column="car_last_join_time" />
|
||||||
|
<result property="carLastOfflineTime" column="car_last_offline_time" />
|
||||||
|
<result property="state" column="state" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSysCarVo">
|
||||||
|
select id, car_vin, car_plate, car_brand, car_model, car_type, car_last_join_time, car_last_offline_time, state, create_by, create_time, update_by, update_time, remark from sys_car
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSysCarList" parameterType="SysCar" resultMap="SysCarResult">
|
||||||
|
<include refid="selectSysCarVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="carVin != null and carVin != ''"> and car_vin = #{carVin}</if>
|
||||||
|
<if test="carPlate != null and carPlate != ''"> and car_plate = #{carPlate}</if>
|
||||||
|
<if test="carBrand != null and carBrand != ''"> and car_brand = #{carBrand}</if>
|
||||||
|
<if test="carModel != null and carModel != ''"> and car_model = #{carModel}</if>
|
||||||
|
<if test="carType != null and carType != ''"> and car_type = #{carType}</if>
|
||||||
|
<if test="carLastJoinTime != null "> and car_last_join_time = #{carLastJoinTime}</if>
|
||||||
|
<if test="carLastOfflineTime != null "> and car_last_offline_time = #{carLastOfflineTime}</if>
|
||||||
|
<if test="state != null and state != ''"> and state = #{state}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSysCarById" parameterType="Long" resultMap="SysCarResult">
|
||||||
|
<include refid="selectSysCarVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSysCar" parameterType="SysCar" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_car
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="carVin != null and carVin != ''">car_vin,</if>
|
||||||
|
<if test="carPlate != null and carPlate != ''">car_plate,</if>
|
||||||
|
<if test="carBrand != null">car_brand,</if>
|
||||||
|
<if test="carModel != null">car_model,</if>
|
||||||
|
<if test="carType != null">car_type,</if>
|
||||||
|
<if test="carLastJoinTime != null">car_last_join_time,</if>
|
||||||
|
<if test="carLastOfflineTime != null">car_last_offline_time,</if>
|
||||||
|
<if test="state != null">state,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="carVin != null and carVin != ''">#{carVin},</if>
|
||||||
|
<if test="carPlate != null and carPlate != ''">#{carPlate},</if>
|
||||||
|
<if test="carBrand != null">#{carBrand},</if>
|
||||||
|
<if test="carModel != null">#{carModel},</if>
|
||||||
|
<if test="carType != null">#{carType},</if>
|
||||||
|
<if test="carLastJoinTime != null">#{carLastJoinTime},</if>
|
||||||
|
<if test="carLastOfflineTime != null">#{carLastOfflineTime},</if>
|
||||||
|
<if test="state != null">#{state},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSysCar" parameterType="SysCar">
|
||||||
|
update sys_car
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="carVin != null and carVin != ''">car_vin = #{carVin},</if>
|
||||||
|
<if test="carPlate != null and carPlate != ''">car_plate = #{carPlate},</if>
|
||||||
|
<if test="carBrand != null">car_brand = #{carBrand},</if>
|
||||||
|
<if test="carModel != null">car_model = #{carModel},</if>
|
||||||
|
<if test="carType != null">car_type = #{carType},</if>
|
||||||
|
<if test="carLastJoinTime != null">car_last_join_time = #{carLastJoinTime},</if>
|
||||||
|
<if test="carLastOfflineTime != null">car_last_offline_time = #{carLastOfflineTime},</if>
|
||||||
|
<if test="state != null">state = #{state},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSysCarById" parameterType="Long">
|
||||||
|
delete from sys_car where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSysCarByIds" parameterType="String">
|
||||||
|
delete from sys_car where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?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.car.mapper.SysCarMessageMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysCarMessage" id="SysCarMessageResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="modelCode" column="model_code" />
|
||||||
|
<result property="messageTypeCode" column="message_type_code" />
|
||||||
|
<result property="messageStartIndex" column="message_start_index" />
|
||||||
|
<result property="messageEndIndex" column="message_end_index" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSysCarMessageVo">
|
||||||
|
select id, model_code, message_type_code, message_start_index, message_end_index from sys_car_message
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSysCarMessageList" parameterType="SysCarMessage" resultMap="SysCarMessageResult">
|
||||||
|
<include refid="selectSysCarMessageVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="modelCode != null and modelCode != ''"> and model_code = #{modelCode}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSysCarMessageById" parameterType="Long" resultMap="SysCarMessageResult">
|
||||||
|
<include refid="selectSysCarMessageVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
<select id="dobList" resultType="com.muyu.car.domain.VO.SysMessageVO">
|
||||||
|
SELECT sys_car_message.*,sys_message_type.message_name FROM sys_car_message LEFT JOIN sys_message_type ON sys_message_type.message_code=sys_car_message.message_type_code
|
||||||
|
<where>
|
||||||
|
<if test="modelCode!=null and modelCode!=''">
|
||||||
|
sys_car_message.model_code=#{modelCode}
|
||||||
|
</if>
|
||||||
|
<if test="messageType!=null and messageType!=''">
|
||||||
|
sys_car_message.message_type=#{messageType}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSysCarMessage" parameterType="SysCarMessage" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_car_message
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="modelCode != null">model_code,</if>
|
||||||
|
<if test="messageTypeCode != null">message_type_code,</if>
|
||||||
|
<if test="messageStartIndex != null">message_start_index,</if>
|
||||||
|
<if test="messageEndIndex != null">message_end_index,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="modelCode != null">#{modelCode},</if>
|
||||||
|
<if test="messageTypeCode != null">#{messageTypeCode},</if>
|
||||||
|
<if test="messageStartIndex != null">#{messageStartIndex},</if>
|
||||||
|
<if test="messageEndIndex != null">#{messageEndIndex},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSysCarMessage" parameterType="SysCarMessage">
|
||||||
|
update sys_car_message
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="modelCode != null">model_code = #{modelCode},</if>
|
||||||
|
<if test="messageTypeCode != null">message_type_code = #{messageTypeCode},</if>
|
||||||
|
<if test="messageStartIndex != null">message_start_index = #{messageStartIndex},</if>
|
||||||
|
<if test="messageEndIndex != null">message_end_index = #{messageEndIndex},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSysCarMessageById" parameterType="Long">
|
||||||
|
delete from sys_car_message where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSysCarMessageByIds" parameterType="String">
|
||||||
|
delete from sys_car_message where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?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.car.mapper.SysMessageTypeMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysMessageType" id="SysMessageTypeResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="messageCode" column="message_code" />
|
||||||
|
<result property="messageName" column="message_name" />
|
||||||
|
<result property="messageType" column="message_type" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSysMessageTypeVo">
|
||||||
|
select id, message_code, message_name, message_type from sys_message_type
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSysMessageTypeList" parameterType="SysMessageType" resultMap="SysMessageTypeResult">
|
||||||
|
<include refid="selectSysMessageTypeVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="messageName != null and messageName != ''"> and message_name like concat('%', #{messageName}, '%')</if>
|
||||||
|
<if test="messageType != null and messageType != ''"> and message_type = #{messageType}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSysMessageTypeById" parameterType="Long" resultMap="SysMessageTypeResult">
|
||||||
|
<include refid="selectSysMessageTypeVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSysMessageType" parameterType="SysMessageType" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_message_type
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="messageCode != null">message_code,</if>
|
||||||
|
<if test="messageName != null">message_name,</if>
|
||||||
|
<if test="messageType != null">message_type,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="messageCode != null">#{messageCode},</if>
|
||||||
|
<if test="messageName != null">#{messageName},</if>
|
||||||
|
<if test="messageType != null">#{messageType},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSysMessageType" parameterType="SysMessageType">
|
||||||
|
update sys_message_type
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="messageCode != null">message_code = #{messageCode},</if>
|
||||||
|
<if test="messageName != null">message_name = #{messageName},</if>
|
||||||
|
<if test="messageType != null">message_type = #{messageType},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSysMessageTypeById" parameterType="Long">
|
||||||
|
delete from sys_message_type where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSysMessageTypeByIds" parameterType="String">
|
||||||
|
delete from sys_message_type where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.system.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户和岗位关联 sys_user_post
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SysUserPost {
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位ID
|
||||||
|
*/
|
||||||
|
private Long postId;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.system.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户和角色关联 sys_user_role
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SysUserRole {
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色ID
|
||||||
|
*/
|
||||||
|
private Long roleId;
|
||||||
|
}
|
|
@ -17,6 +17,7 @@
|
||||||
<module>cloud-modules-car</module>
|
<module>cloud-modules-car</module>
|
||||||
<module>cloud-modules-rail</module>
|
<module>cloud-modules-rail</module>
|
||||||
<module>cloud-modules-warn</module>
|
<module>cloud-modules-warn</module>
|
||||||
|
<module>cloud-modules-carmanage</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>cloud-modules</artifactId>
|
<artifactId>cloud-modules</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue