Merge branch 'dev.entBusiness' into dev

# Conflicts:
#	cloud-common/cloud-common-core/src/main/java/com/muyu/common/core/constant/ServiceNameConstants.java
#	cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarFaultCacheService.java
#	cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarWarnCacheService.java
#	cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/enterprise/domain/CarTemplate.java
#	cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/CloudEnterpriseApplication.java
#	pom.xml
dev.entBusiness
微醺 2024-10-08 20:15:16 +08:00
commit 0534db9f37
69 changed files with 551 additions and 139 deletions

View File

@ -4,7 +4,7 @@ package com.muyu.common.cache.config;
* @ClassName CacheAbsBasic * @ClassName CacheAbsBasic
* @Description CacheAbsBasic: * @Description CacheAbsBasic:
* @Date 2024/9/30 1:39 * @Date 2024/9/30 1:39
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
import com.muyu.common.redis.service.RedisService; import com.muyu.common.redis.service.RedisService;

View File

@ -7,7 +7,7 @@ import java.awt.image.Kernel;
* @ClassName CacheBasic * @ClassName CacheBasic
* @Description CacheBasic: * @Description CacheBasic:
* @Date 2024/9/30 1:36 * @Date 2024/9/30 1:36
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
public interface CacheBasic<K,V> extends PrimaryKeyBasic<K>{ public interface CacheBasic<K,V> extends PrimaryKeyBasic<K>{

View File

@ -5,7 +5,7 @@ package com.muyu.common.cache.config;
* @ClassName PrimaryKeyBasic * @ClassName PrimaryKeyBasic
* @Description PrimaryKeyBasic: * @Description PrimaryKeyBasic:
* @Date 2024/9/30 0:15 * @Date 2024/9/30 0:15
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
public interface PrimaryKeyBasic <K>{ public interface PrimaryKeyBasic <K>{
/** /**

View File

@ -24,4 +24,5 @@ public class ServiceNameConstants {
* serviceid * serviceid
*/ */
public static final String ENTERPRISE_SERVICE = "cloud-enterprise"; public static final String ENTERPRISE_SERVICE = "cloud-enterprise";
} }

View File

@ -9,7 +9,7 @@ import java.lang.annotation.*;
* @ClassName EnableCustomSwagger2 * @ClassName EnableCustomSwagger2
* @Description EnableCustomSwagger2: * @Description EnableCustomSwagger2:
* @Date 2024/10/6 22:16 * @Date 2024/10/6 22:16
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
@Target({ElementType.TYPE}) @Target({ElementType.TYPE})

View File

@ -25,7 +25,7 @@ import java.util.function.Predicate;
* @ClassName SwaggerAutoConfiguration * @ClassName SwaggerAutoConfiguration
* @Description SwaggerAutoConfiguration: * @Description SwaggerAutoConfiguration:
* @Date 2024/10/6 22:16 * @Date 2024/10/6 22:16
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
@Configuration @Configuration
@EnableSwagger2 @EnableSwagger2

View File

@ -16,7 +16,7 @@ import java.util.stream.Collectors;
* @ClassName SwaggerBeanPostProcessor * @ClassName SwaggerBeanPostProcessor
* @Description SwaggerBeanPostProcessor: * @Description SwaggerBeanPostProcessor:
* @Date 2024/10/6 22:16 * @Date 2024/10/6 22:16
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
public class SwaggerBeanPostProcessor implements BeanPostProcessor { public class SwaggerBeanPostProcessor implements BeanPostProcessor {
@Override @Override

View File

@ -10,7 +10,7 @@ import java.util.List;
* @ClassName SwaggerProperties * @ClassName SwaggerProperties
* @Description SwaggerProperties: * @Description SwaggerProperties:
* @Date 2024/10/6 22:16 * @Date 2024/10/6 22:16
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
@ConfigurationProperties("swagger") @ConfigurationProperties("swagger")
public class SwaggerProperties { public class SwaggerProperties {

View File

@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
* @ClassName SwaggerWebConfiguration * @ClassName SwaggerWebConfiguration
* @Description SwaggerWebConfiguration: * @Description SwaggerWebConfiguration:
* @Date 2024/10/6 22:16 * @Date 2024/10/6 22:16
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
public class SwaggerWebConfiguration implements WebMvcConfigurer { public class SwaggerWebConfiguration implements WebMvcConfigurer {
@Override @Override

View File

@ -0,0 +1,116 @@
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 com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import java.util.Date;
/**
* --
* @ClassName CarManage
* @Description
* @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName(value = "car_manage",autoResultMap = true)
public class CarManage {
/**
*
*/
@TableId(value = "car_id",type = IdType.AUTO)
private Long carId;
/**
*
*/
private String carFrame;
/**
*
*/
private String carCode;
/**
* 1. 2.绿 3. 4. 5.
*/
private Integer carColor;
/**
* VIN
*/
private String carVin;
/**
*
*/
private long userId;
/**
*
*/
private long configId;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date audditTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date licenseTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date insuranceTime;
/**
* 线 1. 2. 3.
*/
private Integer carStatus;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
/**
*
*/
private Integer carGears;
/**
*
*/
private String carModel;
/**
*
*/
private String carBrand;
/** 最后一次连线时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "最后一次连线时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date carLastJoinTime;
/** 最后一次离线时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "最后一次离线时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date carLastOfflineTime;
/**
* id
*/
private Long enterpriseId;
/**
* id
*/
private Long CarTypeId;
}

View File

@ -0,0 +1,36 @@
package com.muyu.common.system.remote;
import com.muyu.common.core.constant.ServiceNameConstants;
import com.muyu.common.core.domain.Result;
import com.muyu.common.system.domain.SysEnt;
import com.muyu.common.system.remote.factory.RemoteEntFallbackFactory;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
*
* @ClassName RemoteEntService
* @PATH com.muyu.common.system.remote:
* @author MingWei.Zong()
* @Date 2024/10/8 10:59
*/
@FeignClient(
path = "/ent",
contextId = "remoteEntService",
value = ServiceNameConstants.SYSTEM_SERVICE,
fallbackFactory = RemoteEntFallbackFactory.class
)
public interface RemoteEntService {
/**
* ID
* @param entId ID
* @return
*/
@GetMapping(value = "/{entId}")
public Result<SysEnt> getById(@PathVariable(value = "entId") Long entId);
}

View File

@ -0,0 +1,36 @@
package com.muyu.common.system.remote;
import com.muyu.common.core.constant.ServiceNameConstants;
import com.muyu.common.core.domain.Result;
import com.muyu.common.system.domain.CarManage;
import com.muyu.common.system.domain.SysEnt;
import com.muyu.common.system.remote.factory.RemoteEntFallbackFactory;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
*
* @ClassName RemoteWarnService
* @PATH com.muyu.common.system.remote:
* @author MingWei.Zong()
* @Date 2024/10/8 10:59
*/
@FeignClient(
path = "/strategy",
contextId = "remoteWarnService",
value = ServiceNameConstants.ENTERPRISE_SERVICE,
fallbackFactory = RemoteEntFallbackFactory.class
)
public interface RemoteWarnService {
/**
* carTypeId
* @param carTypeId
* @return
*/
@PostMapping("carManageShowByCarTypeId")
public Result<CarManage> carManageShowByCarTypeId(@RequestParam("carTypeId") Long carTypeId);
}

View File

@ -0,0 +1,32 @@
package com.muyu.common.system.remote.factory;
import com.muyu.common.core.domain.Result;
import com.muyu.common.system.remote.RemoteEntService;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
*
* @ClassName RemoteEntFallbackFactory
* @PATH com.muyu.common.system.remote.factory:
* @Date 2024/10/8 10:59
* @author MingWei.Zong()
*/
@Component
public class RemoteEntFallbackFactory implements FallbackFactory<RemoteEntService> {
private static final Logger log = LoggerFactory.getLogger(RemoteEntFallbackFactory.class);
@Override
public RemoteEntService create(Throwable throwable) {
log.error("企业服务调用失败:{}", throwable.getMessage());
return new RemoteEntService() {
@Override
public Result getById(Long entId) {
return Result.error("查询企业失败:" + throwable.getMessage());
}
};
}
}

View File

@ -0,0 +1,34 @@
package com.muyu.common.system.remote.factory;
import com.muyu.common.core.domain.Result;
import com.muyu.common.system.remote.RemoteEntService;
import com.muyu.common.system.remote.RemoteWarnService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* --ID
* @ClassName RemoteWarnFallbackFactory
* @PATH com.muyu.common.system.remote.factory:
* @Date 2024/10/8 10:59
* @author MingWei.Zong()
*/
@Component
public class RemoteWarnFallbackFactory implements FallbackFactory<RemoteWarnService> {
private static final Logger log = LoggerFactory.getLogger(RemoteWarnFallbackFactory.class);
@Override
public RemoteWarnService create(Throwable throwable) {
log.error("通过预警中车辆类型ID查询车辆信息服务调用失败:{}", throwable.getMessage());
return new RemoteWarnService() {
@Override
public Result carManageShowByCarTypeId(Long carTypeId) {
return Result.error("通过预警中车辆类型ID查询车辆信息失败:" + throwable.getMessage());
}
};
}
}

View File

@ -1,3 +1,4 @@
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
com.muyu.common.system.remote.factory.RemoteEntFallbackFactory

View File

@ -9,7 +9,7 @@ import com.muyu.enterprise.domain.CarManage;
* @ClassName CarCompanyCacheService * @ClassName CarCompanyCacheService
* @Description CarCompanyCacheService: * @Description CarCompanyCacheService:
* @Date 2024/10/3 15:22 * @Date 2024/10/3 15:22
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
public class CarCompanyCacheService extends CacheAbsBasic<String, CarCompany> { public class CarCompanyCacheService extends CacheAbsBasic<String, CarCompany> {

View File

@ -1,26 +1,28 @@
package com.muyu.enterprise.cache; package com.muyu.enterprise.cache;
import com.muyu.common.cache.config.CacheAbsBasic; import com.muyu.common.cache.config.CacheAbsBasic;
import com.muyu.enterprise.domain.FaultRule; import com.muyu.enterprise.domain.CarCompany;
import org.springframework.stereotype.Component; import com.muyu.enterprise.domain.FaultType;
import com.muyu.enterprise.domain.SysCarFault;
/** /**
* redis * redis
* @ClassName CarFaultCacheService * @ClassName CarFaultCacheService
* @Description CarFaultCacheService: * @Description CarFaultCacheService:
* @Date 2024/10/3 15:22 * @Date 2024/10/3 15:22
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
public class CarFaultCacheService extends CacheAbsBasic<String, FaultRule> {
public class CarFaultCacheService extends CacheAbsBasic<String, SysCarFault> {
@Override @Override
public String keyPre() { public String keyPre() {
return "faultRule:info:"; return "sysCarFault:info:";
} }
@Override @Override
public String decode(String key) { public String decode(String key) {
return key.replace("faultRule:info:",""); return key.replace("faultType:info:","");
} }

View File

@ -2,16 +2,19 @@ package com.muyu.enterprise.cache;
import com.muyu.common.cache.config.CacheAbsBasic; import com.muyu.common.cache.config.CacheAbsBasic;
import com.muyu.enterprise.domain.CarManage; import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.vo.CarVO;
import java.util.List;
/** /**
* redis * redis
* @ClassName CarManageCacheService * @ClassName CarManageCacheService
* @Description CarManageCacheService: * @Description CarManageCacheService:
* @Date 2024/10/3 15:22 * @Date 2024/10/3 15:22
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
public class CarManageCacheService extends CacheAbsBasic<String, CarManage> { public class CarManageCacheService extends CacheAbsBasic<String, List<CarManage>> {
@Override @Override
public String keyPre() { public String keyPre() {
return "carManage:info:"; return "carManage:info:";

View File

@ -8,7 +8,7 @@ import com.muyu.enterprise.domain.CarMessage;
* @ClassName CarMessageCacheService * @ClassName CarMessageCacheService
* @Description CarMessageCacheService: * @Description CarMessageCacheService:
* @Date 2024/9/30 11:42 * @Date 2024/9/30 11:42
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
public class CarMessageCacheService extends CacheAbsBasic<String, CarMessage> { public class CarMessageCacheService extends CacheAbsBasic<String, CarMessage> {
@Override @Override

View File

@ -9,7 +9,7 @@ import com.muyu.enterprise.domain.CarTemplate;
* @ClassName CarTemplateCacheService * @ClassName CarTemplateCacheService
* @Description CarTemplateCacheService: * @Description CarTemplateCacheService:
* @Date 2024/10/3 15:22 * @Date 2024/10/3 15:22
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
public class CarTemplateCacheService extends CacheAbsBasic<String, CarTemplate> { public class CarTemplateCacheService extends CacheAbsBasic<String, CarTemplate> {

View File

@ -1,26 +1,27 @@
package com.muyu.enterprise.cache; package com.muyu.enterprise.cache;
import com.muyu.common.cache.config.CacheAbsBasic; import com.muyu.common.cache.config.CacheAbsBasic;
import com.muyu.enterprise.domain.WarnRule; import com.muyu.enterprise.domain.WarnStrategy;
import com.muyu.enterprise.domain.vo.WarnVo;
/** /**
* redis * redis
* @ClassName CarWarnCacheService * @ClassName CarWarnCacheService
* @Description CarWarnCacheService: * @Description CarWarnCacheService:
* @Date 2024/10/3 15:22 * @Date 2024/10/3 15:22
* @author MingWei.Zong * @author MingWei.Zong()
*/ */
public class CarWarnCacheService extends CacheAbsBasic<String, WarnRule> { public class CarWarnCacheService extends CacheAbsBasic<String, WarnVo> {
@Override @Override
public String keyPre() { public String keyPre() {
return "warnRule:info:"; return "warnStrategy:info:";
} }
@Override @Override
public String decode(String key) { public String decode(String key) {
return key.replace("warnRule:info:",""); return key.replace("warnStrategy:info:","");
} }

View File

@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
* -- * --
* @ClassName CarCompany * @ClassName CarCompany
* @Description * @Description
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Data @Data

View File

@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
* -- * --
* @ClassName CarConfig * @ClassName CarConfig
* @Description * @Description
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Data @Data

View File

@ -16,7 +16,7 @@ import java.util.Date;
* -- * --
* @ClassName CarManage * @ClassName CarManage
* @Description * @Description
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Data @Data
@ -107,5 +107,10 @@ public class CarManage {
*/ */
private Long enterpriseId; private Long enterpriseId;
/**
* id
*/
private Long CarTypeId;
} }

View File

@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
* -- * --
* @ClassName CarMessage * @ClassName CarMessage
* @Description * @Description
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Data @Data

View File

@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
* -- * --
* @ClassName CarMessageType * @ClassName CarMessageType
* @Description * @Description
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Data @Data

View File

@ -8,12 +8,12 @@ import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* * --
* @Author: chenruijia * @ClassName CarTemplate
* @Date 2024/9/28 12.23 * @Description
* @Description FaultRule: * @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/ */
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@ -96,6 +96,11 @@ public class CarVO {
/** 所属企业 */ /** 所属企业 */
private Long enterpriseId; private Long enterpriseId;
/**
* id
*/
private Long CarTypeId;
// /** 车辆车型(如客车,卡车,公交车等) */ // /** 车辆车型(如客车,卡车,公交车等) */
@ -122,6 +127,6 @@ public class CarVO {
* *
*/ */
@TableField(exist = false) @TableField(exist = false)
private String companyName; private String name;
} }

View File

@ -0,0 +1,38 @@
package com.muyu.enterprise.domain.vo;
/**
*
*
* @ClassName WarnVo
* @PATH com.muyu.enterprise.domain.vo:
* @Date 2024/10/8 14:05
* @author MingWei.Zong()
*/
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.muyu.common.core.annotation.Excel;
import com.muyu.enterprise.domain.WarnRule;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import java.util.List;
@Data
public class WarnVo {
/** 策略id */
private Long id;
/** 车辆类型id */
private Long carTypeId;
/** 策略名称 */
private String strategyName;
/** 报文模版id */
private Long templateId;
/**
*
*/
List<WarnRule> warnRuleList;
}

View File

@ -105,8 +105,8 @@
<dependency> <dependency>
<groupId>com.github.yulichang</groupId> <groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join</artifactId> <artifactId>mybatis-plus-join</artifactId>
<version>1.4.13</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -4,6 +4,8 @@ import com.muyu.common.security.annotation.EnableCustomConfig;
import com.muyu.common.security.annotation.EnableMyFeignClients; import com.muyu.common.security.annotation.EnableMyFeignClients;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
/** /**
* *
@ -38,4 +40,12 @@ public class CloudEnterpriseApplication {
" // 佛祖保佑 永不宕机 永无BUG //"); " // 佛祖保佑 永不宕机 永无BUG //");
} }
//实现远程调用
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
} }

View File

@ -1,17 +0,0 @@
package com.muyu.enterprise.OpenFen;
import org.springframework.stereotype.Component;
/**
*
* @ClassName SysEntOpenFen
* @Description SysEntOpenFen:
* @Date 2024/10/7 11:52
* @author MingWei.Zong()
*/
@Component
public class SysEntFallbackFactory {
}

View File

@ -15,7 +15,7 @@ import java.util.List;
* -- * --
* @ClassName CarCompanyController * @ClassName CarCompanyController
* @Description Controller * @Description Controller
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@RestController @RestController

View File

@ -19,7 +19,7 @@ import java.util.List;
* -- * --
* @ClassName CarCompanyController * @ClassName CarCompanyController
* @Description Controller * @Description Controller
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@RestController @RestController
@ -32,7 +32,7 @@ public class CarConfigController extends BaseController {
private final CarConfigService carConfigService; private final CarConfigService carConfigService;
/** /**
* configId * configId
* @param configId * @param configId
* @return * @return
*/ */

View File

@ -5,6 +5,7 @@ import cn.hutool.core.util.RandomUtil;
import com.muyu.common.core.utils.StringUtils; import com.muyu.common.core.utils.StringUtils;
import com.muyu.enterprise.cache.CarManageCacheService; import com.muyu.enterprise.cache.CarManageCacheService;
import com.muyu.enterprise.domain.CarManage; import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.CarMessage;
import com.muyu.enterprise.domain.dto.CarDTO; import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO; import com.muyu.enterprise.domain.vo.CarVO;
import com.muyu.enterprise.service.CarCompanyService; import com.muyu.enterprise.service.CarCompanyService;
@ -25,7 +26,7 @@ import java.util.List;
* -- * --
* @ClassName CarManageController * @ClassName CarManageController
* @Description Controller * @Description Controller
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@RestController @RestController
@ -39,7 +40,7 @@ public class CarManageController extends BaseController {
private final CarCompanyService sysCarCompanyService; private final CarCompanyService sysCarCompanyService;
private final CarManageService sysCarService; private final CarManageService carManageService;
/** /**
@ -51,7 +52,7 @@ public class CarManageController extends BaseController {
public Result<List<CarVO>> carListShow2(@RequestBody CarDTO carDTO){ public Result<List<CarVO>> carListShow2(@RequestBody CarDTO carDTO){
startPage(); startPage();
// 存到缓存中去 // 存到缓存中去
return Result.success(sysCarService.carListShow2(carDTO)); return Result.success(carManageService.carListShow2(carDTO));
} }
/** /**
@ -61,7 +62,7 @@ public class CarManageController extends BaseController {
*/ */
@PostMapping("/carListShow") @PostMapping("/carListShow")
public Result<List<CarVO>> carListShow(@RequestBody CarDTO carDTO){ public Result<List<CarVO>> carListShow(@RequestBody CarDTO carDTO){
return Result.success(sysCarService.CarListShow(carDTO)); return Result.success(carManageService.CarListShow(carDTO));
} }
/** /**
@ -71,7 +72,18 @@ public class CarManageController extends BaseController {
*/ */
@PostMapping("carManageShowByCarId") @PostMapping("carManageShowByCarId")
public Result carManageShowByCarId(@RequestParam("carId") Long carId){ public Result carManageShowByCarId(@RequestParam("carId") Long carId){
return Result.success(sysCarService.getById(carId)); return Result.success(carManageService.carManageShowByCarId(carId));
}
/**
* carTypeId
* @param carTypeId
* @return
*/
@PostMapping("carManageShowByCarTypeId")
public Result<CarManage> carManageShowByCarTypeId(@RequestParam("carTypeId") Long carTypeId){
CarManage carManage = carManageService.carManageShowByCarTypeId(carTypeId);
return Result.success(carManage);
} }
@ -88,7 +100,7 @@ public class CarManageController extends BaseController {
// 随机生成VIN码 // 随机生成VIN码
String key2 = RandomUtil.randomNumbers(17); String key2 = RandomUtil.randomNumbers(17);
carVO.setCarVin(key2); carVO.setCarVin(key2);
sysCarService.insertCar(carVO); carManageService.insertCar(carVO);
return Result.success("添加成功"); return Result.success("添加成功");
} }
@ -102,7 +114,7 @@ public class CarManageController extends BaseController {
public Result updataCar(@RequestBody CarManage carVO){ public Result updataCar(@RequestBody CarManage carVO){
// //
carVO.setUserId(SecurityUtils.getUserId()); carVO.setUserId(SecurityUtils.getUserId());
sysCarService.updateById(carVO); carManageService.updateById(carVO);
return Result.success("车辆修改成功"); return Result.success("车辆修改成功");
} }
@ -113,7 +125,7 @@ public class CarManageController extends BaseController {
*/ */
@PostMapping("deleteCar") @PostMapping("deleteCar")
public Result deleteCar(@RequestParam("ids") List<Long> ids){ public Result deleteCar(@RequestParam("ids") List<Long> ids){
sysCarService.removeBatchByIds(ids); carManageService.removeBatchByIds(ids);
return Result.success("车辆删除成功"); return Result.success("车辆删除成功");
} }

View File

@ -18,7 +18,7 @@ import java.util.List;
* -- * --
* @ClassName carMessageController * @ClassName carMessageController
* @Description Controller * @Description Controller
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@RestController @RestController

View File

@ -17,7 +17,7 @@ import java.util.List;
* -- * --
* @ClassName CarMessageTypeController * @ClassName CarMessageTypeController
* @Description Controller * @Description Controller
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@RestController @RestController

View File

@ -14,7 +14,7 @@ import java.util.List;
* -- * --
* @ClassName CarTemplateController * @ClassName CarTemplateController
* @Description Controller * @Description Controller
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@RestController @RestController

View File

@ -113,8 +113,6 @@ public class WarnRuleController extends BaseController
@GetMapping("/selectByStrategyId") @GetMapping("/selectByStrategyId")
public Result<List<WarnRule>> selectByStrategyId public Result<List<WarnRule>> selectByStrategyId
(@RequestParam("strategyId") Long strategyId){ (@RequestParam("strategyId") Long strategyId){
List<WarnRule> list = warnRuleService.list return success(warnRuleService.selectByStrategyId(strategyId));
(new LambdaQueryWrapper<WarnRule>().eq(WarnRule::getStrategyId, strategyId));
return success(list);
} }
} }

View File

@ -5,7 +5,6 @@ import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController; import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.web.page.TableDataInfo; import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.security.annotation.RequiresPermissions; import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.enterprise.domain.resp.WarnStrategy;
import com.muyu.enterprise.service.IWarnStrategyService; import com.muyu.enterprise.service.IWarnStrategyService;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
@ -27,6 +26,7 @@ import java.util.List;
@Tag(name = "故障策略",description = "故障策略对应车辆类型用来客户选择") @Tag(name = "故障策略",description = "故障策略对应车辆类型用来客户选择")
public class WarnStrategyController extends BaseController public class WarnStrategyController extends BaseController
{ {
@Resource @Resource
private IWarnStrategyService warnStrategyService; private IWarnStrategyService warnStrategyService;
@ -109,8 +109,8 @@ public class WarnStrategyController extends BaseController
* @return * @return
*/ */
@PostMapping("/strategyRuleList") @PostMapping("/strategyRuleList")
public Result<List<WarnStrategy>> StrategyRuleList(@RequestBody com.muyu.enterprise.domain.WarnStrategy warnStrategy){ public Result<List<com.muyu.enterprise.domain.WarnStrategy>> StrategyRuleList(@RequestBody com.muyu.enterprise.domain.WarnStrategy warnStrategy){
List<WarnStrategy> list = warnStrategyService.strategyList(warnStrategy); List<com.muyu.enterprise.domain.WarnStrategy> list = warnStrategyService.strategyList(warnStrategy);
return Result.success(list); return Result.success(list);
} }
} }

View File

@ -8,7 +8,7 @@ import com.muyu.enterprise.domain.CarCompany;
* -- * --
* @ClassName CarCompanyMapper * @ClassName CarCompanyMapper
* @Description Mapper * @Description Mapper
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
public interface CarCompanyMapper extends BaseMapper<CarCompany> { public interface CarCompanyMapper extends BaseMapper<CarCompany> {

View File

@ -13,7 +13,7 @@ import java.util.List;
* -- * --
* @ClassName CarManageMapper * @ClassName CarManageMapper
* @Description Mapper * @Description Mapper
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */

View File

@ -16,7 +16,7 @@ import java.util.List;
* -- * --
* @ClassName CarManageMapper * @ClassName CarManageMapper
* @Description Mapper * @Description Mapper
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Mapper @Mapper

View File

@ -9,7 +9,7 @@ import java.util.List;
* -- * --
* @ClassName CarMessageMapper * @ClassName CarMessageMapper
* @Description Mapper * @Description Mapper
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Mapper @Mapper

View File

@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper;
* -- * --
* @ClassName CarMessageTypeMapper * @ClassName CarMessageTypeMapper
* @Description Mapper * @Description Mapper
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Mapper @Mapper

View File

@ -9,7 +9,7 @@ import java.util.List;
* -- * --
* @ClassName CarTemplateMapper * @ClassName CarTemplateMapper
* @Description Mapper * @Description Mapper
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Mapper @Mapper

View File

@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param;
* -- * --
* @ClassName CarTypeMapper * @ClassName CarTypeMapper
* @Description Mapper * @Description Mapper
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Mapper @Mapper

View File

@ -15,5 +15,5 @@ import java.util.List;
@Mapper @Mapper
public interface WarnStrategyMapper extends BaseMapper<com.muyu.enterprise.domain.WarnStrategy>{ public interface WarnStrategyMapper extends BaseMapper<com.muyu.enterprise.domain.WarnStrategy>{
List<WarnStrategy> strategyList(com.muyu.enterprise.domain.WarnStrategy warnStrategy); List<com.muyu.enterprise.domain.WarnStrategy> strategyList(com.muyu.enterprise.domain.WarnStrategy warnStrategy);
} }

View File

@ -6,7 +6,7 @@ import com.muyu.enterprise.domain.CarCompany;
* -- * --
* @ClassName CarCompanyService * @ClassName CarCompanyService
* @Description Service * @Description Service
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
public interface CarCompanyService extends IService<CarCompany> { public interface CarCompanyService extends IService<CarCompany> {

View File

@ -11,7 +11,7 @@ import java.util.List;
* -- * --
* @ClassName CarConfigService * @ClassName CarConfigService
* @Description Service * @Description Service
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
public interface CarConfigService extends IService<CarConfig> { public interface CarConfigService extends IService<CarConfig> {

View File

@ -10,7 +10,7 @@ import java.util.List;
* -- * --
* @ClassName CarManageService * @ClassName CarManageService
* @Description Service * @Description Service
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
public interface CarManageService extends IService<CarManage> { public interface CarManageService extends IService<CarManage> {
@ -34,4 +34,18 @@ public interface CarManageService extends IService<CarManage> {
* @return * @return
*/ */
void insertCar(CarManage carVO); void insertCar(CarManage carVO);
/**
* carTypeId
* @param carTypeId
* @return
*/
CarManage carManageShowByCarTypeId(Long carTypeId);
/**
* id
* @param carId
* @return
*/
CarManage carManageShowByCarId(Long carId);
} }

View File

@ -8,7 +8,7 @@ import java.util.List;
* -- * --
* @ClassName CarMessageService * @ClassName CarMessageService
* @Description Service * @Description Service
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
public interface CarMessageService extends IService<CarMessage> { public interface CarMessageService extends IService<CarMessage> {

View File

@ -8,7 +8,7 @@ import java.util.List;
* -- * --
* @ClassName CarMessageTypeService * @ClassName CarMessageTypeService
* @Description Service * @Description Service
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
public interface CarMessageTypeService extends IService<CarMessageType> { public interface CarMessageTypeService extends IService<CarMessageType> {

View File

@ -8,7 +8,7 @@ import java.util.List;
* -- * --
* @ClassName CarTemplateService * @ClassName CarTemplateService
* @Description Service * @Description Service
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
public interface CarTemplateService extends IService<CarTemplate> { public interface CarTemplateService extends IService<CarTemplate> {

View File

@ -6,7 +6,7 @@ import com.muyu.enterprise.domain.CarType;
* -- * --
* @ClassName CarTypeService * @ClassName CarTypeService
* @Description Service * @Description Service
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
public interface CarTypeService extends IService<CarType> { public interface CarTypeService extends IService<CarType> {

View File

@ -35,6 +35,10 @@ public interface IWarnRuleService extends IService<WarnRule> {
*/ */
Boolean checkIdUnique(WarnRule warnRule); Boolean checkIdUnique(WarnRule warnRule);
/**
* id
* @param strategyId
* @return
*/
List<WarnRule> selectByStrategyId(Long strategyId);
} }

View File

@ -36,6 +36,6 @@ public interface IWarnStrategyService extends IService<com.muyu.enterprise.domai
Boolean checkIdUnique(com.muyu.enterprise.domain.WarnStrategy warnStrategy); Boolean checkIdUnique(com.muyu.enterprise.domain.WarnStrategy warnStrategy);
List<WarnStrategy> strategyList(com.muyu.enterprise.domain.WarnStrategy warnStrategy); List<com.muyu.enterprise.domain.WarnStrategy> strategyList(com.muyu.enterprise.domain.WarnStrategy warnStrategy);
} }

View File

@ -12,14 +12,14 @@ import org.springframework.stereotype.Service;
* -- * --
* @ClassName CarCompanyServiceImpl * @ClassName CarCompanyServiceImpl
* @Description ServiceImpl * @Description ServiceImpl
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
/** /**
* -- * --
* @ClassName CarCompanyService * @ClassName CarCompanyService
* @Description Service * @Description Service
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Service @Service

View File

@ -23,7 +23,7 @@ import java.util.List;
* -- * --
* @ClassName CarConfigServiceImpl * @ClassName CarConfigServiceImpl
* @Description ServiceImpl * @Description ServiceImpl
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Service @Service

View File

@ -3,10 +3,9 @@ package com.muyu.enterprise.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.muyu.common.core.domain.Result; import com.muyu.common.system.domain.SysEnt;
import com.muyu.common.core.utils.StringUtils; import com.muyu.common.system.remote.RemoteEntService;
import com.muyu.enterprise.cache.CarManageCacheService; import com.muyu.enterprise.cache.CarManageCacheService;
import com.muyu.enterprise.controller.CarCompanyController;
import com.muyu.enterprise.domain.CarCompany; import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.domain.CarConfig; import com.muyu.enterprise.domain.CarConfig;
import com.muyu.enterprise.domain.CarManage; import com.muyu.enterprise.domain.CarManage;
@ -16,8 +15,6 @@ import com.muyu.enterprise.mapper.CarManageMapper;
import com.muyu.enterprise.service.CarCompanyService; import com.muyu.enterprise.service.CarCompanyService;
import com.muyu.enterprise.service.CarConfigService; import com.muyu.enterprise.service.CarConfigService;
import com.muyu.enterprise.service.CarManageService; import com.muyu.enterprise.service.CarManageService;
import com.muyu.common.redis.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -28,7 +25,7 @@ import java.util.List;
* -- * --
* @ClassName CarManageServiceImpl * @ClassName CarManageServiceImpl
* @Description ServiceImpl * @Description ServiceImpl
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Service @Service
@ -42,8 +39,9 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
@Autowired @Autowired
private CarManageCacheService carManageCacheService; private CarManageCacheService carManageCacheService;
@Autowired @Autowired
private RemoteEntService remoteEntService;
@Autowired
private CarManageMapper carManageMapper; private CarManageMapper carManageMapper;
/** /**
* 2 * 2
* @param carDTO * @param carDTO
@ -53,6 +51,7 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
public List<CarVO> carListShow2(CarDTO carDTO) { public List<CarVO> carListShow2(CarDTO carDTO) {
// 获取 企业 // 获取 企业
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class); CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
List<CarManage> list = lambdaQuery() List<CarManage> list = lambdaQuery()
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin()) .eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
.eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel()) .eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel())
@ -71,14 +70,12 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
carVO.setConfigName(carConfig.getConfigName()); carVO.setConfigName(carConfig.getConfigName());
carVO.setEnergyType(carConfig.getEnergyType()); carVO.setEnergyType(carConfig.getEnergyType());
carVO.setGearType(carConfig.getGearType()); carVO.setGearType(carConfig.getGearType());
// 查询出对象,用于赋值 // 查询出对象,用于赋值 ----------远调企业
CarCompany carCompany = carCompanyService.selectCompanyByCompanyId(carVO.getEnterpriseId()); SysEnt data = remoteEntService.getById(carVO.getEnterpriseId()).getData();
carVO.setCompanyName(carCompany.getCompanyName()); carVO.setName(data.getName());
// 存到 redis // 存到 redis
carManageCacheService.put(carVO.getCarVin(),new CarManage()); carManageCacheService.put(carVO.getCarVin(),list);
}); });
return carVOS; return carVOS;
} }
@Override @Override
@ -105,9 +102,31 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
@Override @Override
public void insertCar(CarManage carVO) { public void insertCar(CarManage carVO) {
ArrayList<CarManage> carVOS = new ArrayList<>();
carVOS.add(carVO);
save(carVO); save(carVO);
// 存到缓存中去 // 存到缓存中去
carManageCacheService.put(carVO.getCarVin(),new CarManage()); carManageCacheService.put(carVO.getCarVin(),carVOS);
}
/**
* carTypeId
* @param carTypeId
* @return
*/
@Override
public CarManage carManageShowByCarTypeId(Long carTypeId) {
return getById(carTypeId);
}
/**
* id
* @param carId
* @return
*/
@Override
public CarManage carManageShowByCarId(Long carId) {
return getById(carId);
} }

View File

@ -14,7 +14,7 @@ import java.util.List;
* -- * --
* @ClassName CarMessageServiceImpl * @ClassName CarMessageServiceImpl
* @Description ServiceImpl * @Description ServiceImpl
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Service @Service

View File

@ -12,7 +12,7 @@ import java.util.List;
* -- * --
* @ClassName CarMessageTypeServiceImpl * @ClassName CarMessageTypeServiceImpl
* @Description ServiceImpl * @Description ServiceImpl
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Service @Service

View File

@ -12,7 +12,7 @@ import java.util.List;
* -- * --
* @ClassName CarTemplateServiceImpl * @ClassName CarTemplateServiceImpl
* @Description ServiceImpl * @Description ServiceImpl
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Service @Service

View File

@ -11,7 +11,7 @@ import org.springframework.stereotype.Service;
* -- * --
* @ClassName CarTypeTypeServiceImpl * @ClassName CarTypeTypeServiceImpl
* @Description ServiceImpl * @Description ServiceImpl
* @author MingWei.Zong * @author MingWei.Zong()
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Service @Service

View File

@ -57,6 +57,8 @@ public class SysCarFaultServiceImpl
SysCarFault::getCarVin, sysCarFault.getCarVin()); SysCarFault::getCarVin, sysCarFault.getCarVin());
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultWarn()), queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultWarn()),
SysCarFault::getFaultWarn, sysCarFault.getFaultWarn()); SysCarFault::getFaultWarn, sysCarFault.getFaultWarn());
return this.list(queryWrapper); return this.list(queryWrapper);
} }

View File

@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils; import com.muyu.common.core.utils.StringUtils;
import com.muyu.enterprise.domain.WarnRule; import com.muyu.enterprise.domain.WarnRule;
import com.muyu.enterprise.mapper.WarnRuleMapper; import com.muyu.enterprise.mapper.WarnRuleMapper;
import com.muyu.enterprise.service.CarManageService;
import com.muyu.enterprise.service.IWarnRuleService; import com.muyu.enterprise.service.IWarnRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -21,7 +23,6 @@ import java.util.List;
public class WarnRuleServiceImpl public class WarnRuleServiceImpl
extends ServiceImpl<WarnRuleMapper, WarnRule> extends ServiceImpl<WarnRuleMapper, WarnRule>
implements IWarnRuleService { implements IWarnRuleService {
/** /**
* *
* *
@ -84,6 +85,15 @@ public class WarnRuleServiceImpl
return this.count(queryWrapper) > 0; return this.count(queryWrapper) > 0;
} }
/**
* id
* @param strategyId
* @return
*/
@Override
public List<WarnRule> selectByStrategyId(Long strategyId) {
return list(new LambdaQueryWrapper<WarnRule>().eq(WarnRule::getStrategyId, strategyId));
}
} }

View File

@ -1,15 +1,24 @@
package com.muyu.enterprise.service.impl; package com.muyu.enterprise.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils; import com.muyu.common.core.utils.StringUtils;
import com.muyu.enterprise.domain.resp.WarnStrategy; import com.muyu.enterprise.cache.CarManageCacheService;
import com.muyu.enterprise.cache.CarWarnCacheService;
import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.WarnRule;
import com.muyu.enterprise.domain.WarnStrategy;
import com.muyu.enterprise.domain.vo.WarnVo;
import com.muyu.enterprise.mapper.WarnStrategyMapper; import com.muyu.enterprise.mapper.WarnStrategyMapper;
import com.muyu.enterprise.service.CarManageService;
import com.muyu.enterprise.service.IWarnRuleService;
import com.muyu.enterprise.service.IWarnStrategyService; import com.muyu.enterprise.service.IWarnStrategyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@ -23,6 +32,12 @@ public class WarnStrategyServiceImpl
extends ServiceImpl<WarnStrategyMapper, com.muyu.enterprise.domain.WarnStrategy> extends ServiceImpl<WarnStrategyMapper, com.muyu.enterprise.domain.WarnStrategy>
implements IWarnStrategyService { implements IWarnStrategyService {
@Autowired
private CarManageService carManageService;
@Resource
private IWarnRuleService warnRuleService;
@Autowired
private CarWarnCacheService carWarnCacheService;
@Autowired @Autowired
private WarnStrategyMapper warnStrategyMapper; private WarnStrategyMapper warnStrategyMapper;
@ -61,7 +76,27 @@ public class WarnStrategyServiceImpl
if (StringUtils.isNotNull(warnStrategy.getTemplateId())){ if (StringUtils.isNotNull(warnStrategy.getTemplateId())){
queryWrapper.eq(com.muyu.enterprise.domain.WarnStrategy::getTemplateId, warnStrategy.getTemplateId()); queryWrapper.eq(com.muyu.enterprise.domain.WarnStrategy::getTemplateId, warnStrategy.getTemplateId());
} }
return this.list(queryWrapper); // 1.获取 车辆 vin 码
CarManage carManage = carManageService.carManageShowByCarTypeId(warnStrategy.getCarTypeId());
List<WarnStrategy> list = list(queryWrapper);
WarnVo warnVo = new WarnVo();
// 遍历 赋值
list.forEach(warnStrategy1 -> {
// 2.查询 对应的策略有没有规则
List<WarnRule> warnRules = warnRuleService.selectByStrategyId(warnStrategy1.getId());
// 3.判断有没有对应的规则
if(warnRules.size()!=0){// 有规则
// 把查询出来的预警规则放入自定义的实体类
warnVo.setWarnRuleList(warnRules);
}
warnVo.setId(warnStrategy1.getId());
warnVo.setCarTypeId(warnStrategy1.getCarTypeId());
warnVo.setStrategyName(warnStrategy1.getStrategyName());
warnVo.setTemplateId(warnStrategy1.getTemplateId());
});
// 存储到 redis 中去
carWarnCacheService.put(carManage.getCarVin(),warnVo);
return list;
} }
/** /**
@ -77,7 +112,7 @@ public class WarnStrategyServiceImpl
} }
@Override @Override
public List<WarnStrategy> strategyList(com.muyu.enterprise.domain.WarnStrategy warnStrategy) { public List<com.muyu.enterprise.domain.WarnStrategy> strategyList(com.muyu.enterprise.domain.WarnStrategy warnStrategy) {
return warnStrategyMapper.strategyList(warnStrategy); return warnStrategyMapper.strategyList(warnStrategy);
} }

View File

@ -41,7 +41,7 @@ public class EntResp {
* *
*/ */
@Schema(title = "手机号码", type = "String", defaultValue = "18321974313", description = "手机号码") @Schema(title = "手机号码", type = "String", defaultValue = "18321974313", description = "手机号码")
private String phoneNumber; private String phone;
/** /**
* *
@ -71,7 +71,7 @@ public class EntResp {
.entId(sysEnt.getId()) .entId(sysEnt.getId())
.entName(sysEnt.getName()) .entName(sysEnt.getName())
.leader(sysEnt.getLeader()) .leader(sysEnt.getLeader())
.phoneNumber(sysEnt.getPhone()) .phone(sysEnt.getPhone())
.email(sysEnt.getEmail()) .email(sysEnt.getEmail())
.entCode(sysEnt.getEntCode()) .entCode(sysEnt.getEntCode())
.entStatus(sysEnt.getEntStatus()) .entStatus(sysEnt.getEntStatus())

15
pom.xml
View File

@ -53,6 +53,7 @@
<mybatis.plus.join.version>1.4.13</mybatis.plus.join.version> <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> <org.eclipse.paho.client.mqttv3.version>1.2.5</org.eclipse.paho.client.mqttv3.version>
<caffeine.version>3.1.8</caffeine.version> <caffeine.version>3.1.8</caffeine.version>
<mybatis.plus.join.version>1.4.13</mybatis.plus.join.version>
</properties> </properties>
<!-- 依赖声明 --> <!-- 依赖声明 -->
@ -270,6 +271,20 @@
<version>${caffeine.version}</version> <version>${caffeine.version}</version>
</dependency> </dependency>
<!-- Swagger -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- MyBatisPlus - 依赖包 -->
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join</artifactId>
<version>${mybatis.plus.join.version}</version>
</dependency>
<!-- 核心模块 --> <!-- 核心模块 -->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>