Merge remote-tracking branch 'origin/dev.business' into dev
# Conflicts: # cloud-common/cloud-common-kafka/pom.xml # cloud-modules/cloud-modules-template/src/main/java/com/muyu/template/config/MqttConfigure.java # cloud-modules/saas/saas-server/src/main/java/com/muyu/server/controller/SysCarController.javadev.vehiclegateway
commit
c1f24c8d03
|
@ -14,6 +14,8 @@ import com.muyu.common.security.auth.AuthUtil;
|
||||||
import com.muyu.common.security.service.TokenService;
|
import com.muyu.common.security.service.TokenService;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
@ -38,6 +40,7 @@ import java.sql.Statement;
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RestController
|
@RestController
|
||||||
|
@Tag(name = "auth",description = "auth")
|
||||||
public class TokenController {
|
public class TokenController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private TokenService tokenService;
|
private TokenService tokenService;
|
||||||
|
@ -49,6 +52,7 @@ public class TokenController {
|
||||||
private SysFirmService sysFirmService;
|
private SysFirmService sysFirmService;
|
||||||
|
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
|
@Operation(summary = "登录", description = "登录")
|
||||||
public Result<?> login (@RequestBody LoginBody form) {
|
public Result<?> login (@RequestBody LoginBody form) {
|
||||||
//查询企业是否存在
|
//查询企业是否存在
|
||||||
Firm firm = sysFirmService.findFirmByName(form.getFirmName());
|
Firm firm = sysFirmService.findFirmByName(form.getFirmName());
|
||||||
|
@ -62,6 +66,7 @@ public class TokenController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("logout")
|
@DeleteMapping("logout")
|
||||||
|
@Operation(summary = "退出", description = "退出")
|
||||||
public Result<?> logout (HttpServletRequest request) {
|
public Result<?> logout (HttpServletRequest request) {
|
||||||
String token = SecurityUtils.getToken(request);
|
String token = SecurityUtils.getToken(request);
|
||||||
if (StringUtils.isNotEmpty(token)) {
|
if (StringUtils.isNotEmpty(token)) {
|
||||||
|
@ -75,6 +80,7 @@ public class TokenController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("refresh")
|
@PostMapping("refresh")
|
||||||
|
@Operation(summary = "刷新token", description = "刷新token")
|
||||||
public Result<?> refresh (HttpServletRequest request) {
|
public Result<?> refresh (HttpServletRequest request) {
|
||||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
if (StringUtils.isNotNull(loginUser)) {
|
if (StringUtils.isNotNull(loginUser)) {
|
||||||
|
@ -86,6 +92,7 @@ public class TokenController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("register")
|
@PostMapping("register")
|
||||||
|
@Operation(summary = "注册用户", description = "注册用户")
|
||||||
public Result<?> register (@RequestBody RegisterBody registerBody) {
|
public Result<?> register (@RequestBody RegisterBody registerBody) {
|
||||||
// 用户注册
|
// 用户注册
|
||||||
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
|
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
|
||||||
|
@ -98,6 +105,7 @@ public class TokenController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/enterprise")
|
@PostMapping("/enterprise")
|
||||||
|
@Operation(summary = "企业入驻", description = "企业入驻")
|
||||||
public Result<?> enterprise( @RequestBody EnterpriseSettlement settlement){
|
public Result<?> enterprise( @RequestBody EnterpriseSettlement settlement){
|
||||||
|
|
||||||
String createDatabaseUrl="jdbc:mysql://"+ DatasourceContent.IP+":"+DatasourceContent.PORT+"?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
|
String createDatabaseUrl="jdbc:mysql://"+ DatasourceContent.IP+":"+DatasourceContent.PORT+"?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.muyu.auth.service;
|
package com.muyu.auth.service;
|
||||||
|
|
||||||
import com.muyu.auth.form.EnterpriseSettlement;
|
|
||||||
import com.muyu.common.core.constant.CacheConstants;
|
import com.muyu.common.core.constant.CacheConstants;
|
||||||
import com.muyu.common.core.constant.Constants;
|
import com.muyu.common.core.constant.Constants;
|
||||||
import com.muyu.common.core.constant.SecurityConstants;
|
import com.muyu.common.core.constant.SecurityConstants;
|
||||||
|
@ -13,7 +13,7 @@ import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.common.core.utils.ip.IpUtils;
|
import com.muyu.common.core.utils.ip.IpUtils;
|
||||||
import com.muyu.common.redis.service.RedisService;
|
import com.muyu.common.redis.service.RedisService;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.Enterprise;
|
import com.muyu.common.system.domain.Business;
|
||||||
import com.muyu.common.system.remote.RemoteUserService;
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
@ -144,7 +144,7 @@ public class SysLoginService {
|
||||||
if (fileName.length() < UserConstants.Firm_NAME_MIN_LENGTH || fileName.length() > UserConstants.Firm_NAME_MAX_LENGTH) {
|
if (fileName.length() < UserConstants.Firm_NAME_MIN_LENGTH || fileName.length() > UserConstants.Firm_NAME_MAX_LENGTH) {
|
||||||
throw new ServiceException("企业名称长度必须在2到20个字符之间");
|
throw new ServiceException("企业名称长度必须在2到20个字符之间");
|
||||||
}
|
}
|
||||||
Enterprise settlement = new Enterprise();
|
Business settlement = new Business();
|
||||||
settlement.setDatabaseName(databaseName);
|
settlement.setDatabaseName(databaseName);
|
||||||
settlement.setFirmName(fileName);
|
settlement.setFirmName(fileName);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: DongZeLiang
|
* 多数据源
|
||||||
|
* @author liuwu
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: 多数据源
|
* @Description: 多数据源
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package com.muyu.cloud.common.many.datasource.constents;
|
package com.muyu.cloud.common.many.datasource.constents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author DongZl
|
* 数据源常量
|
||||||
|
* @author liuwu
|
||||||
* @description: 数据源常量
|
* @description: 数据源常量
|
||||||
* @Date 2023-8-1 上午 11:02
|
* @Date 2023-8-1 上午 11:02
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,7 +8,8 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author DongZl
|
* 数据源实体类
|
||||||
|
* @author liuwu
|
||||||
* @description: 数据源实体类
|
* @description: 数据源实体类
|
||||||
* @Date 2023-8-1 上午 11:15
|
* @Date 2023-8-1 上午 11:15
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,7 +8,8 @@ import org.springframework.stereotype.Component;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: DongZeLiang
|
* Druid工厂
|
||||||
|
* @author liuwu
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: Druid工厂
|
* @Description: Druid工厂
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.springframework.util.Assert;
|
||||||
/**
|
/**
|
||||||
* 数据源切换处理
|
* 数据源切换处理
|
||||||
*
|
*
|
||||||
* @author Dongzl
|
* @author liuwu
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DynamicDataSourceHolder {
|
public class DynamicDataSourceHolder {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package com.muyu.cloud.common.saas.contents;
|
package com.muyu.cloud.common.saas.contents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: DongZeLiang
|
* SAAS常量
|
||||||
|
* @author liuwu
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: SAAS常量
|
* @Description: SAAS常量
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
|
|
@ -6,7 +6,7 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: DongZeLiang
|
* @Author: liuwu
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: 企业信息
|
* @Description: 企业信息
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
|
|
@ -4,7 +4,8 @@ package com.muyu.cloud.common.saas.exception;
|
||||||
import com.muyu.common.core.exception.ServiceException;
|
import com.muyu.common.core.exception.ServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: DongZeLiang
|
* SaaS异常类
|
||||||
|
* @author liuwu
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: SaaS异常类
|
* @Description: SaaS异常类
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
|
|
@ -14,7 +14,8 @@ import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: DongZeLiang
|
* SAAS拦截器
|
||||||
|
* @author liuwu
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: SAAS拦截器
|
* @Description: SAAS拦截器
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
com.muyu.cloud.common.saas.interceptor.WebMvcSaaSConfig
|
|
||||||
com.muyu.cloud.common.many.datasource.ManyDataSource
|
|
||||||
com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory
|
|
|
@ -21,7 +21,7 @@ import lombok.experimental.SuperBuilder;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class Enterprise extends BaseEntity {
|
public class Business extends BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -3,9 +3,7 @@ package com.muyu.common.system.remote;
|
||||||
import com.muyu.common.core.constant.SecurityConstants;
|
import com.muyu.common.core.constant.SecurityConstants;
|
||||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.system.domain.Business;
|
||||||
import com.muyu.common.system.domain.Enterprise;
|
|
||||||
import com.muyu.common.system.domain.SysFirmUser;
|
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
@ -53,5 +51,5 @@ public interface RemoteUserService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/user/enterprise")
|
@PostMapping("/user/enterprise")
|
||||||
Result<Boolean>settlementEnterpriseInfo(@RequestBody Enterprise enterprise, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
Result<Boolean>settlementEnterpriseInfo(@RequestBody Business enterprise, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package com.muyu.common.system.remote.factory;
|
package com.muyu.common.system.remote.factory;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.system.domain.Business;
|
||||||
import com.muyu.common.system.domain.Enterprise;
|
|
||||||
import com.muyu.common.system.domain.SysFirmUser;
|
|
||||||
import com.muyu.common.system.remote.RemoteUserService;
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
@ -43,7 +41,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<Boolean> settlementEnterpriseInfo(Enterprise enterprise, String source) {
|
public Result<Boolean> settlementEnterpriseInfo(Business enterprise, String source) {
|
||||||
return Result.error("入驻企业失败");
|
return Result.error("入驻企业失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class SysUserController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@InnerAuth
|
@InnerAuth
|
||||||
@PostMapping("/enterprise")
|
@PostMapping("/enterprise")
|
||||||
public Result<Boolean> enterprise (@RequestBody Enterprise enterprise){
|
public Result<Boolean> enterprise (@RequestBody Business enterprise){
|
||||||
|
|
||||||
return Result.success(userService.enterprise(enterprise));
|
return Result.success(userService.enterprise(enterprise));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.muyu.system.mapper;
|
package com.muyu.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.common.system.domain.Enterprise;
|
import com.muyu.common.system.domain.Business;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@ -72,14 +72,14 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||||
* @param enterprise
|
* @param enterprise
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int enterprise(Enterprise enterprise);
|
int enterprise(Business enterprise);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业管理添加
|
* 企业管理添加
|
||||||
* @param enterprise
|
* @param enterprise
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int enterPriseAdd(Enterprise enterprise);
|
int enterPriseAdd(Business enterprise);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户信息
|
* 修改用户信息
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.muyu.system.service;
|
package com.muyu.system.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.common.system.domain.Enterprise;
|
import com.muyu.common.system.domain.Business;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -134,7 +134,7 @@ public interface SysUserService extends IService<SysUser> {
|
||||||
*/
|
*/
|
||||||
boolean registerUser(SysUser user);
|
boolean registerUser(SysUser user);
|
||||||
|
|
||||||
boolean enterprise(Enterprise enterprise);
|
boolean enterprise(Business enterprise);
|
||||||
/**
|
/**
|
||||||
* 修改用户信息
|
* 修改用户信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.common.core.utils.bean.BeanValidators;
|
import com.muyu.common.core.utils.bean.BeanValidators;
|
||||||
import com.muyu.common.datascope.annotation.DataScope;
|
import com.muyu.common.datascope.annotation.DataScope;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.Enterprise;
|
import com.muyu.common.system.domain.Business;
|
||||||
import com.muyu.common.system.domain.SysRole;
|
import com.muyu.common.system.domain.SysRole;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.system.domain.SysPost;
|
import com.muyu.system.domain.SysPost;
|
||||||
|
@ -264,7 +264,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean enterprise(Enterprise enterprise){
|
public boolean enterprise(Business enterprise){
|
||||||
userMapper.enterPriseAdd(enterprise);
|
userMapper.enterPriseAdd(enterprise);
|
||||||
return userMapper.enterprise(enterprise) > 0;
|
return userMapper.enterprise(enterprise) > 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,11 @@
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-saas</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package com.muyu.server.controller;
|
package com.muyu.server.controller;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.muyu.cloud.common.many.datasource.constents.DatasourceContent;
|
||||||
|
import com.muyu.common.core.constant.SecurityConstants;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.domain.Enterprise;
|
import com.muyu.common.domain.Enterprise;
|
||||||
|
import com.muyu.common.system.domain.Business;
|
||||||
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import com.muyu.common.util.PageUtils;
|
import com.muyu.common.util.PageUtils;
|
||||||
import com.muyu.server.controller.form.DeleteEnterpriseByIds;
|
import com.muyu.server.controller.form.DeleteEnterpriseByIds;
|
||||||
import com.muyu.server.controller.form.InsertEnterprise;
|
import com.muyu.server.controller.form.InsertEnterprise;
|
||||||
|
@ -14,8 +18,15 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.core.io.support.EncodedResource;
|
||||||
|
import org.springframework.jdbc.datasource.init.ScriptUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -35,6 +46,9 @@ public class EnterpriseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private EnterpriseService enterpriseService;
|
private EnterpriseService enterpriseService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询分页企业信息
|
* 查询分页企业信息
|
||||||
|
@ -72,6 +86,48 @@ public class EnterpriseController {
|
||||||
enterprise.setEnterpriseFenceCount(form.getEnterpriseFenceCount());
|
enterprise.setEnterpriseFenceCount(form.getEnterpriseFenceCount());
|
||||||
|
|
||||||
int rows = enterpriseService.insert(enterprise);
|
int rows = enterpriseService.insert(enterprise);
|
||||||
|
if (rows == 0){
|
||||||
|
return Result.error("新增失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
Business business = new Business();
|
||||||
|
business.setFirmName(form.getEnterpriseName());
|
||||||
|
business.setDatabaseName(form.getEnterpriseDatabaseName());
|
||||||
|
remoteUserService.settlementEnterpriseInfo(business, SecurityConstants.INNER);
|
||||||
|
|
||||||
|
String createDatabaseUrl="jdbc:mysql://"+ DatasourceContent.IP+":"+DatasourceContent.PORT+"?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
|
||||||
|
String createDatabaseSql = "CREATE DATABASE IF NOT EXISTS " + form.getEnterpriseDatabaseName() + ";";
|
||||||
|
try (Connection adminConn = DriverManager.getConnection(createDatabaseUrl, DatasourceContent.USER_NAME, DatasourceContent.PASSWORD);
|
||||||
|
Statement stmt = adminConn.createStatement()) {
|
||||||
|
|
||||||
|
boolean success = stmt.execute(createDatabaseSql);
|
||||||
|
if (success) {
|
||||||
|
log.info("数据库 {} 创建失败", form.getEnterpriseDatabaseName());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
log.warn("数据库 {} 创建成功", form.getEnterpriseDatabaseName());
|
||||||
|
|
||||||
|
// 切换到新的数据库连接
|
||||||
|
Connection connection = null;
|
||||||
|
try {
|
||||||
|
String url = "jdbc:mysql://47.101.53.251:3306/" + form.getEnterpriseDatabaseName() + "?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
|
||||||
|
String user = "root";
|
||||||
|
String pwd = "Lw030106";
|
||||||
|
String driverClassName = "com.mysql.cj.jdbc.Driver";
|
||||||
|
Class.forName(driverClassName);
|
||||||
|
connection = DriverManager.getConnection(url, user, pwd);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
ClassPathResource rc = new ClassPathResource("static/saas.sql");
|
||||||
|
EncodedResource er = new EncodedResource(rc, "utf-8");
|
||||||
|
ScriptUtils.executeSqlScript(connection, er);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("连接数据库时发生错误或创建数据库失败", e);
|
||||||
|
}
|
||||||
return Result.success(rows);
|
return Result.success(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class SysCarFaultController extends BaseController
|
||||||
@Validated @RequestBody SysCarFault sysCarFault)
|
@Validated @RequestBody SysCarFault sysCarFault)
|
||||||
{
|
{
|
||||||
//判断故障码是否重复
|
//判断故障码是否重复
|
||||||
SysCarFault selectFaultByFaultCode = sysCarFaultService.selectFaultByFaultCode(sysCarFault.getFaultCode());
|
List<SysCarFault> selectFaultByFaultCode = sysCarFaultService.selectFaultByFaultCode(sysCarFault.getFaultCode());
|
||||||
if (selectFaultByFaultCode!=null){
|
if (selectFaultByFaultCode!=null){
|
||||||
return error("新增车辆故障 ,故障码已存在");
|
return error("新增车辆故障 ,故障码已存在");
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@ import javax.annotation.Resource;
|
||||||
import com.muyu.common.domain.WarnStrategy;
|
import com.muyu.common.domain.WarnStrategy;
|
||||||
import com.muyu.common.domain.req.WarnStrategyReq;
|
import com.muyu.common.domain.req.WarnStrategyReq;
|
||||||
import com.muyu.server.service.WarnStrategyService;
|
import com.muyu.server.service.WarnStrategyService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
@ -23,6 +26,8 @@ import com.muyu.common.core.domain.Result;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/strategy")
|
@RequestMapping("/strategy")
|
||||||
|
@Log4j2
|
||||||
|
@Tag(name = "预警策略管理",description = "预警策略管理")
|
||||||
public class WarnStrategyController extends BaseController
|
public class WarnStrategyController extends BaseController
|
||||||
{
|
{
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -32,6 +37,7 @@ public class WarnStrategyController extends BaseController
|
||||||
* 查询预警策略列表
|
* 查询预警策略列表
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectWarnStrategyList")
|
@PostMapping("/selectWarnStrategyList")
|
||||||
|
@Operation(summary = "预警策略列表",description = "预警策略列表")
|
||||||
public Result selectWarnStrategyList(@RequestBody WarnStrategyReq warnStrategyReq)
|
public Result selectWarnStrategyList(@RequestBody WarnStrategyReq warnStrategyReq)
|
||||||
{
|
{
|
||||||
return Result.success(warnStrategyService.selectWarnStrategyList(warnStrategyReq));
|
return Result.success(warnStrategyService.selectWarnStrategyList(warnStrategyReq));
|
||||||
|
@ -42,6 +48,7 @@ public class WarnStrategyController extends BaseController
|
||||||
* 获取预警策略详细信息
|
* 获取预警策略详细信息
|
||||||
*/
|
*/
|
||||||
@GetMapping( "selectById/{id}")
|
@GetMapping( "selectById/{id}")
|
||||||
|
@Operation(summary = "预警策略详细信息",description = "预警策略详细信息")
|
||||||
public Result selectById(@PathVariable("id") Long id)
|
public Result selectById(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
return success(warnStrategyService.selectWarnStrategyById(id));
|
return success(warnStrategyService.selectWarnStrategyById(id));
|
||||||
|
@ -51,6 +58,7 @@ public class WarnStrategyController extends BaseController
|
||||||
* 新增预警策略
|
* 新增预警策略
|
||||||
*/
|
*/
|
||||||
@PostMapping("/addWarnStrategy")
|
@PostMapping("/addWarnStrategy")
|
||||||
|
@Operation(summary = "预警策略添加",description = "预警策略添加")
|
||||||
public Result addWarnStrategy(@RequestBody WarnStrategy warnStrategy)
|
public Result addWarnStrategy(@RequestBody WarnStrategy warnStrategy)
|
||||||
{
|
{
|
||||||
Integer i = warnStrategyService.addWarnStrategy(warnStrategy);
|
Integer i = warnStrategyService.addWarnStrategy(warnStrategy);
|
||||||
|
@ -61,6 +69,7 @@ public class WarnStrategyController extends BaseController
|
||||||
* 修改预警策略
|
* 修改预警策略
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updWarnStrategy")
|
@PostMapping("/updWarnStrategy")
|
||||||
|
@Operation(summary = "预警策略修改",description = "预警策略修改")
|
||||||
public Result updWarnStrategy(@RequestBody WarnStrategy warnStrategy)
|
public Result updWarnStrategy(@RequestBody WarnStrategy warnStrategy)
|
||||||
{
|
{
|
||||||
Integer i = warnStrategyService.updWarnStrategy(warnStrategy);
|
Integer i = warnStrategyService.updWarnStrategy(warnStrategy);
|
||||||
|
@ -71,6 +80,7 @@ public class WarnStrategyController extends BaseController
|
||||||
* 删除预警策略
|
* 删除预警策略
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("deleteWarnStrategy/{id}")
|
@DeleteMapping("deleteWarnStrategy/{id}")
|
||||||
|
@Operation(summary = "预警策略删除",description = "预警策略删除")
|
||||||
public Result deleteWarnStrategy(@PathVariable("id") Long id)
|
public Result deleteWarnStrategy(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
Integer i = warnStrategyService.deleteWarnStrategy(id);
|
Integer i = warnStrategyService.deleteWarnStrategy(id);
|
||||||
|
@ -83,6 +93,7 @@ public class WarnStrategyController extends BaseController
|
||||||
* 根据车辆类型ID查询策略
|
* 根据车辆类型ID查询策略
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectListByCarType/{carTypeId}")
|
@GetMapping("/selectListByCarType/{carTypeId}")
|
||||||
|
@Operation(summary = "根据车辆类型ID查询策略",description = "根据车辆类型ID查询策略")
|
||||||
public Result selectListByCarType(@PathVariable("carTypeId") Long carTypeId) {
|
public Result selectListByCarType(@PathVariable("carTypeId") Long carTypeId) {
|
||||||
return Result.success(warnStrategyService.selectListByCarType(carTypeId));
|
return Result.success(warnStrategyService.selectListByCarType(carTypeId));
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,11 @@ import java.util.Map;
|
||||||
* 企业信息Mapper接口
|
* 企业信息Mapper接口
|
||||||
* @author yupnig
|
* @author yupnig
|
||||||
* @package com.muyu.server.mapper
|
* @package com.muyu.server.mapper
|
||||||
* @name EnterpriseDao
|
* @name EnterpriseMapper
|
||||||
* @date 2024-09-29 14:31:06
|
* @date 2024-09-29 14:31:06
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface EnterpriseDao {
|
public interface EnterpriseMapper {
|
||||||
// 查询分页信息
|
// 查询分页信息
|
||||||
public ArrayList<HashMap> selectEnterprise(Map param);
|
public ArrayList<HashMap> selectEnterprise(Map param);
|
||||||
//查询企业记录总数
|
//查询企业记录总数
|
|
@ -17,16 +17,6 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysCarFaultMapper extends BaseMapper<SysCarFault> {
|
public interface SysCarFaultMapper extends BaseMapper<SysCarFault> {
|
||||||
|
|
||||||
//根据添加的故障码进行查询
|
|
||||||
@Select("select fault_code from sys_car_fault where fault_code=#{faultCode}")
|
|
||||||
SysCarFault selectFaultByFaultCode(String faultCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询故障码信息
|
|
||||||
* @param ids 故障码信息主键
|
|
||||||
* @return 故障码信息
|
|
||||||
*/
|
|
||||||
public List<SysCarFault> selectSysCarFaultIds(String[] ids);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,8 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysCarFaultMessageMapper extends BaseMapper<SysCarFaultMessage> {
|
public interface SysCarFaultMessageMapper extends BaseMapper<SysCarFaultMessage> {
|
||||||
|
|
||||||
// 查询状态等于1的记录
|
|
||||||
@Select("select * from sys_car_fault_message where status=1")
|
|
||||||
public List<SysCarFaultMessage>listStatusOnt( );
|
|
||||||
//查询状态等于2的记录
|
|
||||||
@Select("select * from sys_car_fault_message where status=2")
|
|
||||||
public List<SysCarFaultMessage>listStatusTwo( );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,6 @@ public interface SysCarMapper extends BaseMapper<SysCar> {
|
||||||
|
|
||||||
SysCar findCarByVin(@Param("carVin") String carVin);
|
SysCar findCarByVin(@Param("carVin") String carVin);
|
||||||
|
|
||||||
SysCar selectByCarVin(@Param("carVin") String carVin);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,6 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TemplateMapper extends BaseMapper<Template> {
|
public interface TemplateMapper extends BaseMapper<Template> {
|
||||||
|
|
||||||
List<MessageTemplateType> findTemplateById(@Param("templateId") Integer templateId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.server.mapper;
|
package com.muyu.server.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.common.domain.MessageTemplateType;
|
import com.muyu.common.domain.MessageTemplateType;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
@ -14,6 +15,6 @@ import java.util.List;
|
||||||
* @date 2024-09-29 14:44:57
|
* @date 2024-09-29 14:44:57
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TemplateNeedMapper {
|
public interface TemplateNeedMapper extends BaseMapper<MessageTemplateType> {
|
||||||
List<MessageTemplateType> selectByTemplateId(@Param("templateId")Long templateId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预警策略Mapper接口
|
* 预警策略Mapper接口
|
||||||
* @author muyu
|
* @author sx
|
||||||
* @package com.muyu.server.mapper
|
* @package com.muyu.server.mapper
|
||||||
* @name WarnStrategyMapper
|
* @name WarnStrategyMapper
|
||||||
* @date 2024-09-20
|
* @date 2024-09-20
|
||||||
|
|
|
@ -36,7 +36,7 @@ public interface SysCarFaultService extends IService<SysCarFault> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SysCarFault selectFaultByFaultCode(String faultCode);
|
List<SysCarFault> selectFaultByFaultCode(String faultCode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.server.service;
|
package com.muyu.server.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.common.domain.MessageTemplateType;
|
import com.muyu.common.domain.MessageTemplateType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -12,6 +13,6 @@ import java.util.List;
|
||||||
* @date 2024-09-29 15:31:55
|
* @date 2024-09-29 15:31:55
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface TemplateNeedService {
|
public interface TemplateNeedService extends IService<MessageTemplateType> {
|
||||||
List<MessageTemplateType> selectByTemplateId(Long templateId);
|
List<MessageTemplateType> selectByTemplateId(Long templateId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import cn.hutool.core.map.MapUtil;
|
||||||
import com.muyu.cache.EnterpriseCacheService;
|
import com.muyu.cache.EnterpriseCacheService;
|
||||||
import com.muyu.common.domain.Enterprise;
|
import com.muyu.common.domain.Enterprise;
|
||||||
import com.muyu.common.util.PageUtils;
|
import com.muyu.common.util.PageUtils;
|
||||||
import com.muyu.server.mapper.EnterpriseDao;
|
import com.muyu.server.mapper.EnterpriseMapper;
|
||||||
import com.muyu.server.service.EnterpriseService;
|
import com.muyu.server.service.EnterpriseService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -22,7 +22,7 @@ import java.util.*;
|
||||||
public class EnterpriseServiceImpl implements EnterpriseService {
|
public class EnterpriseServiceImpl implements EnterpriseService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EnterpriseDao enterpriseDao;
|
private EnterpriseMapper enterpriseDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EnterpriseCacheService enterpriseCacheService;
|
private EnterpriseCacheService enterpriseCacheService;
|
||||||
|
|
|
@ -50,8 +50,9 @@ public class SysCarFaultMessageServiceImpl extends ServiceImpl<SysCarFaultMessag
|
||||||
@Override
|
@Override
|
||||||
public List<SysCarFaultMessage> listStatusOnt( ) {
|
public List<SysCarFaultMessage> listStatusOnt( ) {
|
||||||
|
|
||||||
List<SysCarFaultMessage> list = baseMapper.listStatusOnt();
|
LambdaQueryWrapper<SysCarFaultMessage> wrapper = new LambdaQueryWrapper<>();
|
||||||
return list;
|
wrapper.eq(SysCarFaultMessage::getStatus,1);
|
||||||
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +61,9 @@ public class SysCarFaultMessageServiceImpl extends ServiceImpl<SysCarFaultMessag
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysCarFaultMessage> listStatusTwo( ) {
|
public List<SysCarFaultMessage> listStatusTwo( ) {
|
||||||
List<SysCarFaultMessage> list = baseMapper.listStatusTwo();
|
|
||||||
return list;
|
LambdaQueryWrapper<SysCarFaultMessage> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(SysCarFaultMessage::getStatus,2);
|
||||||
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,9 +91,12 @@ public class SysCarFaultServiceImpl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysCarFault selectFaultByFaultCode(String faultCode) {
|
public List<SysCarFault> selectFaultByFaultCode(String faultCode) {
|
||||||
return mapper.selectFaultByFaultCode(faultCode);
|
LambdaQueryWrapper<SysCarFault> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(SysCarFault::getFaultCode, faultCode);
|
||||||
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,16 @@ import com.muyu.server.service.SysCarService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆管理 服务层处理
|
||||||
|
* @author sx
|
||||||
|
* @package com.muyu.server.service.impl
|
||||||
|
* @name SysCarServiceImpl
|
||||||
|
* @date 2024-09-29 14:31:06
|
||||||
|
*/
|
||||||
@DS("lizzDB")
|
@DS("lizzDB")
|
||||||
@Service
|
@Service
|
||||||
public class SysCarServiceImpl extends ServiceImpl<SysCarMapper, SysCar> implements SysCarService {
|
public class SysCarServiceImpl extends ServiceImpl<SysCarMapper, SysCar> implements SysCarService {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.server.service.impl;
|
package com.muyu.server.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.cache.MessageTemplateTypeCacheService;
|
import com.muyu.cache.MessageTemplateTypeCacheService;
|
||||||
import com.muyu.common.domain.MessageTemplateType;
|
import com.muyu.common.domain.MessageTemplateType;
|
||||||
import com.muyu.server.mapper.TemplateNeedMapper;
|
import com.muyu.server.mapper.TemplateNeedMapper;
|
||||||
|
@ -17,14 +19,21 @@ import java.util.List;
|
||||||
* @date 2024/9/22 14:36
|
* @date 2024/9/22 14:36
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class TemplateNeedServiceImpl implements TemplateNeedService {
|
public class TemplateNeedServiceImpl extends ServiceImpl<TemplateNeedMapper, MessageTemplateType> implements TemplateNeedService {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TemplateNeedMapper templateNeedMapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MessageTemplateType> selectByTemplateId(Long templateId) {
|
public List<MessageTemplateType> selectByTemplateId(Long templateId) {
|
||||||
List<MessageTemplateType> messageTemplateTypes = templateNeedMapper.selectByTemplateId(templateId);
|
|
||||||
return messageTemplateTypes;
|
LambdaQueryWrapper<MessageTemplateType> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
|
||||||
|
wrapper.eq(MessageTemplateType::getTemplateId, templateId);
|
||||||
|
|
||||||
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.muyu.server.service.impl;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.cache.SysCarCacheService;
|
|
||||||
import com.muyu.common.domain.MessageTemplateType;
|
import com.muyu.common.domain.MessageTemplateType;
|
||||||
import com.muyu.common.domain.SysCar;
|
import com.muyu.common.domain.SysCar;
|
||||||
import com.muyu.common.domain.Template;
|
import com.muyu.common.domain.Template;
|
||||||
|
@ -21,7 +20,8 @@ import java.sql.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
/**
|
/**
|
||||||
* @Author:liuxinyue
|
* 报文模版 服务层处理
|
||||||
|
* @author liuxinyue
|
||||||
* @Package:com.template.service.impl
|
* @Package:com.template.service.impl
|
||||||
* @Project:cloud-server-c
|
* @Project:cloud-server-c
|
||||||
* @name:TemplateServiceImp
|
* @name:TemplateServiceImp
|
||||||
|
@ -31,8 +31,7 @@ import java.util.concurrent.ExecutionException;
|
||||||
@Service
|
@Service
|
||||||
public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> implements TemplateService {
|
public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> implements TemplateService {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private static TemplateMapper templateMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysCarService sysCarService;
|
private SysCarService sysCarService;
|
||||||
|
|
|
@ -11,6 +11,76 @@ nacos:
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
kafka:
|
||||||
|
producer:
|
||||||
|
# Kafka服务器
|
||||||
|
bootstrap-servers: 150.158.33.234:9092
|
||||||
|
# 开启事务,必须在开启了事务的方法中发送,否则报错
|
||||||
|
transaction-id-prefix: kafkaTx-
|
||||||
|
# 发生错误后,消息重发的次数,开启事务必须设置大于0。
|
||||||
|
retries: 3
|
||||||
|
# acks=0 : 生产者在成功写入消息之前不会等待任何来自服务器的响应。
|
||||||
|
# acks=1 : 只要集群的首领节点收到消息,生产者就会收到一个来自服务器成功响应。
|
||||||
|
# acks=all :只有当所有参与复制的节点全部收到消息时,生产者才会收到一个来自服务器的成功响应。
|
||||||
|
acks: all
|
||||||
|
# 开启事务时,必须设置为all
|
||||||
|
# 当有多个消息需要被发送到同一个分区时,生产者会把它们放在同一个批次里。该参数指定了一个批次可以使用的内存大小,按照字节数计算。
|
||||||
|
batch-size: 16384
|
||||||
|
# 生产者内存缓冲区的大小。
|
||||||
|
buffer-memory: 1024000
|
||||||
|
# 键的序列化方式
|
||||||
|
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||||
|
# 值的序列化方式(建议使用Json,这种序列化方式可以无需额外配置传输实体类)
|
||||||
|
value-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||||
|
consumer:
|
||||||
|
# Kafka服务器
|
||||||
|
group-id: my-kafka
|
||||||
|
# 自动提交的时间间隔 在spring boot 2.X 版本中这里采用的是值的类型为Duration 需要符合特定的格式,如1S,1M,2H,5D
|
||||||
|
#auto-commit-interval: 2s
|
||||||
|
# 该属性指定了消费者在读取一个没有偏移量的分区或者偏移量无效的情况下该作何处理:
|
||||||
|
# earliest:当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费分区的记录
|
||||||
|
# latest:当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,消费新产生的该分区下的数据(在消费者启动之后生成的记录)
|
||||||
|
# none:当各分区都存在已提交的offset时,从提交的offset开始消费;只要有一个分区不存在已提交的offset,则抛出异常
|
||||||
|
auto-offset-reset: latest
|
||||||
|
# 是否自动提交偏移量,默认值是true,为了避免出现重复数据和数据丢失,可以把它设置为false,然后手动提交偏移量
|
||||||
|
enable-auto-commit: true
|
||||||
|
# 键的反序列化方式
|
||||||
|
#key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||||
|
key-deserializer: org.apache.kafka.common.serialization.StringSerializer
|
||||||
|
# 值的反序列化方式(建议使用Json,这种序列化方式可以无需额外配置传输实体类)
|
||||||
|
value-deserializer: org.apache.kafka.common.serialization.StringSerializer
|
||||||
|
# 这个参数定义了poll方法最多可以拉取多少条消息,默认值为500。如果在拉取消息的时候新消息不足500条,那有多少返回多少;如果超过500条,每次只返回500。
|
||||||
|
# 这个默认值在有些场景下太大,有些场景很难保证能够在5min内处理完500条消息,
|
||||||
|
# 如果消费者无法在5分钟内处理完500条消息的话就会触发reBalance,
|
||||||
|
# 然后这批消息会被分配到另一个消费者中,还是会处理不完,这样这批消息就永远也处理不完。
|
||||||
|
# 要避免出现上述问题,提前评估好处理一条消息最长需要多少时间,然后覆盖默认的max.poll.records参数
|
||||||
|
# 注:需要开启BatchListener批量监听才会生效,如果不开启BatchListener则不会出现reBalance情况
|
||||||
|
max-poll-records: 500
|
||||||
|
bootstrap-servers: 150.158.33.234:9092
|
||||||
|
auto-commit-interval: 5000
|
||||||
|
fetch-max-wait: 500
|
||||||
|
fetch-min-size: 1
|
||||||
|
heartbeat-interval: 3000
|
||||||
|
properties:
|
||||||
|
# 两次poll之间的最大间隔,默认值为5分钟。如果超过这个间隔会触发reBalance
|
||||||
|
max:
|
||||||
|
poll:
|
||||||
|
interval:
|
||||||
|
ms: 600000
|
||||||
|
# 当broker多久没有收到consumer的心跳请求后就触发reBalance,默认值是10s
|
||||||
|
session:
|
||||||
|
timeout:
|
||||||
|
ms: 10000
|
||||||
|
listener:
|
||||||
|
# 在侦听器容器中运行的线程数,一般设置为 机器数*分区数
|
||||||
|
concurrency: 4
|
||||||
|
# 自动提交关闭,需要设置手动消息确认
|
||||||
|
ack-mode: manual_immediate
|
||||||
|
# 消费监听接口监听的主题不存在时,默认会报错,所以设置为false忽略错误
|
||||||
|
missing-topics-fatal: false
|
||||||
|
# 两次poll之间的最大间隔,默认值为5分钟。如果超过这个间隔会触发reBalance
|
||||||
|
poll-timeout: 600000
|
||||||
|
|
||||||
mvc:
|
mvc:
|
||||||
pathmatch:
|
pathmatch:
|
||||||
matching-strategy: ant_path_matcher
|
matching-strategy: ant_path_matcher
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
<?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.server.mapper.CarTypeMapper">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -6,7 +6,7 @@
|
||||||
1.在mybats的开发中namespace有特殊的意思,一定要是对应接口的全限定名
|
1.在mybats的开发中namespace有特殊的意思,一定要是对应接口的全限定名
|
||||||
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
|
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
|
||||||
-->
|
-->
|
||||||
<mapper namespace="com.muyu.server.mapper.EnterpriseDao">
|
<mapper namespace="com.muyu.server.mapper.EnterpriseMapper">
|
||||||
|
|
||||||
<!--查询企业信息-->
|
<!--查询企业信息-->
|
||||||
<select id="selectEnterprise" resultType="HashMap" parameterType="Map">
|
<select id="selectEnterprise" resultType="HashMap" parameterType="Map">
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--新增企业信息-->
|
<!--新增企业信息-->
|
||||||
<insert id="insert" parameterType="com.muyu.server.mapper.EnterpriseDao">
|
<insert id="insert" parameterType="com.muyu.server.mapper.EnterpriseMapper">
|
||||||
insert into tb_enterprise
|
insert into tb_enterprise
|
||||||
set enterprise_name = #{enterpriseName},
|
set enterprise_name = #{enterpriseName},
|
||||||
enterprise_car_count = #{enterpriseCarCount},
|
enterprise_car_count = #{enterpriseCarCount},
|
||||||
|
|
|
@ -77,7 +77,5 @@
|
||||||
<select id="findCarByVin" resultType="com.muyu.common.domain.SysCar">
|
<select id="findCarByVin" resultType="com.muyu.common.domain.SysCar">
|
||||||
select * from sys_car where car_vin=#{carVin}
|
select * from sys_car where car_vin=#{carVin}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByCarVin" resultType="com.muyu.common.domain.SysCar">
|
|
||||||
select * from sys_car where car_cin=#{carVin}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?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.server.mapper.TemplateNeedMapper">
|
|
||||||
|
|
||||||
<select id="selectByTemplateId" resultType="com.muyu.common.domain.MessageTemplateType">
|
|
||||||
SELECT * FROM `message_template_type` WHERE template_id=#{templateId}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -1,140 +0,0 @@
|
||||||
<?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.server.mapper.SysCarFaultMapper">
|
|
||||||
|
|
||||||
<resultMap type="com.muyu.common.domain.SysCarFault" id="SysCarFaultResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="faultCode" column="fault_code" />
|
|
||||||
<result property="faultName" column="fault_name" />
|
|
||||||
<result property="typeId" column="type_id" />
|
|
||||||
<result property="faultLabel" column="fault_label" />
|
|
||||||
<result property="faultBit" column="fault_bit" />
|
|
||||||
<result property="faultValue" column="fault_value" />
|
|
||||||
<result property="faultRank" column="fault_rank" />
|
|
||||||
<result property="faultDesc" column="fault_desc" />
|
|
||||||
<result property="faultMinThreshold" column="fault_min_threshold" />
|
|
||||||
<result property="faultMaxThreshold" column="fault_max_threshold" />
|
|
||||||
<result property="status" column="status" />
|
|
||||||
<result property="warnStatus" column="warn_status" />
|
|
||||||
<result property="remark" column="remark" />
|
|
||||||
<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="carTypeId" column="car_type_id"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectSysCarFaultVo">
|
|
||||||
select id, fault_code, fault_name, type_id, fault_label, fault_bit, fault_value, fault_rank, fault_desc, fault_min_threshold, fault_max_threshold, status, warn_status, remark, create_by, create_time, update_by, update_time,car_type_id from sys_car_fault
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectSysCarFaultList" parameterType="com.muyu.common.domain.SysCarFault" resultMap="SysCarFaultResult">
|
|
||||||
<include refid="selectSysCarFaultVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="faultCode != null and faultCode != ''"> and fault_code = #{faultCode}</if>
|
|
||||||
<if test="faultBit != null and faultBit != ''"> and fault_bit = #{faultBit}</if>
|
|
||||||
<if test="faultRank != null "> and fault_rank = #{faultRank}</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectSysCarFaultById" parameterType="Long" resultMap="SysCarFaultResult">
|
|
||||||
<include refid="selectSysCarFaultVo"/>
|
|
||||||
where id = #{id}
|
|
||||||
</select>
|
|
||||||
<select id="selectSysCarFaultIds" resultMap="SysCarFaultResult">
|
|
||||||
<include refid="selectSysCarFaultVo"/>
|
|
||||||
where id in
|
|
||||||
<foreach collection="array" item="id" index="index" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertSysCarFault" parameterType="com.muyu.common.domain.SysCarFault" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
insert into sys_car_fault
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="faultCode != null and faultCode != ''">fault_code,</if>
|
|
||||||
<if test="faultName != null">fault_name,</if>
|
|
||||||
<if test="typeId != null">type_id,</if>
|
|
||||||
<if test="faultLabel != null">fault_label,</if>
|
|
||||||
<if test="faultBit != null">fault_bit,</if>
|
|
||||||
<if test="faultValue != null">fault_value,</if>
|
|
||||||
<if test="faultRank != null">fault_rank,</if>
|
|
||||||
<if test="faultDesc != null">fault_desc,</if>
|
|
||||||
<if test="faultMinThreshold != null">fault_min_threshold,</if>
|
|
||||||
<if test="faultMaxThreshold != null">fault_max_threshold,</if>
|
|
||||||
<if test="status != null">status,</if>
|
|
||||||
<if test="warnStatus != null">warn_status,</if>
|
|
||||||
<if test="remark != null">remark,</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="carTypeId !=null">car_type_id</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="faultCode != null and faultCode != ''">#{faultCode},</if>
|
|
||||||
<if test="faultName != null">#{faultName},</if>
|
|
||||||
<if test="typeId != null">#{typeId},</if>
|
|
||||||
<if test="faultLabel != null">#{faultLabel},</if>
|
|
||||||
<if test="faultBit != null">#{faultBit},</if>
|
|
||||||
<if test="faultValue != null">#{faultValue},</if>
|
|
||||||
<if test="faultRank != null">#{faultRank},</if>
|
|
||||||
<if test="faultDesc != null">#{faultDesc},</if>
|
|
||||||
<if test="faultMinThreshold != null">#{faultMinThreshold},</if>
|
|
||||||
<if test="faultMaxThreshold != null">#{faultMaxThreshold},</if>
|
|
||||||
<if test="status != null">#{status},</if>
|
|
||||||
<if test="warnStatus != null">#{warnStatus},</if>
|
|
||||||
<if test="remark != null">#{remark},</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="carTypeId != null">#{catTypeId}</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateSysCarFault" parameterType="com.muyu.common.domain.SysCarFault">
|
|
||||||
update sys_car_fault
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="faultCode != null and faultCode != ''">fault_code = #{faultCode},</if>
|
|
||||||
<if test="faultName != null">fault_name = #{faultName},</if>
|
|
||||||
<if test="typeId != null">type_id = #{typeId},</if>
|
|
||||||
<if test="faultLabel != null">fault_label = #{faultLabel},</if>
|
|
||||||
<if test="faultBit != null">fault_bit = #{faultBit},</if>
|
|
||||||
<if test="faultValue != null">fault_value = #{faultValue},</if>
|
|
||||||
<if test="faultRank != null">fault_rank = #{faultRank},</if>
|
|
||||||
<if test="faultDesc != null">fault_desc = #{faultDesc},</if>
|
|
||||||
<if test="faultMinThreshold != null">fault_min_threshold = #{faultMinThreshold},</if>
|
|
||||||
<if test="faultMaxThreshold != null">fault_max_threshold = #{faultMaxThreshold},</if>
|
|
||||||
<if test="status != null">status = #{status},</if>
|
|
||||||
<if test="warnStatus != null">warn_status = #{warnStatus},</if>
|
|
||||||
<if test="remark != null">remark = #{remark},</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="carTypeId !=null">car_type_id=#{catTypeId}</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteSysCarFaultById" parameterType="Long">
|
|
||||||
delete from sys_car_fault where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteSysCarFaultByIds" parameterType="String">
|
|
||||||
delete from sys_car_fault where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<update id="enableWarningsById" parameterType="Long">
|
|
||||||
update sys_car_fault set warn_status = 0 where id = #{id}
|
|
||||||
</update>
|
|
||||||
<update id="disableWarningsById" parameterType="Long">
|
|
||||||
update sys_car_fault set warn_status = 1 where id = #{id}
|
|
||||||
</update>
|
|
||||||
</mapper>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?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.server.mapper.DataTypeMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?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.server.mapper.MessageTemplateTypeMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,23 +0,0 @@
|
||||||
<?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.server.mapper.TemplateMapper">
|
|
||||||
|
|
||||||
<select id="templateList" resultType="com.muyu.common.domain.Template">
|
|
||||||
select * from t_template
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="findTemplateByName" resultType="com.muyu.common.domain.Template">
|
|
||||||
select * from t_template where template_name=#{typeName}
|
|
||||||
</select>
|
|
||||||
<select id="findTemplateById" resultType="com.muyu.common.domain.MessageTemplateType">
|
|
||||||
SELECT
|
|
||||||
*
|
|
||||||
FROM
|
|
||||||
message_template_type
|
|
||||||
WHERE
|
|
||||||
template_id = #{templateId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -0,0 +1,374 @@
|
||||||
|
/*
|
||||||
|
Navicat Premium Data Transfer
|
||||||
|
|
||||||
|
Source Server : 组
|
||||||
|
Source Server Type : MySQL
|
||||||
|
Source Server Version : 80401
|
||||||
|
Source Host : 47.101.53.251:3306
|
||||||
|
Source Schema : saas
|
||||||
|
|
||||||
|
Target Server Type : MySQL
|
||||||
|
Target Server Version : 80401
|
||||||
|
File Encoding : 65001
|
||||||
|
|
||||||
|
Date: 04/10/2024 16:01:07
|
||||||
|
*/
|
||||||
|
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for car_type
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `car_type`;
|
||||||
|
CREATE TABLE `car_type` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT COMMENT '车辆类型Id',
|
||||||
|
`type_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '车辆类型',
|
||||||
|
`template_id` int NULL DEFAULT NULL COMMENT '报文模版Id',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆类型' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for data_type
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `data_type`;
|
||||||
|
CREATE TABLE `data_type` (
|
||||||
|
`data_type_id` int NOT NULL AUTO_INCREMENT COMMENT '报文数据类型Id',
|
||||||
|
`data_type_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '报文数据类型',
|
||||||
|
PRIMARY KEY (`data_type_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '报文数据类型' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for electronic_fence
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `electronic_fence`;
|
||||||
|
CREATE TABLE `electronic_fence` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT COMMENT '围栏主键',
|
||||||
|
`name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '围栏名称',
|
||||||
|
`fence_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '围栏类型(驶入,驶出)',
|
||||||
|
`longitude_latitude` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '经纬度信息',
|
||||||
|
`status` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '电子围栏状态(正常,停用)',
|
||||||
|
`fence_desc` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '描述信息',
|
||||||
|
`create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新人',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '电子围栏' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for electronic_fence_group
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `electronic_fence_group`;
|
||||||
|
CREATE TABLE `electronic_fence_group` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT COMMENT '自增主键',
|
||||||
|
`group_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '围栏组名称',
|
||||||
|
`group_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '围栏组类型',
|
||||||
|
`priority` int NULL DEFAULT NULL COMMENT '围栏组优先级(0-99)',
|
||||||
|
`status` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '启用状态',
|
||||||
|
`create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新人',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '围栏组' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for fence_group_mid
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `fence_group_mid`;
|
||||||
|
CREATE TABLE `fence_group_mid` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`group_id` int NULL DEFAULT NULL COMMENT '围栏组外键',
|
||||||
|
`fence_id` int NULL DEFAULT NULL COMMENT '电子围栏外键',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '电子围栏-围栏组(中间表)' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for message_template
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `message_template`;
|
||||||
|
CREATE TABLE `message_template` (
|
||||||
|
`message_id` int(10) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT,
|
||||||
|
`vin_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'VIN 码',
|
||||||
|
`time_stamp` datetime NULL DEFAULT NULL COMMENT '时间戳',
|
||||||
|
`long_itude` double NULL DEFAULT NULL COMMENT '经度',
|
||||||
|
`latitude` double NULL DEFAULT NULL COMMENT '纬度',
|
||||||
|
`speed_vehicle` double NULL DEFAULT NULL COMMENT '车速',
|
||||||
|
`total_mileage` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '总里程',
|
||||||
|
`total_voltage` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '总电压',
|
||||||
|
`combined_current` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '总电流',
|
||||||
|
`insulation_resistance` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绝缘电阻',
|
||||||
|
`gear_position` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '档位',
|
||||||
|
`accelerator_pedal_travel_value` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '加速踏板行程值',
|
||||||
|
`brake_pedal_travel_value` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '制动踏板行程值',
|
||||||
|
`specific_fuel_consumption` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '燃料消耗率',
|
||||||
|
`motor_controller_temperature` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机控制器温度',
|
||||||
|
`motor_speed` double NULL DEFAULT NULL COMMENT '电机转速',
|
||||||
|
`motor_torque` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机转矩',
|
||||||
|
`motor_temperature` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机温度',
|
||||||
|
`motor_voltage` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机电压',
|
||||||
|
`motor_current` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机电流',
|
||||||
|
`power_battery_remaining_soc` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '剩余电池电量',
|
||||||
|
`maximum_feedback_power` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最大反馈功率',
|
||||||
|
`maximum_discharge_power` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最大放电功率',
|
||||||
|
`bms_self_check_counter` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'BMS自检计数器',
|
||||||
|
`power_battery` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '动力电池',
|
||||||
|
`total_voltage_load_side` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '总电压负载侧',
|
||||||
|
`maximum_voltage` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最大电压',
|
||||||
|
`minimum_voltage` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最小电压',
|
||||||
|
`maximum_temperature` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最高温度',
|
||||||
|
`minimum_temperature` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最低温度',
|
||||||
|
`available_capacity` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '可用功率',
|
||||||
|
`vehicle_status` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '车辆状态',
|
||||||
|
`charging_state` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '充电状态',
|
||||||
|
`operational_status` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '行驶状态',
|
||||||
|
`soc` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '单芯片系统',
|
||||||
|
`energy_storage_devices` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '能源存储设备',
|
||||||
|
`drive_motor_condition` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '驱动电机转态',
|
||||||
|
`whether_works` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '是否有效',
|
||||||
|
`eas` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电子防窃系统',
|
||||||
|
`ptc` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '正常温度系数',
|
||||||
|
`eps` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '蓄电池',
|
||||||
|
`abs` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '防抱死制动系统',
|
||||||
|
`mcu` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '单片机',
|
||||||
|
`heating_state` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '加热状态',
|
||||||
|
`power_battery_status` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '电源电池状态',
|
||||||
|
`state_battery_insulation` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '状态电池绝缘',
|
||||||
|
`dcdc` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '直流直流变换器',
|
||||||
|
`chg` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '变化',
|
||||||
|
`check_digit` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '校验数位',
|
||||||
|
`cutoff_bit` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '截止点',
|
||||||
|
PRIMARY KEY (`message_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '报文模版' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for message_template_type
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `message_template_type`;
|
||||||
|
CREATE TABLE `message_template_type` (
|
||||||
|
`message_template_type_id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`message_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '编码',
|
||||||
|
`message_field` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '标签',
|
||||||
|
`start_index` int NULL DEFAULT NULL COMMENT '起始位',
|
||||||
|
`end_index` int NULL DEFAULT NULL COMMENT '终值位',
|
||||||
|
`data_type_id` int NULL DEFAULT NULL COMMENT '报文数据类型Id',
|
||||||
|
`data_type_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '报文数据类型名称',
|
||||||
|
`fixed_value` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最小值',
|
||||||
|
`range_value` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最大值',
|
||||||
|
`template_id` int NULL DEFAULT NULL COMMENT '模版Id',
|
||||||
|
`message_class` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '报文类别',
|
||||||
|
PRIMARY KEY (`message_template_type_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 76 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '报文模版类型' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for message_value
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `message_value`;
|
||||||
|
CREATE TABLE `message_value` (
|
||||||
|
`message_id` bigint NOT NULL AUTO_INCREMENT COMMENT '报文主键',
|
||||||
|
`template_id` bigint NULL DEFAULT NULL COMMENT '模版外键',
|
||||||
|
`message_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报文编码',
|
||||||
|
`message_label` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报文标签',
|
||||||
|
`message_start_index` int NULL DEFAULT NULL COMMENT '起始位',
|
||||||
|
`message_end_index` int NULL DEFAULT NULL COMMENT '终止位',
|
||||||
|
`create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||||||
|
`message_class` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`message_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 61 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '报文' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for sys_car
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `sys_car`;
|
||||||
|
CREATE TABLE `sys_car` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`car_vin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'VIN码',
|
||||||
|
`car_type_id` int NULL DEFAULT NULL COMMENT '车辆类型Id',
|
||||||
|
`state` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '状态',
|
||||||
|
`fence_id` int NULL DEFAULT NULL COMMENT '电子围栏',
|
||||||
|
`car_motor_manufacturer` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '车辆电机厂商',
|
||||||
|
`car_motor_model` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机型号',
|
||||||
|
`car_battery_manufacturer` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '车辆电池厂商',
|
||||||
|
`car_battery_model` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电池型号',
|
||||||
|
`strategy_id` int NULL DEFAULT NULL COMMENT '策略ID',
|
||||||
|
`group_id` int NULL DEFAULT NULL COMMENT '围栏组ID',
|
||||||
|
`create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '修改人',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
|
||||||
|
`remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
|
||||||
|
`template_id` int NULL DEFAULT NULL COMMENT '报文模版ID',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆基础信息表' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for sys_car_enterprise
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `sys_car_enterprise`;
|
||||||
|
CREATE TABLE `sys_car_enterprise` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`enterprise_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '企业名称',
|
||||||
|
`name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '用户姓名',
|
||||||
|
`position` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '用户职位',
|
||||||
|
`province` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '公司所在省',
|
||||||
|
`city` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '公司所在市',
|
||||||
|
`county` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '公司所在县/区',
|
||||||
|
`address` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '公司详细地址',
|
||||||
|
`credit_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '统一社会信用代码',
|
||||||
|
`business_license` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '营业执照',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '企业' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for sys_car_fault
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `sys_car_fault`;
|
||||||
|
CREATE TABLE `sys_car_fault` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '参数主键',
|
||||||
|
`fault_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '故障码编码',
|
||||||
|
`fault_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '故障名',
|
||||||
|
`type_id` int NULL DEFAULT NULL COMMENT '故障类型',
|
||||||
|
`fault_label` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '故障标签',
|
||||||
|
`fault_bit` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '故障位',
|
||||||
|
`fault_value` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '故障值',
|
||||||
|
`fault_rank` int NULL DEFAULT NULL COMMENT '故障级别 (0.低 ,1.中 ,2.高)',
|
||||||
|
`fault_desc` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '故障描述信息',
|
||||||
|
`fault_min_threshold` int NULL DEFAULT NULL COMMENT '故障最小阈值',
|
||||||
|
`fault_max_threshold` int NULL DEFAULT NULL COMMENT '故障最大阈值',
|
||||||
|
`status` int NULL DEFAULT 1 COMMENT '启用状态(1.待处理 2.处理中 3.已处理 4.忽略)',
|
||||||
|
`warn_status` int NULL DEFAULT 0 COMMENT '是否警告(0.开启 1.禁止)',
|
||||||
|
`remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
|
||||||
|
`create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建者',
|
||||||
|
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新者',
|
||||||
|
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`car_type_id` int NULL DEFAULT NULL COMMENT '车辆类型',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '故障码' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for sys_car_fault_log
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `sys_car_fault_log`;
|
||||||
|
CREATE TABLE `sys_car_fault_log` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`sys_car_fault_id` int NOT NULL COMMENT '故障码编号',
|
||||||
|
`create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
|
||||||
|
`update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '修改人',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
|
||||||
|
`vin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'VIN码',
|
||||||
|
`remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '内容',
|
||||||
|
`status` int NULL DEFAULT 2 COMMENT '1- 解决 2- 处理中 3-忽略',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '故障日志表' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for sys_car_fault_message
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `sys_car_fault_message`;
|
||||||
|
CREATE TABLE `sys_car_fault_message` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`content` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '内容',
|
||||||
|
`status` int NULL DEFAULT NULL COMMENT '1-已读 2-未读',
|
||||||
|
`create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
|
||||||
|
`update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '修改人',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
|
||||||
|
`remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '站内信' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for sys_car_log
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `sys_car_log`;
|
||||||
|
CREATE TABLE `sys_car_log` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`car_vin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'VIN码',
|
||||||
|
`start_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`end_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆日志表' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for t_template
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `t_template`;
|
||||||
|
CREATE TABLE `t_template` (
|
||||||
|
`template_id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`house_id` int NULL DEFAULT NULL,
|
||||||
|
`template_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '报文模版名称',
|
||||||
|
`template_describe` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '报文模版描述',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
PRIMARY KEY (`template_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '报文模版表' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for tb_enterprise
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `tb_enterprise`;
|
||||||
|
CREATE TABLE `tb_enterprise` (
|
||||||
|
`enterprise_id` int NOT NULL AUTO_INCREMENT COMMENT '企业编号',
|
||||||
|
`enterprise_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '企业名称',
|
||||||
|
`enterprise_car_count` int NULL DEFAULT 0 COMMENT '企业车辆数量',
|
||||||
|
`enterprise_fence_count` int NULL DEFAULT 0 COMMENT '企业电子围栏数量',
|
||||||
|
`enterprise_database_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '企业数据库',
|
||||||
|
PRIMARY KEY (`enterprise_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '企业运营' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for warn_logs
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `warn_logs`;
|
||||||
|
CREATE TABLE `warn_logs` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT COMMENT '预警日志id',
|
||||||
|
`vin` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '车辆vin码',
|
||||||
|
`warn_rule_id` int NULL DEFAULT NULL COMMENT '规则id',
|
||||||
|
`start_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
|
||||||
|
`end_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
|
||||||
|
`max_value` int NULL DEFAULT NULL COMMENT '最大值',
|
||||||
|
`min_value` int NULL DEFAULT NULL COMMENT '最小值',
|
||||||
|
`avg_value` int NULL DEFAULT NULL COMMENT '平均值',
|
||||||
|
`median_value` int NULL DEFAULT NULL COMMENT '中位数',
|
||||||
|
`status` int NULL DEFAULT NULL COMMENT '是否发送预警',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆预警记录表' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for warn_rule
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `warn_rule`;
|
||||||
|
CREATE TABLE `warn_rule` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT COMMENT '规则id',
|
||||||
|
`rule_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '规则名称',
|
||||||
|
`strategy_id` int NULL DEFAULT NULL COMMENT '策略id',
|
||||||
|
`msg_type_id` int NULL DEFAULT NULL COMMENT '报文数据类型id',
|
||||||
|
`slide_time` int NULL DEFAULT NULL COMMENT '滑窗时间',
|
||||||
|
`slide_frequency` int NULL DEFAULT NULL COMMENT '滑窗频率',
|
||||||
|
`growth_rate` int NULL DEFAULT NULL COMMENT '增长率',
|
||||||
|
`volatility_rate` int NULL DEFAULT NULL COMMENT '波动率',
|
||||||
|
`decrease_rate` int NULL DEFAULT NULL COMMENT '下降率',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆预警规则表' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for warn_strategy
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `warn_strategy`;
|
||||||
|
CREATE TABLE `warn_strategy` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT COMMENT '策略id',
|
||||||
|
`car_type_id` int NULL DEFAULT NULL COMMENT '车辆类型id',
|
||||||
|
`strategy_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '策略名称',
|
||||||
|
`template_id` int NULL DEFAULT NULL COMMENT '报文模版id',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆预警策略表' ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
Loading…
Reference in New Issue