Compare commits
93 Commits
Author | SHA1 | Date |
---|---|---|
|
9a77d9dfbf | |
|
90d688f8d2 | |
|
b37ff7ca83 | |
|
08d79266ed | |
|
a87e40318f | |
|
e0962bcc53 | |
|
aacbfdf6b7 | |
|
2c330529b1 | |
|
d9e2c2e357 | |
|
1565dd577c | |
|
880604da65 | |
|
1eb9952dc0 | |
|
ed3830c1ae | |
|
c0800ce466 | |
|
ac8e4bcc94 | |
|
d472b8d326 | |
|
edeeb878c5 | |
|
e7ff873329 | |
|
7bfd5f8f88 | |
|
c8c16b9c80 | |
|
820039d3fe | |
|
e31070e5ba | |
|
4a8cf4e603 | |
|
2ef6ba2f6b | |
|
11d1d68511 | |
|
f166853e31 | |
|
813fcf1b55 | |
|
61f1ea45b2 | |
|
83961147fc | |
|
ad0460a90b | |
|
171df03d7c | |
|
a1ed677f0f | |
|
72ac72330e | |
|
3c2667ec37 | |
|
90e94c2736 | |
|
914b638efd | |
|
27479e2b49 | |
|
1e9c92e4d3 | |
|
2e5cb19f4f | |
|
51ca5ef6f4 | |
|
e2e943749e | |
|
013fe5809d | |
|
7f45b28116 | |
|
d3f2444521 | |
|
2695602972 | |
|
eb5960822e | |
|
620decf638 | |
|
bfa5391ae1 | |
|
3629d522bb | |
|
d2462e6456 | |
|
d2b29e6323 | |
|
afdcc48a42 | |
|
74739614e5 | |
|
dc4f5bbdcb | |
|
9e1f941be5 | |
|
689a630024 | |
|
8ac2d539f4 | |
|
75f8da414d | |
|
6903066127 | |
|
c5de9a5bed | |
|
edb3e74824 | |
|
2430d10401 | |
|
929275fd5a | |
|
802cd54947 | |
|
a00e5345b4 | |
|
3c1b78218e | |
|
849d5328ac | |
|
152296d63a | |
|
30560b90cf | |
|
0be090d11b | |
|
b29363a31a | |
|
3b35565404 | |
|
846a03f75c | |
|
542a656dc6 | |
|
832da812c3 | |
|
a834f9d1bd | |
|
960d68f72e | |
|
2c5387f048 | |
|
f57deada17 | |
|
eade0c66ea | |
|
ef0311d362 | |
|
0a2fc7a9ce | |
|
98560aacdc | |
|
4e1790a47c | |
|
d02813f7e4 | |
|
0e391451b0 | |
|
f56787b5a8 | |
|
7033d0e9dd | |
|
84b54e9116 | |
|
5bb0737c82 | |
|
d1440fb706 | |
|
3ed255fe1e | |
|
1d91e51199 |
|
@ -34,7 +34,7 @@ public class TokenController {
|
|||
@PostMapping("login")
|
||||
public Result<?> login (@RequestBody LoginBody form) {
|
||||
// 用户登录
|
||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
|
||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),form.getFirmId());
|
||||
// 获取登录token
|
||||
return Result.success(tokenService.createToken(userInfo));
|
||||
}
|
||||
|
|
|
@ -1,10 +1,19 @@
|
|||
package com.muyu.auth.form;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 用户登录对象
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LoginBody {
|
||||
/**
|
||||
* 用户名
|
||||
|
@ -16,19 +25,9 @@ public class LoginBody {
|
|||
*/
|
||||
private String password;
|
||||
|
||||
public String getUsername () {
|
||||
return username;
|
||||
}
|
||||
/**
|
||||
* 公司Id
|
||||
*/
|
||||
private Long firmId;
|
||||
|
||||
public void setUsername (String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword () {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword (String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,14 +37,15 @@ public class SysLoginService {
|
|||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
public LoginUser login (String username, String password) {
|
||||
public LoginUser login (String username, String password, Long firmId) {
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isAnyBlank(username, password)) {
|
||||
if (StringUtils.isAnyBlank(username, password,String.valueOf(firmId))) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
|
||||
throw new ServiceException("用户/密码必须填写");
|
||||
throw new ServiceException("用户/密码/公司 必须填写");
|
||||
}
|
||||
// 密码如果不在指定范围内 错误
|
||||
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
||||
|
@ -60,12 +61,21 @@ public class SysLoginService {
|
|||
}
|
||||
// IP黑名单校验
|
||||
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
|
||||
|
||||
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "很遗憾,访问IP已被列入系统黑名单");
|
||||
throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
|
||||
}
|
||||
// 查询用户信息
|
||||
Result<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
||||
|
||||
Result<LoginUser> userResult = null;
|
||||
|
||||
if (firmId == 1){
|
||||
userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
||||
}else {
|
||||
userResult = remoteUserService.getFirmUserInfo(username, firmId,SecurityConstants.INNER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
server:
|
||||
port: 9500
|
||||
|
||||
# nacos线上地址
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 47.101.49.53:8848
|
||||
|
|
|
@ -16,6 +16,11 @@ public class ServiceNameConstants {
|
|||
*/
|
||||
public static final String SYSTEM_SERVICE = "cloud-system";
|
||||
|
||||
/**
|
||||
* 系统模块的serviceid
|
||||
*/
|
||||
public static final String ENTERPRISE_SERVICE = "cloud-car";
|
||||
|
||||
/**
|
||||
* 文件服务的serviceid
|
||||
*/
|
||||
|
|
|
@ -151,6 +151,17 @@ public class JwtUtils {
|
|||
return getValue(claims, SecurityConstants.DETAILS_USERNAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据身份信息获取用户名
|
||||
*
|
||||
* @param claims 身份信息
|
||||
*
|
||||
* @return 用户名
|
||||
*/
|
||||
public static String getDatabaseName (Claims claims) {
|
||||
return getValue(claims, SecurityConstants.DATABASE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据身份信息获取键值
|
||||
*
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
<artifactId>cloud-common-rabbit</artifactId>
|
||||
|
||||
<description>
|
||||
cloud-common-rabbit 模块,提供RabbitMq消息队列的相关配置
|
||||
</description>
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package com.muyu.common.rabbit;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ Description:Mqtt的配置
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MqttProperties implements Serializable{
|
||||
/**
|
||||
* 节点
|
||||
*/
|
||||
private String broker;
|
||||
/**
|
||||
* 主题
|
||||
*/
|
||||
private String topic;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* 客户端id
|
||||
*/
|
||||
private String clientId;
|
||||
/**
|
||||
* 上报级别
|
||||
*/
|
||||
private int qos = 0;
|
||||
}
|
|
@ -6,6 +6,7 @@ import org.springframework.data.redis.core.HashOperations;
|
|||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -17,6 +18,7 @@ import java.util.concurrent.TimeUnit;
|
|||
**/
|
||||
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
||||
@Component
|
||||
//@Service
|
||||
public class RedisService {
|
||||
@Autowired
|
||||
public RedisTemplate redisTemplate;
|
||||
|
|
|
@ -9,9 +9,12 @@ import com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory;
|
|||
import com.muyu.cloud.common.many.datasource.role.DynamicDataSource;
|
||||
import com.muyu.cloud.common.saas.domain.model.EntInfo;
|
||||
import com.muyu.cloud.common.saas.exception.SaaSException;
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.SpringUtils;
|
||||
import com.muyu.common.system.domain.SysFirm;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.domain.resp.SysFirmResp;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
|
@ -20,6 +23,7 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -36,22 +40,25 @@ import java.util.Map;
|
|||
@AutoConfiguration(before = MybatisPlusAutoConfiguration.class)
|
||||
public class ManyDataSource implements ApplicationRunner{
|
||||
|
||||
|
||||
private List<EntInfo> dataSourceInfoList(){
|
||||
RemoteUserService remoteUserService = SpringUtils.getBean(RemoteUserService.class);
|
||||
Result<List<SysUser>> tableDataInfoResult = remoteUserService.companyList();
|
||||
if (tableDataInfoResult==null){
|
||||
Result<List<SysFirmResp>> firmList = remoteUserService.getFirmList(SecurityConstants.INNER);
|
||||
if (firmList==null) {
|
||||
throw new SaaSException("saas远调数据源错误");
|
||||
}
|
||||
List<SysUser> data = tableDataInfoResult.getData();
|
||||
if (tableDataInfoResult.getCode() == Result.SUCCESS && data !=null){
|
||||
|
||||
List<SysFirmResp> data = firmList.getData();
|
||||
if (firmList.getCode() == Result.SUCCESS && data !=null){
|
||||
List<EntInfo> list = new ArrayList<>();
|
||||
for (SysUser row : data) {
|
||||
for (SysFirmResp row : data) {
|
||||
list.add(
|
||||
EntInfo.builder()
|
||||
.entCode(row.getDatabaseName())
|
||||
.ip(DatasourceContent.IP)
|
||||
.port(DatasourceContent.PORT)
|
||||
.url(row.getSysFirmDatasource().getUrl())
|
||||
.entCode(row.getSysFirmDatasource().getDatabase())
|
||||
.ip(row.getSysFirmDatasource().getIp())
|
||||
.port(row.getSysFirmDatasource().getPort())
|
||||
.password(row.getSysFirmDatasource().getPassword())
|
||||
.username(row.getSysFirmDatasource().getUsername())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
@ -79,7 +86,7 @@ public class ManyDataSource implements ApplicationRunner{
|
|||
Map<Object, Object> dataSourceMap = new HashMap<>();
|
||||
dataSourceInfoList()
|
||||
.stream()
|
||||
.map(entInfo -> DataSourceInfo.hostAndPortBuild(entInfo.getEntCode(), entInfo.getIp(), entInfo.getPort()))
|
||||
.map(entInfo -> DataSourceInfo.hostAndPortBuild(entInfo))
|
||||
.forEach(dataSourceInfo -> {
|
||||
dataSourceMap.put(dataSourceInfo.getKey(), druidDataSourceFactory.create(dataSourceInfo));
|
||||
});
|
||||
|
@ -98,7 +105,7 @@ public class ManyDataSource implements ApplicationRunner{
|
|||
DynamicDataSource dynamicDataSource = SpringUtils.getBean(DynamicDataSource.class);
|
||||
for (EntInfo entInfo : dataSourceInfoList()) {
|
||||
DataSourceInfo dataSourceInfo = DataSourceInfo.hostAndPortBuild(
|
||||
entInfo.getEntCode(), entInfo.getIp(), entInfo.getPort()
|
||||
entInfo
|
||||
);
|
||||
DruidDataSource druidDataSource = druidDataSourceFactory.create(dataSourceInfo);
|
||||
dynamicDataSource.put(dataSourceInfo.getKey(), druidDataSource);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.muyu.cloud.common.many.datasource.domain.model;
|
||||
|
||||
import com.muyu.cloud.common.many.datasource.constents.DatasourceContent;
|
||||
import com.muyu.cloud.common.saas.domain.model.EntInfo;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.system.domain.SysFirmDatasource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -39,12 +41,12 @@ public class DataSourceInfo {
|
|||
private String password;
|
||||
|
||||
|
||||
public static DataSourceInfo hostAndPortBuild(String key, String host, Integer port) {
|
||||
public static DataSourceInfo hostAndPortBuild(EntInfo entInfo) {
|
||||
return DataSourceInfo.builder()
|
||||
.key(key)
|
||||
.url(StringUtils.format(DatasourceContent.DATASOURCE_URL, host, port, key))
|
||||
.password(DatasourceContent.PASSWORD)
|
||||
.userName(DatasourceContent.USER_NAME)
|
||||
.key(entInfo.getEntCode())
|
||||
.url(StringUtils.format(entInfo.getUrl(), entInfo.getIp(), entInfo.getPort(), entInfo.getEntCode()))
|
||||
.password(entInfo.getUsername())
|
||||
.userName(entInfo.getPassword())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,13 @@ public class EntInfo {
|
|||
|
||||
private String entCode;
|
||||
|
||||
private String url;
|
||||
|
||||
private String ip;
|
||||
|
||||
private Integer port;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
com.muyu.cloud.common.many.datasource.ManyDataSource
|
||||
com.muyu.cloud.common.many.datasource.role.DynamicDataSource
|
||||
com.muyu.cloud.common.saas.interceptor.WebMvcSaaSConfig
|
||||
com.muyu.cloud.common.saas.interceptor.SaaSInterceptor
|
|
@ -56,7 +56,7 @@ public class TokenService {
|
|||
claimsMap.put(SecurityConstants.USER_KEY, token);
|
||||
claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId);
|
||||
claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName);
|
||||
claimsMap.put(SecurityConstants.DATABASE_NAME, loginUser.getSysUser().getDatabaseName());
|
||||
claimsMap.put(SecurityConstants.DATABASE_NAME, loginUser.getSysUser().getDatabase());
|
||||
// 接口返回信息
|
||||
Map<String, Object> rspMap = new HashMap<String, Object>();
|
||||
rspMap.put("access_token", JwtUtils.createToken(claimsMap));
|
||||
|
|
|
@ -63,4 +63,5 @@ public class LoginUser implements Serializable {
|
|||
*/
|
||||
private SysUser sysUser;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -78,6 +78,10 @@ public class SysDept extends BaseEntity {
|
|||
* 父部门名称
|
||||
*/
|
||||
private String parentName;
|
||||
/**
|
||||
* 公司Id
|
||||
*/
|
||||
private Long firmId;
|
||||
|
||||
/**
|
||||
* 子部门
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.common.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:杨鹏
|
||||
* @Package:com.muyu.system.domain
|
||||
* @Project:cloud-vehicle
|
||||
* @name:SysFirm
|
||||
* @Date:2024/10/8 19:41
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("sys_firm")
|
||||
public class SysFirm {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer firmId;
|
||||
private String firmName;
|
||||
private String firmCode;
|
||||
private Integer datasourceId;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.common.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:杨鹏
|
||||
* @Package:com.muyu.system.domain
|
||||
* @Project:cloud-vehicle
|
||||
* @name:SysFirmDatasource
|
||||
* @Date:2024/10/8 19:44
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("sys_firm_datasource")
|
||||
public class SysFirmDatasource {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String url;
|
||||
private String ip;
|
||||
private Integer port;
|
||||
private String database;
|
||||
private String username;
|
||||
private String password;
|
||||
}
|
|
@ -55,6 +55,11 @@ public class SysUser extends BaseEntity {
|
|||
@Excel(name = "用户名称")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
|
@ -106,6 +111,9 @@ public class SysUser extends BaseEntity {
|
|||
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||
private Date loginDate;
|
||||
|
||||
|
||||
private String database;
|
||||
|
||||
/**
|
||||
* 部门对象
|
||||
*/
|
||||
|
@ -136,10 +144,10 @@ public class SysUser extends BaseEntity {
|
|||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 数据库名称
|
||||
* 公司Id
|
||||
* @param userId
|
||||
*/
|
||||
private String databaseName;
|
||||
private String firmId;
|
||||
|
||||
|
||||
public SysUser (Long userId) {
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.common.system.domain.resp;
|
||||
|
||||
import com.muyu.common.system.domain.SysFirm;
|
||||
import com.muyu.common.system.domain.SysFirmDatasource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:杨鹏
|
||||
* @Package:com.muyu.common.system.domain
|
||||
* @Project:cloud-vehicle
|
||||
* @name:SysFirmDTO
|
||||
* @Date:2024/10/8 20:23
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SysFirmResp {
|
||||
/**
|
||||
* 公司信息
|
||||
*/
|
||||
private SysFirm sysFirm;
|
||||
/**
|
||||
* 公司数据源信息
|
||||
*/
|
||||
private SysFirmDatasource sysFirmDatasource;
|
||||
}
|
|
@ -3,7 +3,9 @@ package com.muyu.common.system.remote;
|
|||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysFirm;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.domain.resp.SysFirmResp;
|
||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
@ -40,6 +42,8 @@ public interface RemoteUserService {
|
|||
@PostMapping("/user/register")
|
||||
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
@GetMapping("/user/companyList")
|
||||
public Result<List<SysUser>> companyList ();
|
||||
@GetMapping("/firm/firmInnList")
|
||||
Result<List<SysFirmResp>> getFirmList(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
@GetMapping("/user/firmUserInfo/{username}/{firmId}")
|
||||
Result<LoginUser> getFirmUserInfo(@PathVariable("username") String username,@PathVariable("firmId") Long firmId,@RequestHeader(SecurityConstants.FROM_SOURCE) String inner);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.common.system.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.resp.SysFirmResp;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
|
@ -33,9 +34,15 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<SysUser>> companyList() {
|
||||
return Result.error("saas连接system失败:" + throwable.getMessage());
|
||||
public Result<List<SysFirmResp>> getFirmList(String source) {
|
||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<LoginUser> getFirmUserInfo(String username, Long firmId, String inner) {
|
||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ public class AuthFilter implements GlobalFilter, Ordered {
|
|||
addHeader(mutate, SecurityConstants.USER_KEY, userkey);
|
||||
addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid);
|
||||
addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username);
|
||||
addHeader(mutate,SecurityConstants.DATABASE_NAME, JwtUtils.getDatabaseName(claims));
|
||||
// 内部请求来源参数清除
|
||||
removeHeader(mutate, SecurityConstants.FROM_SOURCE);
|
||||
return chain.filter(exchange.mutate().request(mutate.build()).build());
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
server:
|
||||
port: 8080
|
||||
|
||||
# nacos线上地址
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 47.101.49.53:8848
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.Fence;
|
||||
import com.muyu.domain.req.FenceReq;
|
||||
import com.muyu.domain.resp.FenceResp;
|
||||
|
||||
/**
|
||||
* 所有电子围栏缓存
|
||||
*/
|
||||
public class AllFenceCahceService extends CacheAbsBacis<String, FenceResp> {
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "AllFence:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("AllFence:info:", "");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.BoundMiddle;
|
||||
import com.muyu.domain.resp.BoundFenceGroup;
|
||||
import com.muyu.domain.resp.FenceResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 所有电子围栏缓存
|
||||
*/
|
||||
public class AllFenceGroupCahceService extends CacheAbsBacis<String, List<BoundFenceGroup>> {
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "AllFenceGroup:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("AllFenceGroup:info:", "");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.MessageTemplate;
|
||||
import com.muyu.domain.MessageValue;
|
||||
import com.muyu.domain.req.MessageValueReq;
|
||||
import com.muyu.domain.resp.MessageValueListResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报文模版缓存
|
||||
*/
|
||||
public class AllMessageValueCacheService extends CacheAbsBacis<String, List<MessageValueListResp>> {
|
||||
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "AllMessagevalue:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("AllMessagevalue:info:", "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.domain.req.VehicleAddReq;
|
||||
import com.muyu.domain.req.VehicleManageReq;
|
||||
import com.muyu.domain.resp.VehicleManageResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 所有车辆缓存
|
||||
*/
|
||||
public class AllVehicleCacheService extends CacheAbsBacis<String, VehicleManageResp> {
|
||||
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存key前缀
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "AllVehicle:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("AllVehicle:info:", "");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.VehicleType;
|
||||
|
||||
/**
|
||||
* 所有车辆类型缓存
|
||||
*/
|
||||
public class AllVehicleTypeCacheService extends CacheAbsBacis<String, VehicleType> {
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "AllVehicleType:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("AllVehicleType:info:", "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.WarnRule;
|
||||
|
||||
/**
|
||||
* 预警规则缓存服务
|
||||
*/
|
||||
public class AllWarnRuleCacheService extends CacheAbsBacis<String, WarnRule> {
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "AllWarnRule:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("AllWarnRule:info:", "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||
import com.muyu.domain.resp.WarnVehicleResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 预警策略缓存服务
|
||||
*/
|
||||
public class AllWarnStrategyAndVinCacheService extends CacheAbsBacis<String, WarnStrategyAndVinResp> {
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "AllWarnStrategy:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("AllWarnStrategy:info:", "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.WarnStrategy;
|
||||
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||
import com.muyu.domain.resp.WarnVehicleResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 预警策略缓存服务
|
||||
*/
|
||||
public class AllWarnStrategyCacheService extends CacheAbsBacis<String, WarnVehicleResp> {
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "AllWarnStrategy:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("AllWarnStrategy:info:", "");
|
||||
}
|
||||
}
|
|
@ -2,6 +2,9 @@ package com.muyu.enterprise.cache;
|
|||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.Fence;
|
||||
import com.muyu.domain.resp.FenceResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子围栏缓存
|
||||
|
@ -21,4 +24,5 @@ public class FenceCahceService extends CacheAbsBacis<String, Fence> {
|
|||
public String decode(String key) {
|
||||
return key.replace("fence:info:", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.Fence;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||
import com.muyu.domain.req.FenceGroupAddReq;
|
||||
|
||||
/**
|
||||
* 电子围栏缓存
|
||||
*/
|
||||
public class FenceGroupCahceService extends CacheAbsBacis<String, BoundFenceGroupReq> {
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "fenceGroup:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("fenceGroup:info:", "");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.MessageTemplate;
|
||||
|
||||
/**
|
||||
* 报文模版缓存
|
||||
*/
|
||||
public class MessageTemplateCacheService extends CacheAbsBacis<String, MessageTemplate> {
|
||||
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "messageTemplate:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("messageTemplate:info:", "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.MessageValue;
|
||||
|
||||
/**
|
||||
* 报文模版缓存
|
||||
*/
|
||||
public class MessageValueCacheService extends CacheAbsBacis<String, MessageValue> {
|
||||
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "messagevalue:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("messagevalue:info:", "");
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import com.muyu.common.cache.CacheAbsBacis;
|
|||
import com.muyu.domain.Vehicle;
|
||||
|
||||
/**
|
||||
* 车辆缓存
|
||||
* 添加车辆缓存
|
||||
*/
|
||||
public class VehicleCacheService extends CacheAbsBacis<String, Vehicle> {
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.VehicleType;
|
||||
|
||||
/**
|
||||
* 故障缓存服务
|
||||
* 车辆类型
|
||||
*/
|
||||
public class FaultCacheService extends CacheAbsBacis {
|
||||
public class VehicleTypeCacheService extends CacheAbsBacis<String, VehicleType> {
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
|
@ -13,11 +14,11 @@ public class FaultCacheService extends CacheAbsBacis {
|
|||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "fault:info:";
|
||||
return "vehicleType:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("fault:info:", "");
|
||||
return key.replace("vehicleType:info:", "");
|
||||
}
|
||||
}
|
|
@ -14,11 +14,11 @@ public class WarnRuleCacheService extends CacheAbsBacis<String, WarnRule> {
|
|||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "warn:info:";
|
||||
return "warnRule:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("warn:info:", "");
|
||||
return key.replace("warnRule:info:", "");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,12 @@ package com.muyu.enterprise.cache;
|
|||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.WarnRule;
|
||||
import com.muyu.domain.WarnStrategy;
|
||||
import com.muyu.domain.resp.WarnRuleResp;
|
||||
|
||||
/**
|
||||
* 预警规则缓存服务
|
||||
* 预警策略缓存服务
|
||||
*/
|
||||
public class WarnStrategyCacheService extends CacheAbsBacis<String, WarnStrategy> {
|
||||
public class WarnStrategyCacheService extends CacheAbsBacis<String, WarnRuleResp> {
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
|
@ -15,11 +16,11 @@ public class WarnStrategyCacheService extends CacheAbsBacis<String, WarnStrategy
|
|||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "warn:info:";
|
||||
return "warnStrategy:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("warn:info:", "");
|
||||
return key.replace("warnStrategy:info:", "");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
com.muyu.enterprise.cache.VehicleCacheService
|
||||
com.muyu.enterprise.cache.FaultCacheService
|
||||
com.muyu.enterprise.cache.AllFenceCahceService
|
||||
com.muyu.enterprise.cache.AllFenceGroupCahceService
|
||||
com.muyu.enterprise.cache.AllMessageValueCacheService
|
||||
com.muyu.enterprise.cache.AllVehicleCacheService
|
||||
com.muyu.enterprise.cache.AllVehicleTypeCacheService
|
||||
com.muyu.enterprise.cache.AllWarnRuleCacheService
|
||||
com.muyu.enterprise.cache.AllWarnStrategyAndVinCacheService
|
||||
com.muyu.enterprise.cache.AllWarnStrategyCacheService
|
||||
com.muyu.enterprise.cache.FenceCahceService
|
||||
com.muyu.enterprise.cache.FenceGroupCahceService
|
||||
com.muyu.enterprise.cache.MessageTemplateCacheService
|
||||
com.muyu.enterprise.cache.MessageValueCacheService
|
||||
com.muyu.enterprise.cache.VehicleCacheService
|
||||
com.muyu.enterprise.cache.VehicleTypeCacheService
|
||||
com.muyu.enterprise.cache.WarnRuleCacheService
|
||||
com.muyu.enterprise.cache.WarnStrategyCacheService
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:2112-car-cloud-server
|
||||
* @Package:com.muyu.fault.domain
|
||||
* @Filename:Custom
|
||||
* @Description TODO
|
||||
* @Date:2024/9/21 19:15
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName(value = "custom")
|
||||
public class Custom {
|
||||
@TableId(value = "c_id", type = IdType.AUTO)
|
||||
private Integer cId;
|
||||
@Excel(name = "值")
|
||||
private String customName;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 故障信息
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "fault", description = "故障信息")
|
||||
public class Fault extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "fault_id")
|
||||
@Schema(description = "主键",type = "Integer")
|
||||
private Long faultId;
|
||||
|
||||
/**
|
||||
* 故障类别
|
||||
*/
|
||||
@Schema(description = "故障类别",type = "String")
|
||||
private String faultType;
|
||||
|
||||
/**
|
||||
* 故障规则(判定方式)
|
||||
*/
|
||||
@Schema(description = "故障规则(判定方式)",type = "String")
|
||||
private String faultCustom;
|
||||
|
||||
/**
|
||||
* 报文外键
|
||||
*/
|
||||
@Schema(description = "报文外键",type = "Integer")
|
||||
private Integer messageId;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:2112-car-cloud-server
|
||||
* @Package:com.muyu.fault.domain
|
||||
* @Filename:FaultConstant
|
||||
* @Description TODO
|
||||
* @Date:2024/9/19 14:33
|
||||
*/
|
||||
public class FaultConstant {
|
||||
/**
|
||||
* 故障信息存储
|
||||
*/
|
||||
public static final String FAULT_INFO_PREFIX = "fault:";
|
||||
|
||||
/**
|
||||
* 故障信息集合
|
||||
*/
|
||||
public static final String FAULT_LIST = "fault_list";
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 故障规则表
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName(value = "fault_rule", autoResultMap = true)
|
||||
public class FaultRule {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "fault_rule_id")
|
||||
private Long faultRuleId;
|
||||
private Long vehicleTypeId;
|
||||
private Long messageValueId;
|
||||
private String faultCondition;
|
||||
private Double triggerValue;
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:杨鹏
|
||||
* @Package:com.muyu.domain
|
||||
* @Project:cloud-vehicle
|
||||
* @name:FirmUser
|
||||
* @Date:2024/10/8 18:59
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("sys_user")
|
||||
@Tag(name = "企业用户")
|
||||
public class FirmUser extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(name = "用户ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long userId;
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@Schema(name = "部门ID")
|
||||
private Long deptId;
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
@Schema(name = "用户账号")
|
||||
private String userName;
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Schema(name = "用户昵称")
|
||||
private String nickName;
|
||||
/**
|
||||
* 用户类型(00系统用户)
|
||||
*/
|
||||
@Schema(name = "用户类型(00系统用户)")
|
||||
private String userType;
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
@Schema(name = "用户邮箱")
|
||||
private String email;
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@Schema(name = "手机号码")
|
||||
private String phonenumber;
|
||||
/**
|
||||
* 用户性别(0男 1女 2未知)
|
||||
*/
|
||||
@Schema(name = "用户性别(0男 1女 2未知)")
|
||||
private String sex;
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
@Schema(name = "头像地址")
|
||||
private String avatar;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@Schema(name = "密码")
|
||||
private String password;
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
@Schema(name = "帐号状态(0正常 1停用)")
|
||||
private String status;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
@Schema(name = "删除标志(0代表存在 2代表删除)")
|
||||
private String delFlag;
|
||||
/**
|
||||
* 最后登录IP
|
||||
*/
|
||||
@Schema(name = "最后登录IP")
|
||||
private String loginIp;
|
||||
/**
|
||||
* 最后登录时间
|
||||
*/
|
||||
@Schema(name = "最后登录时间")
|
||||
private Date loginDate;
|
||||
|
||||
public static FirmUser builderFirmUser(SysUser sysUser) {
|
||||
return FirmUser.builder()
|
||||
.userId(sysUser.getUserId())
|
||||
.deptId(sysUser.getDeptId())
|
||||
.userType(sysUser.getUserType())
|
||||
.userName(sysUser.getUserName())
|
||||
.nickName(sysUser.getNickName())
|
||||
.email(sysUser.getEmail())
|
||||
.phonenumber(sysUser.getPhonenumber())
|
||||
.sex(sysUser.getSex())
|
||||
.avatar(sysUser.getAvatar())
|
||||
.password(sysUser.getPassword())
|
||||
.status(sysUser.getStatus())
|
||||
.delFlag(sysUser.getDelFlag())
|
||||
.loginIp(sysUser.getLoginIp())
|
||||
.loginDate(sysUser.getLoginDate())
|
||||
.createBy(sysUser.getCreateBy())
|
||||
.createTime(sysUser.getCreateTime())
|
||||
.updateBy(sysUser.getUpdateBy())
|
||||
.updateTime(sysUser.getUpdateTime())
|
||||
.remark(sysUser.getRemark())
|
||||
.build();
|
||||
}
|
||||
public static SysUser builderSysUser(FirmUser sysUser) {
|
||||
return SysUser.builder()
|
||||
.userId(sysUser.getUserId())
|
||||
.deptId(sysUser.getDeptId())
|
||||
.userName(sysUser.getUserName())
|
||||
.userType(sysUser.getUserType())
|
||||
.nickName(sysUser.getNickName())
|
||||
.email(sysUser.getEmail())
|
||||
.phonenumber(sysUser.getPhonenumber())
|
||||
.sex(sysUser.getSex())
|
||||
.avatar(sysUser.getAvatar())
|
||||
.password(sysUser.getPassword())
|
||||
.status(sysUser.getStatus())
|
||||
.delFlag(sysUser.getDelFlag())
|
||||
.loginIp(sysUser.getLoginIp())
|
||||
.loginDate(sysUser.getLoginDate())
|
||||
.createBy(sysUser.getCreateBy())
|
||||
.createTime(sysUser.getCreateTime())
|
||||
.updateBy(sysUser.getUpdateBy())
|
||||
.updateTime(sysUser.getUpdateTime())
|
||||
.remark(sysUser.getRemark())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -12,12 +12,7 @@ import lombok.NoArgsConstructor;
|
|||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author: LiDongJia
|
||||
* @Package: com.muyu.car.domain
|
||||
* @Project: 2112-car-cloud-server
|
||||
* @name: MessageTemplate
|
||||
* @Date: 2024/9/18 21:11
|
||||
* @Description: 报文模版
|
||||
* 报文模版
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
|
|
|
@ -119,6 +119,17 @@ public class Vehicle extends BaseEntity {
|
|||
@Schema(type = "Integer",description = "电子围栏外键")
|
||||
private Integer fenceGroupId;
|
||||
|
||||
/** 策略id */
|
||||
@Schema(type = "Long",description = "策略id")
|
||||
private Long warnStrategyId;
|
||||
|
||||
|
||||
/** 故障id */
|
||||
@Schema(type = "Long",description = "策略id")
|
||||
private Long faultId;
|
||||
|
||||
|
||||
|
||||
public static Vehicle addBuild(VehicleAddReq vehicleAddReq){
|
||||
return Vehicle.builder()
|
||||
.licenceNumber(vehicleAddReq.getLicenceNumber())
|
||||
|
@ -132,6 +143,8 @@ public class Vehicle extends BaseEntity {
|
|||
.vehicleStatus(vehicleAddReq.getVehicleStatus())
|
||||
.companyId(vehicleAddReq.getCompanyId())
|
||||
.fenceGroupId(vehicleAddReq.getFenceGroupId())
|
||||
.warnStrategyId(vehicleAddReq.getWarnStrategyId())
|
||||
.faultId(vehicleAddReq.getFaultId())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -149,6 +162,8 @@ public class Vehicle extends BaseEntity {
|
|||
.vehicleStatus(vehicleUpdReq.getVehicleStatus())
|
||||
.companyId(vehicleUpdReq.getCompanyId())
|
||||
.fenceGroupId(vehicleUpdReq.getFenceGroupId())
|
||||
.warnStrategyId(vehicleUpdReq.getWarnStrategyId())
|
||||
.faultId(vehicleUpdReq.getFaultId())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,6 @@ package com.muyu.domain;
|
|||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.annotation.Excel.ColumnType;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
@ -44,7 +41,16 @@ public class VehicleType extends BaseEntity {
|
|||
* 报文模版外键
|
||||
*/
|
||||
@Schema(type = "Integer",description = "报文模版外键")
|
||||
private Integer messageTemplateId;
|
||||
private Long messageTemplateId;
|
||||
|
||||
/**
|
||||
* 添加车辆类型
|
||||
*/
|
||||
public static VehicleType addBuilder(VehicleType vehicleType) {
|
||||
return VehicleType.builder().
|
||||
vehicleTypeId(vehicleType.getVehicleTypeId()).
|
||||
vehicleTypeName(vehicleType.getVehicleTypeName()).
|
||||
build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,11 +43,6 @@ public class WarnRule extends BaseEntity{
|
|||
@Excel(name = "规则名称")
|
||||
private String ruleName;
|
||||
|
||||
/** 策略id */
|
||||
@Schema(type = "Integer",description = "策略id")
|
||||
@Excel(name = "策略id")
|
||||
private Integer strategyId;
|
||||
|
||||
/** 报文数据类型id */
|
||||
@Schema(type = "Integer",description = "报文数据类型id")
|
||||
@Excel(name = "报文数据类型id")
|
||||
|
@ -75,11 +70,18 @@ public class WarnRule extends BaseEntity{
|
|||
@Excel(name = "最小值")
|
||||
private Integer minValue;
|
||||
|
||||
/**
|
||||
* 策略外键id
|
||||
*/
|
||||
@Schema(type = "Integer",description = "策略外键id")
|
||||
@Excel(name = "策略外键id")
|
||||
private Integer warnStrategyId;
|
||||
|
||||
|
||||
public static WarnRule updateBuilder(WarnRule warnRule, Supplier<Long> supplier) {
|
||||
return WarnRule.builder()
|
||||
.warnRuleId(supplier.get())
|
||||
.ruleName(warnRule.getRuleName())
|
||||
.strategyId(warnRule.getStrategyId())
|
||||
.msgTypeId(warnRule.getMsgTypeId())
|
||||
.slideTime(warnRule.getSlideTime())
|
||||
.slideFrequency(warnRule.getSlideFrequency())
|
||||
|
@ -94,7 +96,6 @@ public class WarnRule extends BaseEntity{
|
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getWarnRuleId())
|
||||
.append("ruleName", getRuleName())
|
||||
.append("strategyId", getStrategyId())
|
||||
.append("msgTypeId", getMsgTypeId())
|
||||
.append("slideTime", getSlideTime())
|
||||
.append("slideFrequency", getSlideFrequency())
|
||||
|
|
|
@ -51,6 +51,7 @@ public class WarnStrategy extends BaseEntity{
|
|||
private Long vehicleTypeId;
|
||||
|
||||
|
||||
|
||||
public static WarnStrategy updateBuilder(WarnStrategy warnStrategy, Supplier<Long> supplier) {
|
||||
return WarnStrategy.builder()
|
||||
.warnStrategyId(supplier.get())
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.domain.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 绑定围栏组请求参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "绑定围栏组参数")
|
||||
public class BoundFenceGroupReq {
|
||||
|
||||
/**
|
||||
* 车辆Id
|
||||
*/
|
||||
private Long vehicleId;
|
||||
|
||||
/**
|
||||
* 围栏组Ids
|
||||
*/
|
||||
private Long[] fenceGroupIds;
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
//package com.muyu.domain.req;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.annotation.IdType;
|
||||
//import com.baomidou.mybatisplus.annotation.TableId;
|
||||
//import com.muyu.domain.Fence;
|
||||
//import io.swagger.v3.oas.annotations.media.Schema;
|
||||
//import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import lombok.Builder;
|
||||
//import lombok.Data;
|
||||
//import lombok.NoArgsConstructor;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//@Data
|
||||
//@Builder
|
||||
//@AllArgsConstructor
|
||||
//@NoArgsConstructor
|
||||
//@Tag(name = "查看绑定的围栏信息")
|
||||
//public class HaveFence {
|
||||
//
|
||||
// /**
|
||||
// * 主键
|
||||
// */
|
||||
// @Schema(type = "Long",description = "主键")
|
||||
// @TableId(value = "id",type = IdType.AUTO)
|
||||
// private Long id;
|
||||
//
|
||||
// /**
|
||||
// * 围栏名称
|
||||
// */
|
||||
// @Schema(type = "String",description = "围栏名称")
|
||||
// private String fenceName;
|
||||
//
|
||||
// /**
|
||||
// * 坐标
|
||||
// */
|
||||
// @Schema(type = "String",description = "坐标")
|
||||
// private String coordinates;
|
||||
//
|
||||
// /**
|
||||
// * 描述
|
||||
// */
|
||||
// @Schema(type = "String",description = "描述")
|
||||
// private String description;
|
||||
//
|
||||
// /**
|
||||
// * 电子围栏列表
|
||||
// */
|
||||
// @Schema(type = "List<Fence>",description = "电子围栏列表")
|
||||
// List<Fence> fenceList;
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
|
@ -1,5 +1,7 @@
|
|||
package com.muyu.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
@ -94,4 +96,14 @@ public class VehicleAddReq {
|
|||
*/
|
||||
@Schema(title = "电子围栏外键", type = "Integer", defaultValue = "1", description = "电子围栏外键")
|
||||
private Integer fenceGroupId;
|
||||
|
||||
/** 策略id */
|
||||
@Schema(type = "Long",description = "策略id")
|
||||
@TableId( type = IdType.AUTO)
|
||||
private Long warnStrategyId;
|
||||
|
||||
/** 故障id */
|
||||
@Schema(type = "Long",description = "策略id")
|
||||
private Long faultId;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.muyu.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
@ -94,4 +96,14 @@ public class VehicleUpdReq {
|
|||
*/
|
||||
@Schema(title = "电子围栏外键", type = "Integer", defaultValue = "1", description = "电子围栏外键")
|
||||
private Integer fenceGroupId;
|
||||
|
||||
/** 策略id */
|
||||
@Schema(type = "Long",description = "策略id")
|
||||
@TableId( type = IdType.AUTO)
|
||||
private Long warnStrategyId;
|
||||
|
||||
/** 故障id */
|
||||
@Schema(type = "Long",description = "策略id")
|
||||
private Long faultId;
|
||||
|
||||
}
|
||||
|
|
|
@ -23,4 +23,7 @@ public class WarnVehicleReq {
|
|||
@Excel(name = "策略名称")
|
||||
private String strategyName;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.muyu.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Tag(name = "车辆绑定的围栏组", description = "车辆绑定的围栏组")
|
||||
public class BoundFenceGroup {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "fence_group_id" ,type = IdType.AUTO)
|
||||
@Schema(type = "Long",description = "围栏组id")
|
||||
private Long fenceGroupId;
|
||||
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
@Schema(type = "String",description = "优先级")
|
||||
private String priority;
|
||||
|
||||
/**
|
||||
* 状态 0:启用 1:禁止
|
||||
*/
|
||||
@Schema(type = "Integer",description = "状态 0:启用 1:禁止")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 围栏组类型
|
||||
*/
|
||||
@Schema(type = "String",description = "围栏组类型")
|
||||
private String groupType;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.domain.resp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Builder
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "故障规则列表响应数据")
|
||||
public class FaultRuleResp {
|
||||
|
||||
private Long faultRuleId;
|
||||
|
||||
private String vehicleTypeName;
|
||||
|
||||
private String messageValueName;
|
||||
|
||||
private String faultCondition;
|
||||
|
||||
private Double triggerValue;
|
||||
}
|
|
@ -53,6 +53,12 @@ public class MessageValueListResp {
|
|||
@Schema(type = "Integer",title = "起始下标")
|
||||
private Integer messageStartIndex;
|
||||
|
||||
/**
|
||||
* 报文模版外键
|
||||
*/
|
||||
@Schema(type = "Long",description = "报文模版主键")
|
||||
private Long messageTemplateId;
|
||||
|
||||
/**
|
||||
* 终止下标
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package com.muyu.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: LiDongJia
|
||||
* @Package: com.muyu.domain.resp
|
||||
* @Project: cloud-server
|
||||
* @name: WarnRuleListResp
|
||||
* @Date: 2024/10/10 10:37
|
||||
* @Description: 根据策略id查询规则响应值
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WarnRuleListResp {
|
||||
|
||||
/** 规则id */
|
||||
@Schema(type = "Long",description = "规则id")
|
||||
private Long warnRuleId;
|
||||
|
||||
/** 规则名称 */
|
||||
@Schema(type = "String",description = "规则名称")
|
||||
private String ruleName;
|
||||
|
||||
/** 报文数据类型id */
|
||||
@Schema(type = "Long",description = "报文数据类型id")
|
||||
private Long msgTypeId;
|
||||
|
||||
/** 滑窗时间 */
|
||||
@Schema(type = "Date",description = "滑窗时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date slideTime;
|
||||
|
||||
/** 滑窗频率 */
|
||||
@Schema(type = "Integer",description = "滑窗频率")
|
||||
private Integer slideFrequency;
|
||||
|
||||
/** 最大值 */
|
||||
@Schema(type = "Integer",description = "最大值")
|
||||
private Integer maxValue;
|
||||
|
||||
/** 最小值 */
|
||||
@Schema(type = "Integer",description = "最小值")
|
||||
private Integer minValue;
|
||||
|
||||
/**
|
||||
* 策略外键id
|
||||
*/
|
||||
@Schema(type = "Integer",description = "策略外键id")
|
||||
private Integer warnStrategyId;
|
||||
|
||||
/**
|
||||
* 报文编码
|
||||
*/
|
||||
@Schema(type = "String",description = "报文编码")
|
||||
private String messageCode;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.muyu.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.domain.WarnRule;
|
||||
import com.muyu.domain.WarnStrategy;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Tag(name = "规则列表", description = "规则列表")
|
||||
public class WarnRuleResp {
|
||||
|
||||
/** 策略id */
|
||||
@Schema(type = "Long",description = "策略id")
|
||||
@TableId( type = IdType.AUTO)
|
||||
private Long warnStrategyId;
|
||||
|
||||
/** 策略名称 */
|
||||
@Schema(type = "String",description = "策略名称")
|
||||
@Excel(name = "策略名称")
|
||||
private String strategyName;
|
||||
|
||||
/** 报文模版id */
|
||||
@Schema(type = "Integer",description = "报文模版id")
|
||||
@Excel(name = "报文模版id")
|
||||
private Integer messageTemplateId;
|
||||
|
||||
/** 车辆类型id */
|
||||
@Schema(type = "Long",description = "车辆类型id")
|
||||
@Excel(name = "车辆类型id")
|
||||
private Long vehicleTypeId;
|
||||
|
||||
/** 规则集合 */
|
||||
@Schema(type = "List",description = "规则集合")
|
||||
private List<WarnRuleListResp> warnRuleList;
|
||||
|
||||
public static WarnRuleResp build(WarnStrategy warnStrategy, List<WarnRuleListResp> warnRuleList){
|
||||
return WarnRuleResp.builder()
|
||||
.warnStrategyId(warnStrategy.getWarnStrategyId())
|
||||
.strategyName(warnStrategy.getStrategyName())
|
||||
.messageTemplateId(warnStrategy.getMessageTemplateId())
|
||||
.vehicleTypeId(warnStrategy.getVehicleTypeId())
|
||||
.warnRuleList(warnRuleList)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.muyu.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Tag(name = "WarnStrategyAndVin缓存预警信息获取vin")
|
||||
public class WarnStrategyAndVinResp {
|
||||
|
||||
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
@Schema(type = "String",description = "车辆VIN")
|
||||
@Excel(name = "车辆VIN")
|
||||
private String vehicleVin;
|
||||
|
||||
/**
|
||||
* 策略id
|
||||
*/
|
||||
@Schema(type = "Long",description = "策略id")
|
||||
@TableId( type = IdType.AUTO)
|
||||
private Long warnStrategyId;
|
||||
|
||||
/**
|
||||
* 策略名称
|
||||
*/
|
||||
@Schema(type = "String",description = "策略名称")
|
||||
@Excel(name = "策略名称")
|
||||
private String strategyName;
|
||||
|
||||
/**
|
||||
* 报文模版id
|
||||
*/
|
||||
@Schema(type = "Integer",description = "报文模版id")
|
||||
@Excel(name = "报文模版id")
|
||||
private Integer messageTemplateId;
|
||||
|
||||
/**
|
||||
* 车辆类型id
|
||||
*/
|
||||
@Schema(type = "Long",description = "车辆类型id")
|
||||
@Excel(name = "车辆类型id")
|
||||
private Long vehicleTypeId;
|
||||
|
||||
}
|
|
@ -66,4 +66,13 @@ public class WarnVehicleResp {
|
|||
@Schema(type = "String",description = "报文模版名称")
|
||||
private String messageTemplateName;
|
||||
|
||||
|
||||
/**
|
||||
* 报文模版id
|
||||
*/
|
||||
@Schema(type = "Integer",description = "报文模版id")
|
||||
@Excel(name = "报文模版id")
|
||||
private Integer messageTemplateId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package com.muyu.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:2112-car-cloud-server
|
||||
* @Package:com.muyu.fault.domain
|
||||
* @Filename:Custom
|
||||
* @Description TODO
|
||||
* @Date:2024/9/21 18:39
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName(value = "rule")
|
||||
public class RuleVo {
|
||||
|
||||
@Excel(name = "id")
|
||||
private Long id;
|
||||
|
||||
@Excel(name = "比较类型")
|
||||
private Integer cId;
|
||||
|
||||
|
||||
@Excel(name = "messageId")
|
||||
private Long messageId;
|
||||
|
||||
@Excel(name = "标签")
|
||||
private String messageLabel;
|
||||
|
||||
|
||||
@Excel(name = "车辆id")
|
||||
private Integer carId;
|
||||
|
||||
@Excel(name = "车辆故障类型id")
|
||||
private Integer tId;
|
||||
|
||||
@Excel(name = "参数值")
|
||||
private Integer ruleValue;
|
||||
|
||||
@Excel(name = "标准")
|
||||
private String customName;
|
||||
|
||||
@Excel(name = "故障类型name")
|
||||
private String typeName;
|
||||
|
||||
@Excel(name = "车辆类型name")
|
||||
private String carName;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?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-enterprise</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cloud-modules-enterprise-remote</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>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-enterprise-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.enterprise.remote;
|
||||
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.enterprise.remote.factory.RemoteFirmUserFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
|
||||
/**
|
||||
* @Author:杨鹏
|
||||
* @Package:com.muyu.enterpries.remote
|
||||
* @Project:cloud-vehicle
|
||||
* @name:RemoteFirmUserService
|
||||
* @Date:2024/10/8 19:58
|
||||
*/
|
||||
@FeignClient(contextId = "remoteFirmUserService",
|
||||
value = ServiceNameConstants.ENTERPRISE_SERVICE,
|
||||
fallbackFactory = RemoteFirmUserFallbackFactory.class)
|
||||
public interface RemoteFirmUserService {
|
||||
|
||||
@GetMapping("/firm/query_by_username/{username}")
|
||||
Result<SysUser> queryByUsername(@PathVariable("username") String username,@RequestHeader(SecurityConstants.INNER) String source,@RequestHeader("ent_code") String databaseName);
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.enterprise.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.factory.RemoteFileFallbackFactory;
|
||||
import com.muyu.enterprise.remote.RemoteFirmUserService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author:杨鹏
|
||||
* @Package:com.muyu.enterprise.remote.factory
|
||||
* @Project:cloud-vehicle
|
||||
* @name:RemoteFirmUserFallbackFactory
|
||||
* @Date:2024/10/8 20:01
|
||||
*/
|
||||
@Component
|
||||
@Log4j2
|
||||
public class RemoteFirmUserFallbackFactory implements FallbackFactory<RemoteFirmUserService>
|
||||
{
|
||||
@Override
|
||||
public RemoteFirmUserService create(Throwable cause) {
|
||||
log.error("文件服务调用失败:{}", cause.getMessage());
|
||||
return new RemoteFirmUserService() {
|
||||
@Override
|
||||
public Result<SysUser> queryByUsername(String username, String source,String databaseName) {
|
||||
return Result.error("saas连接失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.enterprise.remote.factory.RemoteFirmUserFallbackFactory
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
<artifactId>cloud-modules-enterprise-server</artifactId>
|
||||
<version>3.6.3</version>
|
||||
|
||||
<!--企业业务平台-->
|
||||
<description>
|
||||
cloud-modules-enterprise-server 企业业务平台
|
||||
|
@ -22,6 +23,12 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.muyu</groupId>-->
|
||||
<!-- <artifactId>cloud-common-saas</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
package com.muyu.enterprise;
|
||||
|
||||
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
@Log4j2
|
||||
@EnableCustomConfig
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
// (
|
||||
// exclude = {
|
||||
// DataSourceAutoConfiguration.class,
|
||||
// DruidDataSourceAutoConfigure.class,
|
||||
// DynamicDataSourceAutoConfiguration.class
|
||||
// })
|
||||
public class CloudEnterpriseApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CloudEnterpriseApplication.class,args);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.enterprise.controller;
|
|||
import com.muyu.common.redis.service.RedisService;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.enterprise.cache.AllFenceCahceService;
|
||||
import com.muyu.enterprise.cache.FenceCahceService;
|
||||
import com.muyu.enterprise.cache.VehicleCacheService;
|
||||
import com.muyu.enterprise.service.ElectService;
|
||||
|
@ -28,7 +29,9 @@ import java.security.Security;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
* 电子围栏信息
|
||||
*/
|
||||
@RequestMapping("/elect")
|
||||
@RestController
|
||||
@Log4j2
|
||||
|
@ -43,6 +46,8 @@ public class ElectController extends BaseController {
|
|||
@Autowired
|
||||
private FenceCahceService fenceCahceService;
|
||||
|
||||
@Autowired
|
||||
private AllFenceCahceService allFenceCahceService;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -54,7 +59,10 @@ public class ElectController extends BaseController {
|
|||
public Result<TableDataInfo<FenceResp>> showList(@RequestBody @Validated FenceReq req) {
|
||||
startPage();
|
||||
List<FenceResp> list = electService.selectFenceList(req);
|
||||
fenceCahceService.get(String.valueOf(req));
|
||||
//将列表存到Redis
|
||||
for (FenceResp fenceResp : list) {
|
||||
allFenceCahceService.put(fenceResp.getCoordinates(),fenceResp);
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -70,9 +78,8 @@ public class ElectController extends BaseController {
|
|||
//获取用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//获取租户唯一标识
|
||||
String databaseName = loginUser.getSysUser().getDatabaseName();
|
||||
//将信息存到Redis
|
||||
fenceCahceService.put(databaseName+fence.getCoordinates(),fence);
|
||||
fenceCahceService.put(fence.getCoordinates(),fence);
|
||||
return Result.success(save?"操作成功":"操作失败");
|
||||
}
|
||||
|
||||
|
@ -140,7 +147,7 @@ public class ElectController extends BaseController {
|
|||
@DeleteMapping("/delMoreFence")
|
||||
@Operation(description = "批量删除电子围栏")
|
||||
public Result delMore(@RequestBody List<Long> fenceIds){
|
||||
// electService.delMoreFence(fenceIds);
|
||||
//批量删除内容存到Redis
|
||||
electService.removeBatchByIds(fenceIds);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
@ -155,5 +162,4 @@ public class ElectController extends BaseController {
|
|||
return Result.success(fences);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import cn.hutool.db.Page;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.domain.Fault;
|
||||
import com.muyu.domain.req.MiddleReq;
|
||||
import com.muyu.enterprise.service.FaultService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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 java.util.List;
|
||||
|
||||
import static com.muyu.common.core.utils.PageUtils.startPage;
|
||||
|
||||
/**
|
||||
* 故障信息
|
||||
*/
|
||||
@RequestMapping("/fault")
|
||||
@RestController
|
||||
@Log4j2
|
||||
@Tag(name = "故障信息",description = "电子围栏信息展示")
|
||||
public class FaultController {
|
||||
|
||||
@Autowired
|
||||
private FaultService faultService;
|
||||
|
||||
/**
|
||||
* 获取故障列表
|
||||
* @param fault
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
@Operation(description = "获取故障列表")
|
||||
public Result<List<Fault>> list(@RequestBody @Validated Fault fault) {
|
||||
List<Fault> list = faultService.list();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加故障信息
|
||||
*/
|
||||
@RequestMapping("/add")
|
||||
@Operation(description = "添加故障信息")
|
||||
public Result<String> add(@RequestBody @Validated Fault fault) {
|
||||
faultService.save(fault); //保存故障信息
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改故障信息
|
||||
*/
|
||||
@RequestMapping("/{id}")
|
||||
@Operation(description = "修改故障信息") //修改故障信息
|
||||
public Result<String> edit(@PathVariable Integer faultId,
|
||||
@Validated @RequestBody Fault fault) {
|
||||
faultService.updateById(fault); //修改故障信息
|
||||
return Result.success("修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除故障信息
|
||||
*/
|
||||
@RequestMapping("/delete/{id}")
|
||||
@Operation(description = "删除故障信息") //删除故障信息
|
||||
public Result<String> delete(@PathVariable Integer faultId) {
|
||||
faultService.removeById(faultId); //删除故障信息
|
||||
return Result.success("删除成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.FaultRule;
|
||||
import com.muyu.domain.resp.FaultRuleResp;
|
||||
import com.muyu.enterprise.service.FaultRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 故障规则
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/faultRule")
|
||||
public class FaultRuleController {
|
||||
|
||||
@Autowired
|
||||
private FaultRuleService faultRuleService;
|
||||
|
||||
/**
|
||||
* 故障规则列表
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<List<FaultRuleResp>> list() {
|
||||
List<FaultRuleResp> list = faultRuleService.selectList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param faultRule
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result<String> add(@RequestBody FaultRule faultRule) {
|
||||
faultRuleService.save(faultRule);
|
||||
return Result.success("新增成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param faultRule
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result<String> update(@RequestBody FaultRule faultRule) {
|
||||
faultRuleService.updateById(faultRule);
|
||||
return Result.success("更新成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param faultRuleId
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("delete/{faultRuleId}")
|
||||
public Result<String> delete(@PathVariable("faultRuleId") Long faultRuleId) {
|
||||
faultRuleService.removeById(faultRuleId);
|
||||
return Result.success("删除成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.security.annotation.InnerAuth;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.domain.FirmUser;
|
||||
import com.muyu.enterprise.service.FirmUserService;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author:杨鹏
|
||||
* @Package:com.muyu.enterprise.controller
|
||||
* @Project:cloud-vehicle
|
||||
* @name:SysUserController
|
||||
* @Date:2024/10/8 18:59
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/firm_user")
|
||||
@Tag(name = "企业用户控制层")
|
||||
public class FirmUserController extends BaseController {
|
||||
|
||||
/**
|
||||
* 企业用户业务层
|
||||
*/
|
||||
@Resource
|
||||
private FirmUserService firmUserService;
|
||||
|
||||
/**
|
||||
* 企业用户列表
|
||||
* @return 返回企业用户列表
|
||||
*/
|
||||
@Schema(description = "企业用户列表")
|
||||
@GetMapping("/list")
|
||||
public Result<FirmUser> list(){
|
||||
return success(firmUserService.list());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询企业用户
|
||||
* @param userId 主键
|
||||
* @return 返回用户信息
|
||||
*/
|
||||
@Schema(description = "查询企业用户")
|
||||
@GetMapping("/query/{userId}")
|
||||
public Result<FirmUser> query(@PathVariable("userId") Long userId){
|
||||
return success(firmUserService.getById(userId));
|
||||
}
|
||||
|
||||
@Schema(description = "根据用户名查询企业用户")
|
||||
@GetMapping("/query_by_username/{username}")
|
||||
@InnerAuth
|
||||
public Result<SysUser> queryByUsername(@PathVariable("username") String username){
|
||||
LambdaQueryWrapper<FirmUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(FirmUser::getUserName, username);
|
||||
FirmUser firmUser = firmUserService.getOne(queryWrapper);
|
||||
return success(FirmUser.builderSysUser(firmUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增企业用户
|
||||
* @param sysUser 新增参数
|
||||
* @return 返回新增主键
|
||||
*/
|
||||
@Schema(description = "新增企业用户")
|
||||
@PostMapping("/add")
|
||||
public Result<Long> add(@RequestBody SysUser sysUser){
|
||||
FirmUser firmUser = FirmUser.builderFirmUser(sysUser);
|
||||
firmUserService.save(firmUser);
|
||||
return success(firmUser.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改企业用户
|
||||
* @param sysUser 修改参数
|
||||
* @return
|
||||
*/
|
||||
@Schema(description = "修改企业用户")
|
||||
@PutMapping("/edit")
|
||||
public Result edit(@RequestBody SysUser sysUser){
|
||||
FirmUser firmUser = FirmUser.builderFirmUser(sysUser);
|
||||
firmUserService.updateById(firmUser);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除企业用户
|
||||
* @param userId 主键
|
||||
* @return
|
||||
*/
|
||||
@Schema(description = "删除企业用户")
|
||||
@DeleteMapping("/remove/{userId}")
|
||||
public Result remove(@PathVariable("userId") Long userId){
|
||||
firmUserService.removeById(userId);
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,8 +1,11 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.domain.MessageTemplate;
|
||||
import com.muyu.domain.req.MessageTemplateAddReq;
|
||||
import com.muyu.domain.resp.MessageTemplateListResp;
|
||||
import com.muyu.enterprise.cache.MessageTemplateCacheService;
|
||||
import com.muyu.enterprise.service.MessageTemplateService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -14,12 +17,7 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: LiDongJia
|
||||
* @Package: com.muyu.car.controller
|
||||
* @Project: 2112-car-cloud-server
|
||||
* @name: MessageTypeController
|
||||
* @Date: 2024/9/18 20:18
|
||||
* @Description: 报文模版控制层
|
||||
* 报文模版控制层
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
|
@ -30,6 +28,11 @@ public class MessageTemplateController {
|
|||
@Autowired
|
||||
private MessageTemplateService messageTemplateService;
|
||||
|
||||
//缓存
|
||||
@Autowired
|
||||
private MessageTemplateCacheService templateCacheService;
|
||||
|
||||
|
||||
/**
|
||||
* 报文模版列表查询
|
||||
*1
|
||||
|
@ -55,8 +58,14 @@ public class MessageTemplateController {
|
|||
*/
|
||||
@PostMapping("/")
|
||||
public Result<String> save(@RequestBody MessageTemplateAddReq messageTemplateAddReq) {
|
||||
messageTemplateService.save(MessageTemplate.addBuild(messageTemplateAddReq));
|
||||
return Result.success("添加成功");
|
||||
boolean save = messageTemplateService.save(MessageTemplate.addBuild(messageTemplateAddReq));
|
||||
//获取用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//获取租户唯一标识
|
||||
|
||||
//添加到缓存
|
||||
templateCacheService.put(messageTemplateAddReq.getMessageTemplateName(), MessageTemplate.addBuild(messageTemplateAddReq));
|
||||
return Result.success(save? "新增成功" : "新增失败");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.enterprise.cache.AllMessageValueCacheService;
|
||||
import com.muyu.enterprise.service.MessageValueService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.MessageValue;
|
||||
|
@ -16,12 +17,7 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: LiDongJia
|
||||
* @Package: com.muyu.car.controller
|
||||
* @Project: 2112-car-cloud-server
|
||||
* @name: MessageValueController
|
||||
* @Date: 2024/9/19 15:46
|
||||
* @Description: 报文数据控制层
|
||||
* 报文数据控制层
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
|
@ -32,6 +28,11 @@ public class MessageValueController {
|
|||
@Autowired
|
||||
private MessageValueService messageValueService;
|
||||
|
||||
//存Redis
|
||||
@Autowired
|
||||
private AllMessageValueCacheService allMessageValueCacheService;
|
||||
|
||||
|
||||
/**
|
||||
* 报文数据列表查询
|
||||
*
|
||||
|
@ -42,6 +43,9 @@ public class MessageValueController {
|
|||
@Operation(summary = "报文数据列表", description = "根据报文类别, 报文模版筛选报文数据")
|
||||
public Result<List<MessageValueListResp>> findAll(@RequestBody MessageValueReq messageValueReq) {
|
||||
List<MessageValueListResp> list = messageValueService.findAll(messageValueReq);
|
||||
// for (MessageValueListResp messageValueListResp : list) {
|
||||
// allMessageValueCacheService.put(String.valueOf(messageValueListResp.getMessageTemplateId()), (List<MessageValueListResp>) messageValueListResp);
|
||||
// }
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
@ -93,6 +97,7 @@ public class MessageValueController {
|
|||
@Operation(summary = "根据报文模版id查询报文数据", description = "根据报文模版id查询报文数据")
|
||||
public Result<List<MessageValueListResp>> findByTemplateId(@PathVariable("templateId") Long templateId) {
|
||||
List<MessageValueListResp> list = messageValueService.findByTemplateId(templateId);
|
||||
allMessageValueCacheService.put(String.valueOf(templateId), list);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 中间表Controller
|
||||
*/
|
||||
@Log4j2
|
||||
@RequestMapping("/middle")
|
||||
@RestController
|
||||
|
|
|
@ -1,19 +1,25 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.enterprise.cache.VehicleCacheService;
|
||||
import com.muyu.enterprise.service.VehicleService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.domain.BoundMiddle;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||
import com.muyu.domain.req.VehicleAddReq;
|
||||
import com.muyu.domain.req.VehicleManageReq;
|
||||
import com.muyu.domain.req.VehicleUpdReq;
|
||||
import com.muyu.domain.resp.BoundFenceGroup;
|
||||
import com.muyu.domain.resp.VehicleManageResp;
|
||||
import com.muyu.domain.resp.WarnRuleResp;
|
||||
import com.muyu.enterprise.cache.AllFenceGroupCahceService;
|
||||
import com.muyu.enterprise.cache.FenceGroupCahceService;
|
||||
import com.muyu.enterprise.cache.VehicleCacheService;
|
||||
import com.muyu.enterprise.cache.WarnStrategyCacheService;
|
||||
import com.muyu.enterprise.service.VehicleService;
|
||||
import com.muyu.enterprise.service.WarnStrategyService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
@ -25,12 +31,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: LiDongJia
|
||||
* @Package: com.muyu.car.controller
|
||||
* @Project: 2112-car-cloud-server
|
||||
* @name: VehicleController
|
||||
* @Date: 2024/9/17 17:35
|
||||
* @Description: 车辆管理控制层
|
||||
* 车辆管理控制层
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
|
@ -41,9 +42,20 @@ public class VehicleController extends BaseController {
|
|||
@Autowired
|
||||
private VehicleService vehicleService;
|
||||
|
||||
//车辆缓存
|
||||
//添加车辆缓存
|
||||
@Autowired
|
||||
private VehicleCacheService vehicleCacheService;
|
||||
//缓存策略
|
||||
@Autowired
|
||||
private WarnStrategyService warnStrategyService;
|
||||
@Autowired
|
||||
private WarnStrategyCacheService warnStrategyCacheService;
|
||||
//添加围栏组缓存信息
|
||||
@Autowired
|
||||
private FenceGroupCahceService fenceGroupCahceService;
|
||||
//绑定的围栏组信息
|
||||
@Autowired
|
||||
private AllFenceGroupCahceService allFenceGroupCahceService;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -56,6 +68,22 @@ public class VehicleController extends BaseController {
|
|||
public Result<TableDataInfo<VehicleManageResp>> getVehicleList(@RequestBody VehicleManageReq vehicleManageReq) {
|
||||
startPage();
|
||||
List<VehicleManageResp> list = vehicleService.getVehicleList(vehicleManageReq);
|
||||
|
||||
List<Vehicle> vehicleList = vehicleService.list();
|
||||
vehicleList.forEach(vehicle -> {
|
||||
vehicleCacheService.put(vehicle.getVehicleVin(), vehicle);
|
||||
//根据车辆vin存储策略规则信息
|
||||
if(vehicle.getWarnStrategyId()!=null){
|
||||
WarnRuleResp respList = warnStrategyService.findByWarnStrategyId(vehicle.getWarnStrategyId());
|
||||
warnStrategyCacheService.put(vehicle.getVehicleVin(), respList);
|
||||
}
|
||||
//根据车辆vin存储围栏信息
|
||||
if(vehicle.getFenceGroupId()!=null){
|
||||
//根据外键查询围栏组信息
|
||||
List<BoundFenceGroup> boundMiddles = vehicleService.findByFenceGroupId(vehicle.getVehicleId());
|
||||
allFenceGroupCahceService.put(vehicle.getVehicleVin(), boundMiddles);
|
||||
}
|
||||
});
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -71,10 +99,9 @@ public class VehicleController extends BaseController {
|
|||
boolean save = vehicleService.save(Vehicle.addBuild(vehicleAddReq));
|
||||
//获取用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//获取租户唯一标识
|
||||
String databaseName = loginUser.getSysUser().getDatabaseName();
|
||||
loginUser.getSysUser();
|
||||
//存到redis
|
||||
vehicleCacheService.put(databaseName+vehicleAddReq.getVehicleVin(), Vehicle.addBuild(vehicleAddReq));
|
||||
vehicleCacheService.put(vehicleAddReq.getVehicleVin(), Vehicle.addBuild(vehicleAddReq));
|
||||
return Result.success(save? "新增成功" : "新增失败");
|
||||
}
|
||||
|
||||
|
@ -121,7 +148,6 @@ public class VehicleController extends BaseController {
|
|||
|
||||
/**
|
||||
* 批量删除车辆
|
||||
*
|
||||
* @param vehicleIds
|
||||
* @return
|
||||
*/
|
||||
|
@ -142,11 +168,18 @@ public class VehicleController extends BaseController {
|
|||
/**
|
||||
* 车辆绑定围栏组
|
||||
*/
|
||||
@GetMapping("/addBoundFenceGroup")
|
||||
@PostMapping("/addBoundFenceGroup")
|
||||
@Operation(description = "车辆绑定围栏组")
|
||||
public Result<String> boundFenceGroup(
|
||||
@Validated @RequestBody BoundMiddle boundMiddle){
|
||||
return null;
|
||||
public Result boundFenceGroup(
|
||||
@Validated @RequestBody BoundFenceGroupReq boundFenceGroupReq){
|
||||
vehicleService.boundFenceGroup(boundFenceGroupReq);
|
||||
Vehicle byId = vehicleService.getById(boundFenceGroupReq.getVehicleId());
|
||||
String vehicleVin = byId.getVehicleVin();
|
||||
if(byId!=null){
|
||||
//将围栏组信息存入Redis
|
||||
fenceGroupCahceService.put(vehicleVin, boundFenceGroupReq);
|
||||
}
|
||||
return Result.success("绑定成功");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,4 +193,5 @@ public class VehicleController extends BaseController {
|
|||
Long templateId = vehicleService.findByVehicleVin(vehicleVin);
|
||||
return Result.success(templateId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.domain.MessageValue;
|
||||
import com.muyu.domain.VehicleType;
|
||||
import com.muyu.domain.req.MessageValueAddReq;
|
||||
import com.muyu.domain.req.VehicleAddReq;
|
||||
import com.muyu.enterprise.cache.AllVehicleTypeCacheService;
|
||||
import com.muyu.enterprise.cache.VehicleCacheService;
|
||||
import com.muyu.enterprise.cache.VehicleTypeCacheService;
|
||||
import com.muyu.enterprise.service.VehicleTypeService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: LiDongJia
|
||||
* @Package: com.muyu.car.controller
|
||||
* @Project: 2112-car-cloud-server
|
||||
* @name: VehicleTypeController
|
||||
* @Date: 2024/9/17 17:08
|
||||
* @Description: 车辆类型实体类
|
||||
车辆类型
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
|
@ -30,13 +31,47 @@ public class VehicleTypeController {
|
|||
@Autowired
|
||||
private VehicleTypeService vehicleTypeService;
|
||||
|
||||
@Autowired
|
||||
private VehicleTypeCacheService vehicleTypeCacheService;
|
||||
|
||||
//存缓存
|
||||
@Autowired
|
||||
private AllVehicleTypeCacheService allVehicleTypeCacheService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有车辆类型
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(path = "/", method = RequestMethod.POST)
|
||||
@RequestMapping(path = "/findAll", method = RequestMethod.POST)
|
||||
@Operation(summary = "车辆类型列表",description = "车辆类型列表")
|
||||
public Result<List<VehicleType>> findAll(){
|
||||
return Result.success(vehicleTypeService.list());
|
||||
List<VehicleType> list = vehicleTypeService.list();
|
||||
// for (VehicleType vehicleType : list) {
|
||||
// allVehicleTypeCacheService.put(String.valueOf(vehicleType.getVehicleTypeId()),vehicleType);
|
||||
// }
|
||||
list.forEach(vehicleType -> {
|
||||
vehicleTypeCacheService.put(String.valueOf(vehicleType.getVehicleTypeId()), vehicleType);
|
||||
});
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加车辆类型
|
||||
* @param vehicleType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "添加报文数据", description = "新增报文数据")
|
||||
public Result<String> save(@RequestBody VehicleType vehicleType) {
|
||||
boolean save = vehicleTypeService.save(vehicleType);
|
||||
// //获取用户信息
|
||||
// LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
// //获取租户唯一标识
|
||||
// String databaseName = loginUser.getSysUser().getDatabaseName();
|
||||
//存到redis
|
||||
// vehicleTypeCacheService.put(databaseName+vehicleType.getVehicleTypeId(),vehicleType);
|
||||
vehicleTypeCacheService.put(String.valueOf(vehicleType.getVehicleTypeId()),vehicleType);
|
||||
return Result.success(save? "添加成功" : "添加失败");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 预警日志
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/logs")
|
||||
public class WarnLogsController {
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.muyu.common.core.domain.Result;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.domain.WarnRule;
|
||||
import com.muyu.domain.resp.WarnRuleListResp;
|
||||
import com.muyu.enterprise.cache.AllWarnRuleCacheService;
|
||||
import com.muyu.enterprise.cache.WarnRuleCacheService;
|
||||
import com.muyu.enterprise.service.WarnRuleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -13,6 +15,9 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 预警规则
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rule")
|
||||
public class WarnRuleController {
|
||||
|
@ -22,6 +27,10 @@ public class WarnRuleController {
|
|||
@Autowired
|
||||
private WarnRuleCacheService warnRuleCacheService;
|
||||
|
||||
//存列表
|
||||
@Autowired
|
||||
private AllWarnRuleCacheService allWarnRuleCacheServicel;
|
||||
|
||||
/**
|
||||
* 规则列表
|
||||
* @return
|
||||
|
@ -29,7 +38,11 @@ public class WarnRuleController {
|
|||
@RequestMapping(path = "/ruleList",method = RequestMethod.POST)
|
||||
@Operation(summary = "规则列表", description = "获取所有规则列表")
|
||||
public Result<List<WarnRule>> ruleList(){
|
||||
return Result.success(warnRuleService.list());
|
||||
List<WarnRule> list = warnRuleService.list();
|
||||
for (WarnRule warnRule : list) {
|
||||
allWarnRuleCacheServicel.put(warnRule.getRuleName(),warnRule);
|
||||
}
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,8 +68,7 @@ public class WarnRuleController {
|
|||
//获取用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//获取租户唯一标识
|
||||
String databaseName = loginUser.getSysUser().getDatabaseName();
|
||||
warnRuleCacheService.put(databaseName+warnRule.getRuleName(),warnRule);
|
||||
warnRuleCacheService.put(warnRule.getRuleName(),warnRule);
|
||||
return Result.success(save);
|
||||
}
|
||||
|
||||
|
@ -83,4 +95,13 @@ public class WarnRuleController {
|
|||
return Result.success(warnRuleService.removeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据外键id查询集合
|
||||
*/
|
||||
@GetMapping("/getWarnStrategyList/{warnStrategyId}")
|
||||
@Operation(summary = "根据外键id查询集合", description = "根据外键id查询集合")
|
||||
public Result<List<WarnRuleListResp>> findByWarnStrategyId(@PathVariable("warnStrategyId") Long warnStrategyId) {
|
||||
List<WarnRuleListResp> list = warnRuleService.findBywarnStrategyId(warnStrategyId);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,10 @@ import com.muyu.common.core.domain.Result;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.domain.WarnStrategy;
|
||||
import com.muyu.domain.resp.WarnRuleResp;
|
||||
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||
import com.muyu.enterprise.cache.AllWarnStrategyAndVinCacheService;
|
||||
import com.muyu.enterprise.cache.AllWarnStrategyCacheService;
|
||||
import com.muyu.enterprise.cache.WarnStrategyCacheService;
|
||||
import com.muyu.enterprise.service.WarnStrategyService;
|
||||
import com.muyu.domain.req.WarnVehicleReq;
|
||||
|
@ -15,6 +19,9 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 预警策略
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/strategy")
|
||||
public class WarnStrategyController {
|
||||
|
@ -22,9 +29,11 @@ public class WarnStrategyController {
|
|||
@Autowired
|
||||
private WarnStrategyService warnStrategyService;
|
||||
|
||||
//缓存策略
|
||||
|
||||
//缓存策略和vin
|
||||
@Autowired
|
||||
private WarnStrategyCacheService warnStrategyCacheService;
|
||||
private AllWarnStrategyAndVinCacheService allWarnStrategyAndVinCacheService;
|
||||
|
||||
|
||||
/**
|
||||
* 策略列表
|
||||
|
@ -32,8 +41,9 @@ public class WarnStrategyController {
|
|||
*/
|
||||
@RequestMapping(path = "/strategyList",method = RequestMethod.POST)
|
||||
@Operation(summary = "策略列表", description = "获取所有策略列表")
|
||||
public Result<List<WarnStrategy>> strategyList() {
|
||||
return Result.success(warnStrategyService.list());
|
||||
public Result<List<WarnVehicleResp>> strategyList(@RequestBody @Validated WarnVehicleReq req) {
|
||||
List<WarnVehicleResp> list = warnStrategyService.selectList(req);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,17 +57,6 @@ public class WarnStrategyController {
|
|||
return Result.success(warnStrategyService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则策略双表联查
|
||||
* @param warnVehicleReq
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(path = "ruleStrategyList",method = RequestMethod.POST)
|
||||
@Operation(summary = "策略规则双表联查", description = "获取所有策略规则双表联查")
|
||||
public Result<List<WarnVehicleResp>> ruleStrategyList(@RequestBody WarnVehicleReq warnVehicleReq){
|
||||
return Result.success(warnStrategyService.ruleStrategyList(warnVehicleReq));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加策略
|
||||
* @param warnStrategy
|
||||
|
@ -68,13 +67,7 @@ public class WarnStrategyController {
|
|||
public Result strategyAdd(@Validated @RequestBody WarnStrategy warnStrategy){
|
||||
|
||||
boolean save = warnStrategyService.save(warnStrategy);
|
||||
//存进Redis
|
||||
//获取用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//获取租户唯一标识
|
||||
String databaseName = loginUser.getSysUser().getDatabaseName();
|
||||
warnStrategyCacheService.put(databaseName+warnStrategy.getWarnStrategyId(),warnStrategy);
|
||||
return Result.success();
|
||||
return Result.success(save);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -99,4 +92,30 @@ public class WarnStrategyController {
|
|||
public Result strategyDelete(@PathVariable("id") Long id){
|
||||
return Result.success(warnStrategyService.removeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过vin缓存策略信息
|
||||
*/
|
||||
@RequestMapping(path = "/vinStrategyList/{warnStrategyId}",method = RequestMethod.POST)
|
||||
@Operation(summary = "通过vin缓存策略信息", description = "通过vin缓存策略信息")
|
||||
public Result<List<WarnStrategyAndVinResp>> vinStrategyList(@PathVariable("warnStrategyId") Long warnStrategyId) {
|
||||
List<WarnStrategyAndVinResp> warnStrategyAndVinResp = warnStrategyService.findById(warnStrategyId);
|
||||
for (WarnStrategyAndVinResp strategyAndVinResp : warnStrategyAndVinResp) {
|
||||
allWarnStrategyAndVinCacheService.put(strategyAndVinResp.getVehicleVin(), (WarnStrategyAndVinResp) warnStrategyAndVinResp);
|
||||
}
|
||||
return Result.success(warnStrategyAndVinResp);
|
||||
}
|
||||
|
||||
// findbyid resp warnrulelist.set
|
||||
/**
|
||||
* 根据resp查询List集合,将rule查询到的集合添加到List集合中
|
||||
* @param warnStrategyId
|
||||
*/
|
||||
@RequestMapping(path = "/warnRuleRespList",method = RequestMethod.POST)
|
||||
@Operation(summary = "根据resp查询List集合,将rule查询到的集合添加到List集合中", description = "根据resp查询List集合,将rule查询到的集合添加到List集合中")
|
||||
public Result<WarnRuleResp> respStrategyList(@PathVariable("warnStrategyId") Long warnStrategyId) {
|
||||
WarnRuleResp warnRuleRespList=warnStrategyService.findByWarnStrategyId(warnStrategyId);
|
||||
return Result.success(warnRuleRespList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@ import org.apache.ibatis.annotations.Update;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子围栏Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface ElectMapper extends MPJBaseMapper<Fence> {
|
||||
|
||||
|
@ -30,11 +33,6 @@ public interface ElectMapper extends MPJBaseMapper<Fence> {
|
|||
@Select("select * from fence where fence_id=#{fenceId}")
|
||||
List<Fence> mapShow(@Param("fenceId") Long fenceId);
|
||||
|
||||
// /**
|
||||
// * 根据id查询车辆
|
||||
// */
|
||||
// Fence boundFence(@Param("fenceId") Long fenceId);
|
||||
|
||||
/**
|
||||
* 查询电子围栏(终版)
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.enterprise.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.Fault;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FaultMapper extends BaseMapper<Fault> {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.muyu.enterprise.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.muyu.domain.FaultRule;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FaultRuleMapper extends MPJBaseMapper<FaultRule> {
|
||||
}
|
|
@ -28,7 +28,16 @@ public interface FencegroupMapper extends MPJBaseMapper<FenceGroup> {
|
|||
@Select("SELECT g.fence_group_id,g.group_type,g.priority,g.`status`,f.fence_id, group_CONCAT( f.fence_name ) AS fence_name FROM fence_group g LEFT JOIN middle m ON m.fence_group_id = g.fence_group_id LEFT JOIN fence f ON m.fence_id = f.fence_id GROUP BY g.fence_group_id")
|
||||
List<FenceGroup> showGroupList(FenceGroupReq req);
|
||||
|
||||
@Insert("INSERT INTO `vehicle-basic`.`middle` (`fence_id`, `fence_group_id`) VALUES <foreach collection=\"fenceIds\" item=\"id\" separator=\",\"> (#{id},#{fenceGroupId}) </foreach>")
|
||||
// @Insert("INSERT INTO `vehicle-basic`.`middle` (`fence_id`, `fence_group_id`) VALUES <foreach collection='fenceIds' item='id' separator=','> (#{id},#{fenceGroupId}) </foreach>")
|
||||
// @Insert({ "<script>", "INSERT INTO user_role (user_id, role_id) VALUES ", "<foreach collection='roleIds' item='roleId' separator=','>", "(#{userId}, #{roleId})", "</foreach>", "</script>" })
|
||||
@Insert({
|
||||
"<script>",
|
||||
"INSERT INTO `vehicle-basic`.`middle` (fence_id, fence_group_id) VALUES ",
|
||||
"<foreach collection='fenceIds' item='id' separator=','>",
|
||||
"(#{id}, #{fenceGroupId})",
|
||||
"</foreach>",
|
||||
"</script>"
|
||||
})
|
||||
void addMiddle(@Param("fenceIds") Integer[] fenceIds,@Param("fenceGroupId") Long fenceGroupId);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.enterprise.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.FirmUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:杨鹏
|
||||
* @Package:com.muyu.enterprise.mapper
|
||||
* @Project:cloud-vehicle
|
||||
* @name:FirmUserMapper
|
||||
* @Date:2024/10/8 19:05
|
||||
*/
|
||||
@Mapper
|
||||
public interface FirmUserMapper extends BaseMapper<FirmUser> {
|
||||
}
|
|
@ -1,9 +1,14 @@
|
|||
package com.muyu.enterprise.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.muyu.domain.BoundMiddle;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||
import com.muyu.domain.req.VehicleManageReq;
|
||||
import com.muyu.domain.resp.BoundFenceGroup;
|
||||
import com.muyu.domain.resp.VehicleManageResp;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
@ -26,12 +31,7 @@ public interface VehicleMapper extends MPJBaseMapper<Vehicle> {
|
|||
* @param vehicleManageReq
|
||||
* @return
|
||||
*/
|
||||
List<VehicleManageResp> findAll(VehicleManageReq vehicleManageReq);
|
||||
|
||||
/**
|
||||
* 车辆绑定围栏组
|
||||
*/
|
||||
void bindFenceGroup(@Param("fenceGroupIds") Integer[] fenceGroupIds, @Param("vehicleId") Long vehicleId);
|
||||
// List<VehicleManageResp> findAll(VehicleManageReq vehicleManageReq);
|
||||
|
||||
/**
|
||||
* 根据车辆vin查询模版id
|
||||
|
@ -40,4 +40,21 @@ public interface VehicleMapper extends MPJBaseMapper<Vehicle> {
|
|||
*/
|
||||
@Select("SELECT t.message_template_id FROM vehicle v LEFT JOIN vehicle_type t ON v.vehicle_type_id = t.vehicle_type_id WHERE v.vehicle_vin = #{vehicleVin}")
|
||||
Long findByVehicleVin(String vehicleVin);
|
||||
|
||||
/**
|
||||
* 车辆绑定围栏组
|
||||
* @param boundFenceGroupReq
|
||||
*/
|
||||
// @Insert("INSERT INTO `vehicle-basic`.`bound_middle` (`fence_group_id`,`vehicle_id`) VALUES <foreach collection=\"fenceGroupIds\" item=\"id\" separator=\",\"> (#{id},#{vehicleId}) </foreach>")
|
||||
@Insert({
|
||||
"<script> INSERT INTO `vehicle-basic`.`bound_middle` (fence_group_id,vehicle_id) VALUES <foreach collection='fenceGroupIds' item='id' separator=','> (#{id}, #{vehicleId}) </foreach> </script>"
|
||||
})
|
||||
void boundFenceGroup(BoundFenceGroupReq boundFenceGroupReq);
|
||||
|
||||
@Select("SELECT * FROM bound_middle bm LEFT JOIN vehicle v ON bm.vehicle_id=v.vehicle_id WHERE bm.fence_group_id = #{fenceGroupId}")
|
||||
List<FenceGroup> showBoundFenceGroup(@Param("fenceGroupId") Long fenceGroupId);
|
||||
|
||||
@Select("SELECT fence_group.group_type, fence_group.priority,fence_group.`status`,bound_middle.fence_group_id FROM fence_group LEFT JOIN bound_middle ON fence_group.fence_group_id = bound_middle.fence_group_id WHERE bound_middle.vehicle_id = #{vehicleId}")
|
||||
List<BoundFenceGroup> findByFenceGroupId(Long vehicleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,16 @@ package com.muyu.enterprise.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.WarnRule;
|
||||
import com.muyu.domain.resp.WarnRuleListResp;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface WarnRuleMapper extends BaseMapper<WarnRule> {
|
||||
|
||||
@Select("SELECT warn_rule.*,message_value.message_code FROM warn_rule LEFT JOIN message_value ON warn_rule.msg_type_id = message_value.message_id WHERE warn_strategy_id = #{warnStrategyId}")
|
||||
List<WarnRuleListResp> findBywarnStrategyId(Long warnStrategyId);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,28 @@ package com.muyu.enterprise.mapper;
|
|||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.muyu.domain.WarnStrategy;
|
||||
import com.muyu.domain.resp.WarnRuleResp;
|
||||
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface WarnStrategyMapper extends MPJBaseMapper<WarnStrategy> {
|
||||
|
||||
|
||||
@Select("SELECT vehicle.vehicle_vin, warn_strategy.warn_strategy_id, warn_strategy.vehicle_type_id, warn_strategy.message_template_id FROM vehicle LEFT JOIN warn_strategy ON vehicle.warn_strategy_id = warn_strategy.warn_strategy_id WHERE vehicle.warn_strategy_id = #{warn_strategy_id}")
|
||||
List<WarnStrategyAndVinResp> findById(Long vehicleId);
|
||||
|
||||
/**
|
||||
* 查询列表(存Redis)
|
||||
* @param warnStrategyId
|
||||
* @return
|
||||
*/
|
||||
@Select("select * from warn_strategy where warn_strategy_id = #{warn_strategy_id}")
|
||||
WarnRuleResp findByWarnStrategyId(Long warnStrategyId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -30,11 +30,6 @@ public interface ElectService extends IService<Fence> {
|
|||
*/
|
||||
List<Fence> mapShow(@Param("fenceId") Long fenceId);
|
||||
|
||||
// /**
|
||||
// * 根据id查询车辆
|
||||
// */
|
||||
// Fence boundFence(@Param("fenceId") Long fenceId);
|
||||
|
||||
/**
|
||||
* 查询电子围栏(终版)
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.enterprise.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.FaultRule;
|
||||
import com.muyu.domain.resp.FaultRuleResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FaultRuleService extends IService<FaultRule> {
|
||||
|
||||
/**
|
||||
* 查询故障规则列表
|
||||
* @return
|
||||
*/
|
||||
List<FaultRuleResp> selectList();
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.enterprise.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.Fault;
|
||||
|
||||
public interface FaultService extends IService<Fault> {
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.enterprise.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.FirmUser;
|
||||
|
||||
/**
|
||||
* @Author:杨鹏
|
||||
* @Package:com.muyu.enterprise.service
|
||||
* @Project:cloud-vehicle
|
||||
* @name:FirmUserService
|
||||
* @Date:2024/10/8 19:04
|
||||
*/
|
||||
public interface FirmUserService extends IService<FirmUser> {
|
||||
}
|
|
@ -19,7 +19,5 @@ public interface IFencegroupService extends IService<FenceGroup> {
|
|||
|
||||
void addGroup(FenceGroupAddReq addReq);
|
||||
|
||||
// List<FenceGroup> haveFence(HaveFence haveFence);
|
||||
//
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
package com.muyu.enterprise.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.BoundMiddle;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||
import com.muyu.domain.req.VehicleManageReq;
|
||||
import com.muyu.domain.resp.BoundFenceGroup;
|
||||
import com.muyu.domain.resp.VehicleManageResp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -31,4 +36,23 @@ public interface VehicleService extends IService<Vehicle> {
|
|||
* @return
|
||||
*/
|
||||
Long findByVehicleVin(String vehicleVin);
|
||||
|
||||
/**
|
||||
* 绑定围栏组
|
||||
*/
|
||||
void boundFenceGroup(BoundFenceGroupReq boundFenceGroupReq);
|
||||
|
||||
/**
|
||||
* 查询绑定围栏组信息
|
||||
* @param fenceGroupId
|
||||
* @return
|
||||
*/
|
||||
List<FenceGroup> showBoundFenceGroup(@Param("fenceGroupId") Long fenceGroupId);
|
||||
|
||||
/**
|
||||
* 根据围栏组id查询围栏信息
|
||||
* @param vehicleId
|
||||
*/
|
||||
List<BoundFenceGroup> findByFenceGroupId(Long vehicleId);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,17 @@ package com.muyu.enterprise.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.WarnRule;
|
||||
import com.muyu.domain.resp.WarnRuleListResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface WarnRuleService extends IService<WarnRule> {
|
||||
|
||||
/**
|
||||
* 根据预警策略ID查询预警规则集合
|
||||
* @param warnStrategyId
|
||||
* @return
|
||||
*/
|
||||
List<WarnRuleListResp> findBywarnStrategyId(Long warnStrategyId);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,11 +3,28 @@ package com.muyu.enterprise.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.WarnStrategy;
|
||||
import com.muyu.domain.req.WarnVehicleReq;
|
||||
import com.muyu.domain.resp.WarnRuleResp;
|
||||
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||
import com.muyu.domain.resp.WarnVehicleResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface WarnStrategyService extends IService<WarnStrategy> {
|
||||
|
||||
List<WarnVehicleResp>ruleStrategyList(WarnVehicleReq warnVehicleReq);
|
||||
// List<WarnVehicleResp>ruleStrategyList(WarnVehicleReq warnVehicleReq);
|
||||
|
||||
/**
|
||||
* 预警列表
|
||||
*/
|
||||
List<WarnVehicleResp> selectList(WarnVehicleReq req);
|
||||
|
||||
|
||||
List<WarnStrategyAndVinResp> findById(Long warnStrategyId);
|
||||
|
||||
/**
|
||||
* 查询列表(存Redis)
|
||||
* @param warnStrategyId
|
||||
* @return
|
||||
*/
|
||||
WarnRuleResp findByWarnStrategyId(Long warnStrategyId);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.enterprise.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.enterprise.cache.FenceCahceService;
|
||||
import com.muyu.enterprise.mapper.ElectMapper;
|
||||
import com.muyu.enterprise.mapper.WarnLogsMapper;
|
||||
import com.muyu.enterprise.service.ElectService;
|
||||
|
@ -10,6 +11,7 @@ import com.muyu.domain.Fence;
|
|||
import com.muyu.domain.LanType;
|
||||
import com.muyu.domain.req.FenceReq;
|
||||
import com.muyu.domain.resp.FenceResp;
|
||||
import com.muyu.enterprise.service.VehicleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -23,7 +25,12 @@ public class ElectServiceImpl
|
|||
@Autowired
|
||||
private ElectMapper electMapper;
|
||||
@Autowired
|
||||
private WarnLogsMapper warnLogsMapper;
|
||||
private VehicleService service;
|
||||
|
||||
|
||||
@Autowired
|
||||
private FenceCahceService fenceCahceService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<FenceResp> selectFenceList(FenceReq req) {
|
||||
|
@ -39,15 +46,13 @@ public class ElectServiceImpl
|
|||
req.getFenceName()
|
||||
);
|
||||
List<FenceResp> list = electMapper.selectJoinList(FenceResp.class, wrapper);
|
||||
|
||||
String decode = fenceCahceService.decode(String.valueOf(list));
|
||||
|
||||
//将获取到的数据存到Redis
|
||||
// fenceCahceService.put(String.valueOf(decode),d);
|
||||
return list;
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public int addFence(Fence fence) {
|
||||
// int i = electMapper.addFence(fence);
|
||||
// return i;
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public void updateFenceOn(Long fenceId) {
|
||||
|
@ -65,11 +70,6 @@ public class ElectServiceImpl
|
|||
return fences;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Fence boundFence(Long fenceId) {
|
||||
// Fence fence = electMapper.boundFence(fenceId);
|
||||
// return fence;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<Fence> showFenceBound(Long fenceGroupId) {
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.muyu.enterprise.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.domain.FaultRule;
|
||||
import com.muyu.domain.MessageValue;
|
||||
import com.muyu.domain.VehicleType;
|
||||
import com.muyu.domain.resp.FaultRuleResp;
|
||||
import com.muyu.enterprise.mapper.FaultRuleMapper;
|
||||
import com.muyu.enterprise.service.FaultRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FaultRuleServiceImpl
|
||||
extends ServiceImpl<FaultRuleMapper, FaultRule>
|
||||
implements FaultRuleService {
|
||||
|
||||
@Autowired
|
||||
private FaultRuleMapper faultRuleMapper;
|
||||
|
||||
/**
|
||||
* 查询故障规则列表
|
||||
* @return 故障规则列表
|
||||
*/
|
||||
@Override
|
||||
public List<FaultRuleResp> selectList() {
|
||||
MPJLambdaWrapper<FaultRule> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.selectAs(FaultRule::getFaultRuleId, "faultRuleId")
|
||||
.selectAs(FaultRule::getFaultCondition, "faultCondition")
|
||||
.selectAs(FaultRule::getTriggerValue, "triggerValue")
|
||||
.selectAs(VehicleType::getVehicleTypeName, "vehicleTypeName")
|
||||
.selectAs(MessageValue::getMessageLabel, "messageValueName")
|
||||
.leftJoin(VehicleType.class, VehicleType::getVehicleTypeId, FaultRule::getVehicleTypeId)
|
||||
.leftJoin(MessageValue.class, MessageValue::getMessageId, FaultRule::getMessageValueId);
|
||||
List<FaultRuleResp> list = faultRuleMapper.selectJoinList(FaultRuleResp.class, wrapper);
|
||||
return list;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue