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
* @Description CacheAbsBasic:
* @Date 2024/9/30 1:39
* @author MingWei.Zong
* @author MingWei.Zong()
*/
import com.muyu.common.redis.service.RedisService;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
* @ClassName SwaggerWebConfiguration
* @Description SwaggerWebConfiguration:
* @Date 2024/10/6 22:16
* @author MingWei.Zong
* @author MingWei.Zong()
*/
public class SwaggerWebConfiguration implements WebMvcConfigurer {
@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.RemoteLogFallbackFactory
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
* @Description CarCompanyCacheService:
* @Date 2024/10/3 15:22
* @author MingWei.Zong
* @author MingWei.Zong()
*/
public class CarCompanyCacheService extends CacheAbsBasic<String, CarCompany> {

View File

@ -1,26 +1,28 @@
package com.muyu.enterprise.cache;
import com.muyu.common.cache.config.CacheAbsBasic;
import com.muyu.enterprise.domain.FaultRule;
import org.springframework.stereotype.Component;
import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.domain.FaultType;
import com.muyu.enterprise.domain.SysCarFault;
/**
* redis
* @ClassName CarFaultCacheService
* @Description CarFaultCacheService:
* @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
public String keyPre() {
return "faultRule:info:";
return "sysCarFault:info:";
}
@Override
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.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.vo.CarVO;
import java.util.List;
/**
* redis
* @ClassName CarManageCacheService
* @Description CarManageCacheService:
* @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
public String keyPre() {
return "carManage:info:";

View File

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

View File

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

View File

@ -1,26 +1,27 @@
package com.muyu.enterprise.cache;
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
* @ClassName CarWarnCacheService
* @Description CarWarnCacheService:
* @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
public String keyPre() {
return "warnRule:info:";
return "warnStrategy:info:";
}
@Override
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
* @Description
* @author MingWei.Zong
* @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/
@Data

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -96,6 +96,11 @@ public class CarVO {
/** 所属企业 */
private Long enterpriseId;
/**
* id
*/
private Long CarTypeId;
// /** 车辆车型(如客车,卡车,公交车等) */
@ -122,6 +127,6 @@ public class CarVO {
*
*/
@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>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join</artifactId>
<version>1.4.13</version>
</dependency>
</dependencies>
<build>

View File

@ -4,6 +4,8 @@ import com.muyu.common.security.annotation.EnableCustomConfig;
import com.muyu.common.security.annotation.EnableMyFeignClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
/**
*
@ -16,26 +18,34 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class CloudEnterpriseApplication {
public static void main (String[] args) {
SpringApplication.run(CloudEnterpriseApplication.class, args);
System.out.println(" _ooOoo_\n" +
" o8888888o\n" +
" 88\" . \"88\n" +
" (| -_- |)\n" +
" O\\ = /O\n" +
" ____/`---'\\____\n" +
" .' \\\\| |// `.\n" +
" / \\\\||| : |||// \\\n" +
" / _||||| -:- |||||- \\\n" +
" | | \\\\\\ - /// | |\n" +
" | \\_| ''\\---/'' | |\n" +
" \\ .-\\__ `-` ___/-. /\n" +
" ___`. .' /--.--\\ `. . __\n" +
" .\"\" '< `.___\\_<|>_/___.' >'\"\".\n" +
" | | : `- \\`.;`\\ _ /`;.`/ - ` : | |\n" +
" \\ \\ `-. \\_ __\\ /__ _/ .-` / /\n" +
" ======`-.____`-.___\\_____/___.-`____.-'======\n" +
" `=---='\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
" // 佛祖保佑 永不宕机 永无BUG //");
}
System.out.println(" _ooOoo_\n" +
" o8888888o\n" +
" 88\" . \"88\n" +
" (| -_- |)\n" +
" O\\ = /O\n" +
" ____/`---'\\____\n" +
" .' \\\\| |// `.\n" +
" / \\\\||| : |||// \\\n" +
" / _||||| -:- |||||- \\\n" +
" | | \\\\\\ - /// | |\n" +
" | \\_| ''\\---/'' | |\n" +
" \\ .-\\__ `-` ___/-. /\n" +
" ___`. .' /--.--\\ `. . __\n" +
" .\"\" '< `.___\\_<|>_/___.' >'\"\".\n" +
" | | : `- \\`.;`\\ _ /`;.`/ - ` : | |\n" +
" \\ \\ `-. \\_ __\\ /__ _/ .-` / /\n" +
" ======`-.____`-.___\\_____/___.-`____.-'======\n" +
" `=---='\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
" // 佛祖保佑 永不宕机 永无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
* @Description Controller
* @author MingWei.Zong
* @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/
@RestController

View File

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

View File

@ -5,6 +5,7 @@ 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.CarMessage;
import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO;
import com.muyu.enterprise.service.CarCompanyService;
@ -25,7 +26,7 @@ import java.util.List;
* --
* @ClassName CarManageController
* @Description Controller
* @author MingWei.Zong
* @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/
@RestController
@ -39,7 +40,7 @@ public class CarManageController extends BaseController {
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){
startPage();
// 存到缓存中去
return Result.success(sysCarService.carListShow2(carDTO));
return Result.success(carManageService.carListShow2(carDTO));
}
/**
@ -61,7 +62,7 @@ public class CarManageController extends BaseController {
*/
@PostMapping("/carListShow")
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")
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码
String key2 = RandomUtil.randomNumbers(17);
carVO.setCarVin(key2);
sysCarService.insertCar(carVO);
carManageService.insertCar(carVO);
return Result.success("添加成功");
}
@ -102,7 +114,7 @@ public class CarManageController extends BaseController {
public Result updataCar(@RequestBody CarManage carVO){
//
carVO.setUserId(SecurityUtils.getUserId());
sysCarService.updateById(carVO);
carManageService.updateById(carVO);
return Result.success("车辆修改成功");
}
@ -113,7 +125,7 @@ public class CarManageController extends BaseController {
*/
@PostMapping("deleteCar")
public Result deleteCar(@RequestParam("ids") List<Long> ids){
sysCarService.removeBatchByIds(ids);
carManageService.removeBatchByIds(ids);
return Result.success("车辆删除成功");
}

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,5 +15,5 @@ import java.util.List;
@Mapper
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
* @Description Service
* @author MingWei.Zong
* @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/
public interface CarCompanyService extends IService<CarCompany> {

View File

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

View File

@ -10,7 +10,7 @@ import java.util.List;
* --
* @ClassName CarManageService
* @Description Service
* @author MingWei.Zong
* @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/
public interface CarManageService extends IService<CarManage> {
@ -34,4 +34,18 @@ public interface CarManageService extends IService<CarManage> {
* @return
*/
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
* @Description Service
* @author MingWei.Zong
* @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/
public interface CarMessageService extends IService<CarMessage> {

View File

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

View File

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

View File

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

View File

@ -35,6 +35,10 @@ public interface IWarnRuleService extends IService<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);
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
* @Description ServiceImpl
* @author MingWei.Zong
* @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/
/**
* --
* @ClassName CarCompanyService
* @Description Service
* @author MingWei.Zong
* @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/
@Service

View File

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

View File

@ -3,10 +3,9 @@ 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.common.system.domain.SysEnt;
import com.muyu.common.system.remote.RemoteEntService;
import com.muyu.enterprise.cache.CarManageCacheService;
import com.muyu.enterprise.controller.CarCompanyController;
import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.domain.CarConfig;
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.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;
@ -28,7 +25,7 @@ import java.util.List;
* --
* @ClassName CarManageServiceImpl
* @Description ServiceImpl
* @author MingWei.Zong
* @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/
@Service
@ -42,8 +39,9 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
@Autowired
private CarManageCacheService carManageCacheService;
@Autowired
private RemoteEntService remoteEntService;
@Autowired
private CarManageMapper carManageMapper;
/**
* 2
* @param carDTO
@ -53,6 +51,7 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
public List<CarVO> carListShow2(CarDTO carDTO) {
// 获取 企业
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
List<CarManage> list = lambdaQuery()
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
.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.setEnergyType(carConfig.getEnergyType());
carVO.setGearType(carConfig.getGearType());
// 查询出对象,用于赋值
CarCompany carCompany = carCompanyService.selectCompanyByCompanyId(carVO.getEnterpriseId());
carVO.setCompanyName(carCompany.getCompanyName());
// 查询出对象,用于赋值 ----------远调企业
SysEnt data = remoteEntService.getById(carVO.getEnterpriseId()).getData();
carVO.setName(data.getName());
// 存到 redis
carManageCacheService.put(carVO.getCarVin(),new CarManage());
carManageCacheService.put(carVO.getCarVin(),list);
});
return carVOS;
}
@Override
@ -105,9 +102,31 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
@Override
public void insertCar(CarManage carVO) {
ArrayList<CarManage> carVOS = new ArrayList<>();
carVOS.add(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
* @Description ServiceImpl
* @author MingWei.Zong
* @author MingWei.Zong()
* @Date 2024/9/28 16:52
*/
@Service

View File

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

View File

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

View File

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

View File

@ -57,6 +57,8 @@ public class SysCarFaultServiceImpl
SysCarFault::getCarVin, sysCarFault.getCarVin());
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultWarn()),
SysCarFault::getFaultWarn, sysCarFault.getFaultWarn());
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.enterprise.domain.WarnRule;
import com.muyu.enterprise.mapper.WarnRuleMapper;
import com.muyu.enterprise.service.CarManageService;
import com.muyu.enterprise.service.IWarnRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
@ -21,7 +23,6 @@ import java.util.List;
public class WarnRuleServiceImpl
extends ServiceImpl<WarnRuleMapper, WarnRule>
implements IWarnRuleService {
/**
*
*
@ -84,6 +85,15 @@ public class WarnRuleServiceImpl
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;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.service.CarManageService;
import com.muyu.enterprise.service.IWarnRuleService;
import com.muyu.enterprise.service.IWarnStrategyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.List;
/**
@ -23,6 +32,12 @@ public class WarnStrategyServiceImpl
extends ServiceImpl<WarnStrategyMapper, com.muyu.enterprise.domain.WarnStrategy>
implements IWarnStrategyService {
@Autowired
private CarManageService carManageService;
@Resource
private IWarnRuleService warnRuleService;
@Autowired
private CarWarnCacheService carWarnCacheService;
@Autowired
private WarnStrategyMapper warnStrategyMapper;
@ -61,7 +76,27 @@ public class WarnStrategyServiceImpl
if (StringUtils.isNotNull(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
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);
}

View File

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

15
pom.xml
View File

@ -53,6 +53,7 @@
<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>
<mybatis.plus.join.version>1.4.13</mybatis.plus.join.version>
</properties>
<!-- 依赖声明 -->
@ -270,6 +271,20 @@
<version>${caffeine.version}</version>
</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>
<groupId>com.muyu</groupId>