Merge branch 'dev.entBusiness' of https://gitea.qinmian.online/six-vehicle/cloud-server into dev
# Conflicts: # cloud-common/pom.xml # cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/CloudEnterpriseApplication.java # cloud-modules/cloud-modules-event-process/src/main/resources/banner.txt # pom.xmldev.entOperation
commit
d896e9b26d
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>cloud-common-cache</artifactId>
|
||||
|
||||
<description>
|
||||
cloud-common-cache redis缓存架构
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- redis 缓存模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,78 @@
|
|||
package com.muyu.common.cache.config;
|
||||
/**
|
||||
* 抽象缓存层
|
||||
* @ClassName CacheAbsBasic
|
||||
* @Description CacheAbsBasic:类的描述
|
||||
* @Date 2024/9/30 1:39
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
public abstract class CacheAbsBasic<K,V> implements CacheBasic<K,V> {
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Override
|
||||
public void put(K key, V value) {
|
||||
redisService.setCacheObject(encode(key),value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存中车辆的数据
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public V getManage(K key) {
|
||||
return redisService.getCacheObject(encode(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数据存入缓存
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@Override
|
||||
public void putManage(K key, V value) {
|
||||
redisService.setCacheObject(encode(key),value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取缓存中故障的数据
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public V getFault(K key) {
|
||||
return redisService.getCacheObject(encode(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数据存入故障缓存
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@Override
|
||||
public void putFault(K key, V value) {
|
||||
redisService.setCacheObject(encode(key),value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public V get(K key) {
|
||||
return redisService.getCacheObject(encode(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(K key) {
|
||||
redisService.deleteObject(encode(key));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.muyu.common.cache.config;
|
||||
|
||||
import java.awt.image.Kernel;
|
||||
|
||||
/**
|
||||
* 缓存基础
|
||||
* @ClassName CacheBasic
|
||||
* @Description CacheBasic:类的描述
|
||||
* @Date 2024/9/30 1:36
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public interface CacheBasic<K,V> extends PrimaryKeyBasic<K>{
|
||||
|
||||
/**
|
||||
* 将数据存入车辆缓存
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
void putManage(K key,V value);
|
||||
|
||||
/**
|
||||
* 获取缓存中故障的数据
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
V getFault(K key);
|
||||
|
||||
/**
|
||||
* 将数据存入故障缓存
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
void putFault(K key,V value);
|
||||
|
||||
/**
|
||||
* 获取缓存中车辆的数据
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
V getManage(K key);
|
||||
|
||||
|
||||
void put(K key,V value);
|
||||
|
||||
V get(K key);
|
||||
|
||||
void remove(K key);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.muyu.common.cache.config;
|
||||
|
||||
/**
|
||||
* 主键基础
|
||||
* @ClassName PrimaryKeyBasic
|
||||
* @Description PrimaryKeyBasic:类的描述
|
||||
* @Date 2024/9/30 0:15
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
public interface PrimaryKeyBasic <K>{
|
||||
/**
|
||||
* key 前缀
|
||||
*/
|
||||
public String keyPre();
|
||||
|
||||
/**
|
||||
* 编码
|
||||
* @param key 缓存键
|
||||
* @return 装修键
|
||||
*/
|
||||
public default String encode(K key){
|
||||
return keyPre() + key.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解码 Key
|
||||
* @param key 解码后的key
|
||||
* @return
|
||||
*/
|
||||
public K decode(String key);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -22,6 +22,7 @@
|
|||
<module>cloud-common-xxl</module>
|
||||
<module>cloud-common-rabbit</module>
|
||||
<module>cloud-common-kafka</module>
|
||||
<module>cloud-common-cache</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>cloud-common</artifactId>
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<?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-cache</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>
|
||||
|
||||
<description>
|
||||
cloud-modules-enterprise-cache redis 缓存平台
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-cache</artifactId>
|
||||
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-enterprise-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
|
||||
/**
|
||||
* redis企业业务层
|
||||
* @ClassName CarCompanyCacheService
|
||||
* @Description CarCompanyCacheService:类的描述
|
||||
* @Date 2024/10/3 15:22
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public class CarCompanyCacheService extends CacheAbsBasic<String, CarCompany> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "CarCompany:info:";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("CarCompany:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.FaultType;
|
||||
|
||||
/**
|
||||
* redis故障业务层
|
||||
* @ClassName CarFaultCacheService
|
||||
* @Description CarFaultCacheService:类的描述
|
||||
* @Date 2024/10/3 15:22
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public class CarFaultCacheService extends CacheAbsBasic<String, FaultType> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "faultType:info:";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("faultType:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
|
||||
/**
|
||||
* redis报文业务层
|
||||
* @ClassName CarManageCacheService
|
||||
* @Description CarManageCacheService:类的描述
|
||||
* @Date 2024/10/3 15:22
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public class CarManageCacheService extends CacheAbsBasic<String, CarManage> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "carManage:info:";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("carManage:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.CarMessage;
|
||||
|
||||
/**
|
||||
* redis车辆管理业务层
|
||||
* @ClassName CarMessageCacheService
|
||||
* @Description CarMessageCacheService:类的描述
|
||||
* @Date 2024/9/30 11:42
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public class CarMessageCacheService extends CacheAbsBasic<String, CarMessage> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "carMessage:info:";
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String encode(String key) {
|
||||
// return super.encode(key);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("carMessage:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.CarTemplate;
|
||||
|
||||
/**
|
||||
* redis报文模版业务层
|
||||
* @ClassName CarTemplateCacheService
|
||||
* @Description CarTemplateCacheService:类的描述
|
||||
* @Date 2024/10/3 15:22
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public class CarTemplateCacheService extends CacheAbsBasic<String, CarTemplate> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "carTemplate:info:";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("carTemplate:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.WarnRule;
|
||||
|
||||
/**
|
||||
* redis车辆预警业务层
|
||||
* @ClassName CarWarnCacheService
|
||||
* @Description CarWarnCacheService:类的描述
|
||||
* @Date 2024/10/3 15:22
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public class CarWarnCacheService extends CacheAbsBasic<String, WarnRule> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "warnRule:info:";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("warnRule:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
com.muyu.enterprise.cache.CarManageCacheService
|
||||
|
|
@ -31,4 +31,5 @@ public class CarCompany {
|
|||
* 企业名称
|
||||
*/
|
||||
private String companyName;
|
||||
|
||||
}
|
||||
|
|
|
@ -29,20 +29,17 @@ public class CarConfig {
|
|||
@TableId(value = "config_id",type = IdType.AUTO)
|
||||
private Long configId;
|
||||
/**
|
||||
* 车辆配置 1.电动 2.纯油 3.混动
|
||||
* 车辆配置
|
||||
*/
|
||||
private String configName;
|
||||
/**
|
||||
* 能源类型
|
||||
* 能源类型 1.电动 2.纯油 3.混动
|
||||
*/
|
||||
private String energyType;
|
||||
private Integer energyType;
|
||||
/**
|
||||
* 档的类型 1.手动 2.自动
|
||||
*/
|
||||
private Integer gearType;
|
||||
/**
|
||||
* 报文id
|
||||
*/
|
||||
private Integer companyId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class CarManage {
|
|||
/**
|
||||
* 在线状态 1.无信号 2.行驶中 3.已停止
|
||||
*/
|
||||
private Integer carStayus;
|
||||
private Integer carStatus;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
@ -90,7 +90,7 @@ public class CarManage {
|
|||
/**
|
||||
* 车辆型号
|
||||
*/
|
||||
private String cardDrand;
|
||||
private String carBrand;
|
||||
|
||||
/** 最后一次连线时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
@ -106,9 +106,6 @@ public class CarManage {
|
|||
* 汽车所属企业id
|
||||
*/
|
||||
private Long companyId;
|
||||
/**
|
||||
* 车辆类型 1.轿车 2.跑车 3.越野 4.客车 5.公交 6.其他
|
||||
*/
|
||||
private Integer carType;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -19,42 +19,27 @@ public class CarDTO {
|
|||
* VIN码
|
||||
*/
|
||||
private String carVin;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆型号
|
||||
* 车辆企业
|
||||
*/
|
||||
private String typeName;
|
||||
private Long companyId;
|
||||
/**
|
||||
* 能源类型 1.电动 2.纯油 3.混动
|
||||
* 车辆配置
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer energyType;
|
||||
/**
|
||||
* 档的类型 1.手动 2.自动
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer gearType;
|
||||
private Long configId;
|
||||
|
||||
private Integer pageNum = 1;
|
||||
private Integer pageSize = 3;
|
||||
|
||||
/** 最后一次连线时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date carLastJoinTime;
|
||||
|
||||
/** 最后一次离线时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date carLastOfflineTime;
|
||||
/**
|
||||
* 在线状态 1.无信号 2.行驶中 3.已停止
|
||||
*/
|
||||
private Integer carStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 企业名称
|
||||
* 车辆品牌
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String companyName;
|
||||
private String carModel;
|
||||
/**
|
||||
* 车辆型号
|
||||
*/
|
||||
private String carBrand;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class CarVO {
|
|||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String carCoed;
|
||||
private String carCode;
|
||||
/**
|
||||
* 车牌颜色 1.白色 2.绿色 3.黑色 4.银色 5.红色
|
||||
*/
|
||||
|
@ -47,7 +47,7 @@ public class CarVO {
|
|||
/**
|
||||
* 车辆配置
|
||||
*/
|
||||
private Integer typeId;
|
||||
private Long configId;
|
||||
/**
|
||||
* 年审日期
|
||||
*/
|
||||
|
@ -96,14 +96,16 @@ public class CarVO {
|
|||
/** 所属企业 */
|
||||
private Long companyId;
|
||||
|
||||
/** 车辆车型(如客车,卡车,公交车等) */
|
||||
private String carType;
|
||||
|
||||
|
||||
// /** 车辆车型(如客车,卡车,公交车等) */
|
||||
// private String carType;
|
||||
|
||||
/**
|
||||
* 车辆型号
|
||||
* 车辆配置
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String typeName;
|
||||
private String configName;
|
||||
|
||||
/**
|
||||
* 能源类型 1.电动 2.纯油 3.混动
|
||||
|
|
|
@ -83,6 +83,12 @@
|
|||
<artifactId>cloud-common-api-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 企业缓存 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-enterprise-cache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 企业业务平台 - 公共依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.enterprise.service.CarCompanyService;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -18,18 +19,20 @@ import java.util.List;
|
|||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/company")
|
||||
@RequestMapping("/carCompany")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "CarCompanyController", description = "企业表")
|
||||
public class CarCompanyController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CarCompanyService sysCarCompanyService;
|
||||
private final CarCompanyService sysCarCompanyService;
|
||||
|
||||
/**
|
||||
* 查询企业表
|
||||
*/
|
||||
@PostMapping("selectCompany")
|
||||
public Result<List<CarCompany>> selectCompany(){
|
||||
startPage();
|
||||
return Result.success(sysCarCompanyService.list());
|
||||
}
|
||||
|
||||
|
@ -38,7 +41,7 @@ public class CarCompanyController extends BaseController {
|
|||
*/
|
||||
@PostMapping("selectCompanyByCompanyId")
|
||||
public Result<CarCompany> selectCompanyByCompanyId(@RequestParam("companyId") Long companyId){
|
||||
return Result.success(sysCarCompanyService.getById(companyId));
|
||||
return Result.success(sysCarCompanyService.selectCompanyByCompanyId(companyId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.service.CarCompanyService;
|
||||
import com.muyu.enterprise.service.CarConfigService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆配置--控制层
|
||||
* @ClassName CarCompanyController
|
||||
* @Description 车辆配置 Controller 层
|
||||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/carConfig")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "CarConfigController", description = "车辆配置")
|
||||
public class CarConfigController extends BaseController {
|
||||
|
||||
private final CarConfigService carConfigService;
|
||||
|
||||
/**
|
||||
* 通过 configId 查询企业
|
||||
* @param configId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("selectByConfigId")
|
||||
public Result selectByConfigId(@RequestParam("configId") Long configId){
|
||||
startPage();
|
||||
return Result.success(carConfigService.selectByConfigId(configId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.muyu.enterprise.controller;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.enterprise.cache.CarManageCacheService;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
|
@ -14,6 +15,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -28,22 +30,36 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/carManage")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "CarManageController", description = "车辆管理")
|
||||
public class CarManageController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CarCompanyService sysCarCompanyService;
|
||||
@Autowired
|
||||
private CarManageService sysCarService;
|
||||
private final CarManageCacheService carManageCacheService;
|
||||
|
||||
private final CarCompanyService sysCarCompanyService;
|
||||
|
||||
private final CarManageService sysCarService;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆列表2
|
||||
* 车辆列表 单表拼接
|
||||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("CarListShow")
|
||||
public Result<List<CarManage>> CarListShow(@RequestBody CarDTO carDTO){
|
||||
@PostMapping("/carListShow2")
|
||||
public Result<List<CarVO>> carListShow2(@RequestBody CarDTO carDTO){
|
||||
startPage();
|
||||
return Result.success(sysCarService.carListShow2(carDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆列表 联查
|
||||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/carListShow")
|
||||
public Result<List<CarVO>> carListShow(@RequestBody CarDTO carDTO){
|
||||
return Result.success(sysCarService.CarListShow(carDTO));
|
||||
}
|
||||
|
||||
|
@ -52,23 +68,11 @@ public class CarManageController extends BaseController {
|
|||
* @param carId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("CarManageShowByCarId")
|
||||
public Result CarManageShowByCarId(@RequestParam("carId") Long carId){
|
||||
@PostMapping("carManageShowByCarId")
|
||||
public Result carManageShowByCarId(@RequestParam("carId") Long carId){
|
||||
return Result.success(sysCarService.getById(carId));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 车辆列表1
|
||||
// * @param carVO
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping("CarList")
|
||||
// @Operation(summary = "查询列表",description = "车辆管理列表")
|
||||
// public Result<TableDataInfo<CarManage>> CarList(@RequestBody CarVO carVO){
|
||||
// startPage();
|
||||
// return getDataTable(sysCarService.carList(carVO));
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 车辆添加
|
||||
|
@ -84,6 +88,8 @@ public class CarManageController extends BaseController {
|
|||
String key2 = RandomUtil.randomNumbers(17);
|
||||
carVO.setCarVin(key2);
|
||||
sysCarService.save(carVO);
|
||||
// 存到缓存中去
|
||||
carManageCacheService.putManage(carVO.getCarVin(),new CarManage());
|
||||
return Result.success("车辆添加成功");
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,12 @@ 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.enterprise.cache.CarManageCacheService;
|
||||
import com.muyu.enterprise.cache.CarMessageCacheService;
|
||||
import com.muyu.enterprise.domain.CarMessage;
|
||||
import com.muyu.enterprise.service.CarMessageService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -20,10 +23,13 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/carMessage")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "报文",description = "报文模块")
|
||||
public class CarMessageController extends BaseController {
|
||||
@Autowired
|
||||
private CarMessageService sysCarMessageService;
|
||||
|
||||
private final CarMessageCacheService carMessageCacheService;
|
||||
private final CarMessageService sysCarMessageService;
|
||||
|
||||
/**
|
||||
* 查询所有报文信息
|
||||
|
@ -31,6 +37,7 @@ public class CarMessageController extends BaseController {
|
|||
*/
|
||||
@PostMapping("selectMessageShow")
|
||||
public List<CarMessage> selectMessageShow(@RequestParam("templateId") Long templateId){
|
||||
startPage();
|
||||
return sysCarMessageService.selectMessageShow(templateId);
|
||||
}
|
||||
|
||||
|
@ -41,8 +48,7 @@ public class CarMessageController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/selectByTemplateId")
|
||||
private Result<List<CarMessage>> selectByTemplateId(@RequestParam("templateId") Integer templateId) {
|
||||
return Result.success(sysCarMessageService.list
|
||||
(new LambdaQueryWrapper<CarMessage>().eq(CarMessage::getTemplateId, templateId)));
|
||||
return Result.success(sysCarMessageService.list(new LambdaQueryWrapper<CarMessage>().eq(CarMessage::getTemplateId, templateId)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,6 +67,8 @@ public class CarMessageController extends BaseController {
|
|||
@PostMapping("insertMessage")
|
||||
public Result insertMessage(@RequestBody CarMessage carMessage){
|
||||
sysCarMessageService.save(carMessage);
|
||||
//报文 redis
|
||||
carMessageCacheService.put(carMessage.getMessageType(),new CarMessage());
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.enterprise.domain.CarMessageType;
|
||||
import com.muyu.enterprise.service.CarMessageTypeService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -20,11 +21,13 @@ import java.util.List;
|
|||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("carMessageType")
|
||||
@RequestMapping("/carMessageType")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "报文类型" ,description = "报文类型")
|
||||
public class CarMessageTypeController extends BaseController {
|
||||
@Autowired
|
||||
private CarMessageTypeService sysCarMessageTypeService;
|
||||
|
||||
private final CarMessageTypeService sysCarMessageTypeService;
|
||||
|
||||
/**
|
||||
* 查询报文类型
|
||||
|
@ -32,21 +35,18 @@ public class CarMessageTypeController extends BaseController {
|
|||
*/
|
||||
@PostMapping("messageTypeList")
|
||||
public Result messageTypeList(){
|
||||
sysCarMessageTypeService.messageTypeList();
|
||||
startPage();
|
||||
List<CarMessageType> list = sysCarMessageTypeService.list();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加报文类型
|
||||
* @param carMessageType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("inserMessageType")
|
||||
public Result inserMessageType(@RequestBody CarMessageType carMessageType){
|
||||
/** id 检验 */
|
||||
if(carMessageType.getMessageTypeId()>0){
|
||||
return Result.error("添加要什么id");
|
||||
}
|
||||
/** token 检验 */
|
||||
if(SecurityUtils.getToken().isEmpty()){
|
||||
return Result.error("token不为空");
|
||||
}
|
||||
/** 报文类型 */
|
||||
if(StringUtils.isEmpty(carMessageType.getMessageType())){
|
||||
return Result.error("报文类型不能为空");
|
||||
|
@ -74,13 +74,21 @@ public class CarMessageTypeController extends BaseController {
|
|||
*/
|
||||
@PostMapping("updateMessageType")
|
||||
public Result updateMessageType(@RequestBody CarMessageType carMessageType){
|
||||
/** id */
|
||||
if(carMessageType.getMessageTypeId() < 0 ){
|
||||
return Result.error("修改需要id");
|
||||
/** 报文类型 */
|
||||
if(StringUtils.isEmpty(carMessageType.getMessageType())){
|
||||
return Result.error("报文类型不能为空");
|
||||
}
|
||||
/** 报文编号 */
|
||||
/** 报文 */
|
||||
if(StringUtils.isEmpty(carMessageType.getMessageName())){
|
||||
return Result.error("报文不能为空");
|
||||
}
|
||||
/** 报文编码 */
|
||||
if(StringUtils.isEmpty(carMessageType.getMessageCode())){
|
||||
return Result.error("");
|
||||
return Result.error("报文编码不能为空");
|
||||
}
|
||||
/** 报文字段类型 */
|
||||
if(StringUtils.isEmpty(carMessageType.getMessageClass())){
|
||||
return Result.error("报文字段类型不能为空");
|
||||
}
|
||||
sysCarMessageTypeService.updateById(carMessageType);
|
||||
return Result.success("修改成功");
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.enterprise.service.CarTemplateService;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -18,10 +19,12 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/carTemplate") // 报文模版
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "模版模块",description = "报文模版模块")
|
||||
public class CarTemplateController extends BaseController {
|
||||
@Autowired
|
||||
private CarTemplateService sysCarTemplateService;
|
||||
|
||||
private final CarTemplateService sysCarTemplateService;
|
||||
|
||||
/**
|
||||
* 查询所有模版信息
|
||||
|
@ -29,6 +32,7 @@ public class CarTemplateController extends BaseController {
|
|||
*/
|
||||
@PostMapping("selectTemplateShow")
|
||||
public List<CarTemplate> selectTemplateShow(){
|
||||
startPage();
|
||||
return sysCarTemplateService.selectTemplateShow();
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -4,11 +4,14 @@ import com.muyu.common.core.domain.Result;
|
|||
import com.muyu.enterprise.domain.CarType;
|
||||
import com.muyu.enterprise.service.CarTypeService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.muyu.common.core.utils.PageUtils.startPage;
|
||||
|
||||
/**
|
||||
* 车辆类型控制层
|
||||
* @ClassName CarController
|
||||
|
@ -18,11 +21,12 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/carType")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "CarTypeController",description = "车辆类型")
|
||||
public class CarTypeController {
|
||||
|
||||
@Autowired
|
||||
private CarTypeService carTypeService;
|
||||
private final CarTypeService carTypeService;
|
||||
|
||||
/**
|
||||
* 查询所有规则
|
||||
|
@ -30,6 +34,7 @@ public class CarTypeController {
|
|||
*/
|
||||
@GetMapping("/carTypeList")
|
||||
private Result<List<CarType>> carTypeList() {
|
||||
startPage();
|
||||
List<CarType> carTypeList = carTypeService.list();
|
||||
return Result.success(carTypeList);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.enterprise.cache.CarFaultCacheService;
|
||||
import com.muyu.enterprise.domain.FaultType;
|
||||
import com.muyu.enterprise.service.FaultTypeService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -19,6 +20,8 @@ import java.util.List;
|
|||
@RequestMapping("/type")
|
||||
@Tag(name = "故障类型",description = "对故障类型的定义")
|
||||
public class FaultTypeController {
|
||||
@Autowired
|
||||
private CarFaultCacheService carFaultCacheService;
|
||||
@Autowired
|
||||
private FaultTypeService faultTypeService;
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.enterprise.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.muyu.enterprise.domain.CarConfig;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆配置--持久层
|
||||
* @ClassName CarManageMapper
|
||||
* @Description 车辆配置 Mapper 层
|
||||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
|
||||
public interface CarConfigMapper extends MPJBaseMapper<CarConfig> {
|
||||
|
||||
}
|
|
@ -2,9 +2,12 @@ package com.muyu.enterprise.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -16,26 +19,7 @@ import java.util.List;
|
|||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarManageMapper extends MPJBaseMapper<CarManage> {
|
||||
|
||||
public interface CarManageMapper extends BaseMapper<CarManage> {
|
||||
/**
|
||||
* 车辆列表
|
||||
* @param queryWrapper
|
||||
* @return
|
||||
*/
|
||||
List<CarVO> carList(LambdaQueryWrapper<CarVO> queryWrapper);
|
||||
|
||||
/**
|
||||
* 车辆列表2
|
||||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
List<CarVO> CarListShow(CarDTO carDTO);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param carId
|
||||
* @return
|
||||
*/
|
||||
List<CarVO> CarListShowByCarId(@Param("carId") Long carId);
|
||||
}
|
||||
|
|
|
@ -14,10 +14,5 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface CarMessageMapper extends BaseMapper<CarMessage> {
|
||||
/**
|
||||
* 查询所有报文信息
|
||||
* @param templateId
|
||||
* @return
|
||||
*/
|
||||
List<CarMessage> selectMessageShow(Long templateId);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,9 +14,5 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface CarTemplateMapper extends BaseMapper<CarTemplate> {
|
||||
/**
|
||||
* 查询所有报文信息
|
||||
* @return
|
||||
*/
|
||||
List<CarTemplate> selectTemplateShow();
|
||||
|
||||
}
|
||||
|
|
|
@ -10,11 +10,13 @@ import com.muyu.enterprise.domain.CarCompany;
|
|||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
public interface CarCompanyService extends IService<CarCompany> {
|
||||
|
||||
/**
|
||||
* 查询企业表
|
||||
*
|
||||
* @param companyId
|
||||
* @return
|
||||
*/
|
||||
//List<CarCompany> selectCompany();
|
||||
CarCompany selectCompanyByCompanyId(Long companyId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.enterprise.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.enterprise.domain.CarConfig;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆配置--业务层
|
||||
* @ClassName CarConfigService
|
||||
* @Description 车辆配置 Service 层
|
||||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
public interface CarConfigService extends IService<CarConfig> {
|
||||
|
||||
/**
|
||||
* 通过 configId 查询企业
|
||||
* @param configId
|
||||
* @return
|
||||
*/
|
||||
CarConfig selectByConfigId(Long configId);
|
||||
}
|
|
@ -14,37 +14,22 @@ import java.util.List;
|
|||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
public interface CarManageService extends IService<CarManage> {
|
||||
// /**
|
||||
// * 车辆列表
|
||||
// * @param carVO
|
||||
// * @return
|
||||
// */
|
||||
// List<CarManage> carList(CarVO carVO);
|
||||
//
|
||||
// /**
|
||||
// * 车辆添加
|
||||
// * @param carVO
|
||||
// */
|
||||
// void insertCar(CarVO carVO);
|
||||
//
|
||||
// /**
|
||||
// * 车辆删除
|
||||
// * @param ids
|
||||
// */
|
||||
// void deleteCar(List<Long> ids);
|
||||
//
|
||||
//
|
||||
/**
|
||||
* 车辆列表2
|
||||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
List<CarManage> CarListShow(CarDTO carDTO);
|
||||
//
|
||||
// /**
|
||||
// * 通过id查询
|
||||
// * @param carId
|
||||
// * @return
|
||||
// */
|
||||
// List<CarVO> CarListShowByCarId(Long carId);
|
||||
List<CarVO> carListShow2(CarDTO carDTO);
|
||||
|
||||
/**
|
||||
* 车辆列表
|
||||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
List<CarVO> CarListShow(CarDTO carDTO);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,5 +12,5 @@ import java.util.List;
|
|||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
public interface CarMessageTypeService extends IService<CarMessageType> {
|
||||
List<CarMessageType> messageTypeList();
|
||||
|
||||
}
|
||||
|
|
|
@ -29,11 +29,17 @@ public class CarCompanyServiceImpl extends ServiceImpl<CarCompanyMapper, CarComp
|
|||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Autowired
|
||||
private CarCompanyMapper sysCarCompanyMapper;
|
||||
private CarCompanyMapper carCompanyMapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param companyId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CarCompany selectCompanyByCompanyId(Long companyId) {
|
||||
return carCompanyMapper.selectById(companyId);
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// public List<CarCompany> selectCompany() {
|
||||
// return sysCarCompanyMapper.;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.muyu.enterprise.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.CarConfig;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
import com.muyu.enterprise.mapper.CarConfigMapper;
|
||||
import com.muyu.enterprise.mapper.CarManageMapper;
|
||||
import com.muyu.enterprise.service.CarCompanyService;
|
||||
import com.muyu.enterprise.service.CarConfigService;
|
||||
import com.muyu.enterprise.service.CarManageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆配置--业务实现层
|
||||
* @ClassName CarConfigServiceImpl
|
||||
* @Description 车辆配置 ServiceImpl 层
|
||||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
@Service
|
||||
public class CarConfigServiceImpl extends ServiceImpl<CarConfigMapper, CarConfig>
|
||||
implements CarConfigService {
|
||||
@Autowired
|
||||
private CarConfigMapper carConfigMapper;
|
||||
|
||||
/**
|
||||
* 通过 configId 查询企业
|
||||
* @param configId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CarConfig selectByConfigId(Long configId) {
|
||||
CarConfig carConfig = carConfigMapper.selectById(configId);
|
||||
return carConfig;
|
||||
}
|
||||
}
|
|
@ -2,21 +2,25 @@ package com.muyu.enterprise.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.enterprise.controller.CarCompanyController;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.CarConfig;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
import com.muyu.enterprise.mapper.CarManageMapper;
|
||||
import com.muyu.enterprise.service.CarCompanyService;
|
||||
import com.muyu.enterprise.service.CarConfigService;
|
||||
import com.muyu.enterprise.service.CarManageService;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -30,122 +34,67 @@ import java.util.List;
|
|||
public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage>
|
||||
implements CarManageService {
|
||||
|
||||
// @Autowired
|
||||
// private RedisService redisService;
|
||||
// @Autowired
|
||||
// private CarManageMapper carMapper;
|
||||
// // 企业 service
|
||||
// @Autowired
|
||||
// private CarCompanyService carCompanyService;
|
||||
// /**
|
||||
// * 车辆列表
|
||||
// * @param carVO
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public List<CarVO> carList(CarVO carVO) {
|
||||
//
|
||||
//// MPJLambdaWrapper<CarVO> queryWrapper = new MPJLambdaWrapper<>();
|
||||
//// carMapper.selectJoinList(CarVO.class,
|
||||
//// queryWrapper.selectAll(CarVO.class)// 主表查询所有
|
||||
//// .select(Type::getTypeName)// 获取附表的字段
|
||||
//// .select(Type::getEnergyType)
|
||||
//// .select(Type::getGearType)
|
||||
//// .leftJoin(Type.class,Type::getTypeId,Car::getTypeId)// 左链接
|
||||
//// );
|
||||
//// // vin码--精确
|
||||
//// if(StringUtils.isNotEmpty(carVO.getCarVin())){
|
||||
//// queryWrapper.eq(CarVO::getCarVin,carVO.getCarVin());
|
||||
//// }
|
||||
//// // 车辆型号
|
||||
//// if(StringUtils.isNotEmpty(carVO.getTypeName())){
|
||||
//// queryWrapper.like(CarVO::getTypeName,carVO.getTypeName());
|
||||
//// }
|
||||
//// // 能源类型 1.电动 2.纯油 3.混动
|
||||
//// if(carVO.getEnergyType()>0){
|
||||
//// queryWrapper.eq(CarVO::getEnergyType,carVO.getEnergyType());
|
||||
//// }
|
||||
//// // 档的类型 1.手动 2.自动
|
||||
//// if(carVO.getGearType()>0){
|
||||
//// queryWrapper.eq(CarVO::getGearType,carVO.getGearType());
|
||||
//// }
|
||||
//// // 自定义列表查询
|
||||
////// @Select("")
|
||||
////// this.list(queryWrapper);
|
||||
//// // mybatis列表查询
|
||||
//// //return carMapper.carList(queryWrapper);
|
||||
//// // 单表的列表查询
|
||||
//// this.list(
|
||||
//// new LambdaQueryWrapper<CarVO>()
|
||||
//// .eq(StringUtils.isNotEmpty(carVO.getCarVin()),CarVO::getCarVin,carVO.getCarVin())
|
||||
//// .eq(carVO.getEnergyType()>0,CarVO::getEnergyType,carVO.getEnergyType())
|
||||
//// .eq(carVO.getGearType()>0,CarVO::getGearType,carVO.getGearType())
|
||||
//// .like(StringUtils.isNotEmpty(carVO.getTypeName()),CarVO::getTypeName,carVO.getTypeName())
|
||||
//// );
|
||||
//// return this.list(queryWrapper);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 车辆添加
|
||||
// * @param carVO
|
||||
// */
|
||||
// @Override
|
||||
// public void insertCar(CarVO carVO) {
|
||||
// carMapper.insert(carVO);
|
||||
// }
|
||||
//
|
||||
//// /**
|
||||
//// * 车辆修改
|
||||
//// * @param carVO
|
||||
//// */
|
||||
//// @Override
|
||||
//// public void updataCar(CarVO carVO) {
|
||||
//// carMapper.updateById(carVO);
|
||||
//// }
|
||||
//
|
||||
@Autowired
|
||||
private CarCompanyService carCompanyService;
|
||||
@Autowired
|
||||
private CarConfigService carConfigService;
|
||||
@Autowired
|
||||
private CarManageMapper carManageMapper;
|
||||
|
||||
/**
|
||||
* 车辆列表2
|
||||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CarManage> CarListShow(CarDTO carDTO) {
|
||||
// 获取 企业
|
||||
// CarCompanyController carCompanyController = new CarCompanyController();
|
||||
public List<CarVO> carListShow2(CarDTO carDTO) {
|
||||
// 获取 企业
|
||||
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
|
||||
return lambdaQuery()
|
||||
.eq(StringUtils.isNotEmpty(carManage.getCarVin()), CarManage::getCarVin, carManage.getCarVin())
|
||||
.eq(carManage.getConfigId() > 0, CarManage::getCarVin, carManage.getConfigId())
|
||||
List<CarManage> list = lambdaQuery()
|
||||
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
|
||||
.eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel())
|
||||
.eq(carManage.getCarBrand() != null && carManage.getCarBrand() != "", CarManage::getCarBrand, carManage.getCarBrand())
|
||||
.eq(carManage.getCarStatus() != null && carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
|
||||
.eq(carManage.getCompanyId() != null && carManage.getCompanyId() > 0, CarManage::getCompanyId, carManage.getCompanyId())
|
||||
.list();
|
||||
// list.forEach(carManage1 -> {
|
||||
// // 获取 企业 id
|
||||
// carCompanyController.selectCompanyByCompanyId(carManage1.getCompanyId());
|
||||
// });
|
||||
//
|
||||
// List<CarCompany> data = carCompanyController.selectCompany().getData();
|
||||
// getById()
|
||||
// List<CarManage> list = list();
|
||||
|
||||
// 把 查询出来的车辆数据 copy 到 CarVO
|
||||
List<CarVO> carVOS = BeanUtil.copyToList(list, CarVO.class);
|
||||
// 遍历赋值
|
||||
carVOS.forEach(carVO -> {
|
||||
// 查询出对象,用于赋值
|
||||
CarConfig carConfig = carConfigService.selectByConfigId(carVO.getConfigId());
|
||||
carVO.setConfigName(carConfig.getConfigName());
|
||||
carVO.setEnergyType(carConfig.getEnergyType());
|
||||
carVO.setGearType(carConfig.getGearType());
|
||||
// 查询出对象,用于赋值
|
||||
CarCompany carCompany = carCompanyService.selectCompanyByCompanyId(carVO.getCompanyId());
|
||||
carVO.setCompanyName(carCompany.getCompanyName());
|
||||
});
|
||||
return carVOS;
|
||||
}
|
||||
@Override
|
||||
public List<CarVO> CarListShow(CarDTO carDTO) {
|
||||
// 获取 企业
|
||||
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
|
||||
return carManageMapper.selectJoinList(CarVO.class, new MPJLambdaWrapper<CarManage>()
|
||||
.selectAll(CarManage.class) // 查询所有车辆表
|
||||
.select(CarCompany::getCompanyName)
|
||||
.select(CarConfig::getConfigName)
|
||||
.select(CarConfig::getGearType)
|
||||
.select(CarConfig::getEnergyType)
|
||||
.leftJoin(CarConfig.class, CarConfig::getConfigId, CarManage::getConfigId)
|
||||
.leftJoin(CarCompany.class, CarCompany::getCompanyId, CarManage::getCompanyId)
|
||||
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
|
||||
.eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel())
|
||||
.eq(carManage.getCarBrand() != null && carManage.getCarBrand() != "", CarManage::getCarBrand, carManage.getCarBrand())
|
||||
.eq(carManage.getCarStatus() != null && carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
|
||||
.eq(carManage.getCompanyId() != null && carManage.getCompanyId() > 0, CarManage::getCompanyId, carManage.getCompanyId())
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 通过id查询
|
||||
// * @param carId
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public CarManage CarListShowByCarId(Long carId) {
|
||||
// return carMapper.CarListShowByCarId(carId);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 车辆删除
|
||||
// * @param ids
|
||||
// */
|
||||
// @Override
|
||||
// public void deleteCar(List<Long> ids) {
|
||||
// carMapper.deleteBatchIds(ids);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.enterprise.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.enterprise.domain.CarMessage;
|
||||
import com.muyu.enterprise.mapper.CarMessageMapper;
|
||||
|
@ -7,6 +8,7 @@ import com.muyu.enterprise.service.CarMessageService;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 车辆报文--业务实现层
|
||||
|
@ -27,7 +29,8 @@ public class CarMessageServiceImpl extends ServiceImpl<CarMessageMapper, CarMess
|
|||
*/
|
||||
@Override
|
||||
public List<CarMessage> selectMessageShow(Long templateId) {
|
||||
return sysCarMessageMapper.selectMessageShow(templateId);
|
||||
return list(new LambdaQueryWrapper<CarMessage>()
|
||||
.eq(CarMessage::getTemplateId,templateId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,8 +18,5 @@ import java.util.List;
|
|||
@Service
|
||||
public class CarMessageTypeServiceImpl extends ServiceImpl<CarMessageTypeMapper, CarMessageType> implements CarMessageTypeService {
|
||||
|
||||
@Override
|
||||
public List<CarMessageType> messageTypeList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class CarTemplateServiceImpl extends ServiceImpl<CarTemplateMapper, CarTe
|
|||
*/
|
||||
@Override
|
||||
public List<CarTemplate> selectTemplateShow() {
|
||||
return sysCarTemplateMapper.selectTemplateShow();
|
||||
return list();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,75 +4,5 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.enterprise.mapper.CarManageMapper">
|
||||
|
||||
<!-- 车辆列表 -->
|
||||
<select id="carList" resultType="com.muyu.enterprise.domain.vo.CarVO">
|
||||
SELECT
|
||||
cman.*,
|
||||
cc.config_name,
|
||||
cc.energy_type,
|
||||
cc.gear_type
|
||||
FROM
|
||||
`car_manage` cman
|
||||
LEFT JOIN `car_config` cc ON cman.config_id = cc.config_id
|
||||
<where>
|
||||
<if test="carVin != null and carVin != ''">
|
||||
and cman.car_vin = #{carVin}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and cc.config_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="energyType != null and energyType > 0 ">
|
||||
and cc.energy_type = #{energyType}
|
||||
</if>
|
||||
<if test="gearType != null and gearType > 0 ">
|
||||
and cc.gear_type = #{gearType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="CarListShow" resultType="com.muyu.enterprise.domain.vo.CarVO">
|
||||
SELECT
|
||||
tc.*,
|
||||
tt.energy_type,
|
||||
tt.gear_type,
|
||||
tt.type_name
|
||||
FROM
|
||||
`t_car` tc
|
||||
LEFT JOIN `t_type` tt ON tc.type_id = tt.type_id
|
||||
<where>
|
||||
<if test="carVin != null and carVin != ''">
|
||||
and tc.car_vin = #{carVin}
|
||||
</if>
|
||||
<if test="carLastJoinTime != null and carLastJoinTime != ''">
|
||||
and tc.car_last_join_time = #{carLastJoinTime}
|
||||
</if>
|
||||
<if test="carLastOfflineTime != null and carLastOfflineTime != ''">
|
||||
and tc.car_last_offline_time = #{carVin}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and tt.type_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="energyType != null and energyType > 0 ">
|
||||
and tt.energy_type = #{energyType}
|
||||
</if>
|
||||
<if test="gearType != null and gearType > 0 ">
|
||||
and tt.gear_type = #{gearType}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 通过id查询 -->
|
||||
<select id="CarListShowByCarId" resultType="com.muyu.enterprise.domain.vo.CarVO">
|
||||
SELECT
|
||||
tc.*,
|
||||
tt.energy_type,
|
||||
tt.gear_type,
|
||||
tt.type_name
|
||||
FROM
|
||||
`t_car` tc
|
||||
LEFT JOIN `t_type` tt ON tc.type_id = tt.type_id
|
||||
where tc.car_id = #{carId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -4,17 +4,4 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.enterprise.mapper.CarMessageMapper">
|
||||
|
||||
<!-- 查询所有报文信息 -->
|
||||
|
||||
|
||||
<!-- 查询所有报文信息 -->
|
||||
<select id="selectMessageShow" resultType="com.muyu.enterprise.domain.CarMessage">
|
||||
SELECT
|
||||
tcm.*
|
||||
FROM
|
||||
`t_car_message` tcm
|
||||
WHERE
|
||||
tcm.template_id = #{templateId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -4,10 +4,4 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.enterprise.mapper.CarTemplateMapper">
|
||||
|
||||
<!-- 查询所有报文信息 -->
|
||||
|
||||
|
||||
<select id="selectTemplateShow" resultType="com.muyu.enterprise.domain.CarTemplate">
|
||||
select * from `t_template`
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<modules>
|
||||
<module>cloud-modules-enterprise-server</module>
|
||||
<module>cloud-modules-enterprise-common</module>
|
||||
<module>cloud-modules-enterprise-cache</module>
|
||||
</modules>
|
||||
|
||||
<description>
|
||||
|
|
91
pom.xml
91
pom.xml
|
@ -43,16 +43,6 @@
|
|||
<knife4j-openapi3.version>4.1.0</knife4j-openapi3.version>
|
||||
<xxl-job-core.version>2.4.1</xxl-job-core.version>
|
||||
<swagger.an.jakarta.verison>2.2.8</swagger.an.jakarta.verison>
|
||||
<ecs20140526.version>5.1.8</ecs20140526.version>
|
||||
<tea-openapi.version>0.3.2</tea-openapi.version>
|
||||
<tea-console.version>0.0.1</tea-console.version>
|
||||
<tea-util.version>0.2.21</tea-util.version>
|
||||
<cloudapi20160714.version>3.10.1</cloudapi20160714.version>
|
||||
<kafka.clients.verison>3.0.0</kafka.clients.verison>
|
||||
<iotdb.session.verison>1.3.1</iotdb.session.verison>
|
||||
<mybatis.plus.join.version>1.4.13</mybatis.plus.join.version>
|
||||
<org.eclipse.paho.client.mqttv3.version>1.2.5</org.eclipse.paho.client.mqttv3.version>
|
||||
<caffeine.version>3.1.8</caffeine.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
|
@ -200,76 +190,6 @@
|
|||
<version>${swagger.an.jakarta.verison}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- MyBatisPlusJoin 依赖包 -->
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join</artifactId>
|
||||
<version>1.4.13</version>
|
||||
</dependency>
|
||||
|
||||
<!-- kafka客户端 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
<version>${kafka.clients.verison}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- IotDB会话 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.iotdb</groupId>
|
||||
<artifactId>iotdb-session</artifactId>
|
||||
<version>${iotdb.session.verison}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云创建ecs实例 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>ecs20140526</artifactId>
|
||||
<version>${ecs20140526.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云创建ecs实例 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-openapi</artifactId>
|
||||
<version>${tea-openapi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云创建ecs实例 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-console</artifactId>
|
||||
<version>${tea-console.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云创建ecs实例 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-util</artifactId>
|
||||
<version>${tea-util.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云创建ecs实例 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>cloudapi20160714</artifactId>
|
||||
<version>${cloudapi20160714.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mqtt3包 -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>${org.eclipse.paho.client.mqttv3.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Caffeine本地缓存 -->
|
||||
<dependency>
|
||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||
<artifactId>caffeine</artifactId>
|
||||
<version>${caffeine.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
@ -361,10 +281,17 @@
|
|||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- kafka模块-->
|
||||
<!-- 公共缓存模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-kafka</artifactId>
|
||||
<artifactId>cloud-common-cache</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 企业缓存模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-enterprise-cache</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
|
Loading…
Reference in New Issue