Merge branch 'dev' into dev.carData
commit
5d4b1dbe67
|
@ -2,7 +2,6 @@ package com.muyu.auth.controller;
|
||||||
|
|
||||||
import com.muyu.auth.form.LoginBody;
|
import com.muyu.auth.form.LoginBody;
|
||||||
import com.muyu.auth.form.RegisterBody;
|
import com.muyu.auth.form.RegisterBody;
|
||||||
import com.muyu.auth.remote.RunCarConditionRemote;
|
|
||||||
import com.muyu.auth.service.SysLoginService;
|
import com.muyu.auth.service.SysLoginService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.JwtUtils;
|
import com.muyu.common.core.utils.JwtUtils;
|
||||||
|
@ -35,16 +34,12 @@ public class TokenController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysLoginService sysLoginService;
|
private SysLoginService sysLoginService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RunCarConditionRemote runCarCondition;
|
|
||||||
|
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
public Result<?> login (@RequestBody LoginBody form) {
|
public Result<?> login (@RequestBody LoginBody form) {
|
||||||
// 用户登录
|
// 用户登录
|
||||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),form.getFirmName());
|
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),form.getFirmName());
|
||||||
// 获取登录token
|
// 获取登录token
|
||||||
Map<String, Object> token = tokenService.createToken(userInfo);
|
Map<String, Object> token = tokenService.createToken(userInfo);
|
||||||
runCarCondition.runCarCondition();
|
|
||||||
return Result.success(token);
|
return Result.success(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.muyu.auth.remote;
|
|
||||||
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:yang
|
|
||||||
* @Package:com.muyu.auth.remote
|
|
||||||
* @Project:cloud-server-8
|
|
||||||
* @name:RunCarConditionRemote
|
|
||||||
* @Date:2024/10/8 22:21
|
|
||||||
*/
|
|
||||||
@FeignClient(name = "cloud-electronic")
|
|
||||||
public interface RunCarConditionRemote {
|
|
||||||
|
|
||||||
@GetMapping("/text")
|
|
||||||
public void runCarCondition();
|
|
||||||
}
|
|
|
@ -3,18 +3,19 @@ package com.muyu.enterprise.cache.car;
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
import com.muyu.domain.CarInformation;
|
import com.muyu.domain.CarInformation;
|
||||||
import com.muyu.domain.resp.CarFenceGroupResp;
|
import com.muyu.domain.resp.CarFenceGroupResp;
|
||||||
|
import com.muyu.domain.resp.CarInformationResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆
|
* 车辆缓存
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
* @Package:com.muyu.cache
|
* @Package:com.muyu.cache
|
||||||
* @Project:cloud-server-8
|
* @Project:cloud-server-8
|
||||||
* @name:VehicleCacheService
|
* @name:VehicleCacheService
|
||||||
* @Date:2024/9/30 11:50
|
* @Date:2024/9/30 11:50
|
||||||
*/
|
*/
|
||||||
public class VehicleCacheCarInformationService extends CacheAbsBasic<String, List<CarInformation>> {
|
public class VehicleCacheCarInformationService extends CacheAbsBasic<String, List<CarInformationResp>> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "CarInformation:info:";
|
return "CarInformation:info:";
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.muyu.domain.req.CarInformationAddReq;
|
||||||
import com.muyu.domain.req.CarInformationUpdReq;
|
import com.muyu.domain.req.CarInformationUpdReq;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改车辆信息
|
* 车辆管理修改缓存
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
* @Package:com.muyu.cache
|
* @Package:com.muyu.cache
|
||||||
* @Project:cloud-server-8
|
* @Project:cloud-server-8
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
package com.muyu.enterprise.cache.car;
|
package com.muyu.enterprise.cache.car;
|
||||||
|
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
import com.muyu.domain.req.CarInformationAddReq;
|
import com.muyu.domain.CarFence;
|
||||||
import com.muyu.domain.resp.CarInformationResp;
|
import com.muyu.domain.CarType;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆基础信息列表缓存
|
* 车辆类型表缓存
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
* @Package:com.muyu.cache
|
* @Package:com.muyu.cache
|
||||||
* @Project:cloud-server-8
|
* @Project:cloud-server-8
|
||||||
* @name:VehicleCacheService
|
* @name:VehicleCacheService
|
||||||
* @Date:2024/9/30 11:50
|
* @Date:2024/9/30 11:50
|
||||||
*/
|
*/
|
||||||
public class VehicleCacheCarInformationFenceRespService extends CacheAbsBasic<String, List<CarInformationResp>> {
|
public class VehicleCacheCarTypeService extends CacheAbsBasic<String, CarType> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "CarInformationFenceResp:info:";
|
return "CarType:info:";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.enterprise.cache.fault;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
|
import com.muyu.domain.FaultCode;
|
||||||
|
import com.muyu.domain.resp.CarFenceResp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障码缓存
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.cache
|
||||||
|
* @Project:cloud-server-8
|
||||||
|
* @name:VehicleCacheService
|
||||||
|
* @Date:2024/9/30 11:50
|
||||||
|
*/
|
||||||
|
public class VehicleCacheFaultService extends CacheAbsBasic<String, FaultCode> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "FaultCode:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("vehicle:info:","");
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ import com.muyu.domain.req.CarInformationAddReq;
|
||||||
import com.muyu.domain.req.FaultCodeAddReq;
|
import com.muyu.domain.req.FaultCodeAddReq;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加车辆信息
|
* 添加故障码缓存
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
* @Package:com.muyu.cache
|
* @Package:com.muyu.cache
|
||||||
* @Project:cloud-server-8
|
* @Project:cloud-server-8
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.enterprise.cache.fence;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
|
import com.muyu.domain.CarFence;
|
||||||
|
import com.muyu.domain.resp.CarFenceResp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏add缓存
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.cache
|
||||||
|
* @Project:cloud-server-8
|
||||||
|
* @name:VehicleCacheService
|
||||||
|
* @Date:2024/9/30 11:50
|
||||||
|
*/
|
||||||
|
public class VehicleCacheFenceAddService extends CacheAbsBasic<String, CarFence> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "CarFenceAdd:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("vehicle:info:","");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,24 +1,24 @@
|
||||||
package com.muyu.enterprise.cache.car;
|
package com.muyu.enterprise.cache.fence;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
|
import com.muyu.domain.CarFence;
|
||||||
import com.muyu.domain.CarInformation;
|
import com.muyu.domain.CarInformation;
|
||||||
import com.muyu.domain.resp.CarInformationResp;
|
import com.muyu.domain.resp.CarFenceResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询车辆信息
|
* 电子围栏缓存
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
* @Package:com.muyu.cache
|
* @Package:com.muyu.cache
|
||||||
* @Project:cloud-server-8
|
* @Project:cloud-server-8
|
||||||
* @name:VehicleCacheService
|
* @name:VehicleCacheService
|
||||||
* @Date:2024/9/30 11:50
|
* @Date:2024/9/30 11:50
|
||||||
*/
|
*/
|
||||||
public class VehicleCacheCarInformationRespService extends CacheAbsBasic<String, Page<CarInformationResp>> {
|
public class VehicleCacheFenceService extends CacheAbsBasic<String, CarFenceResp> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "CarInformationResp:info:";
|
return "CarFenceResp:info:";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.enterprise.cache.warn;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
|
import com.muyu.domain.WarnStrategy;
|
||||||
|
import com.muyu.domain.resp.CarFenceResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏缓存
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.cache
|
||||||
|
* @Project:cloud-server-8
|
||||||
|
* @name:VehicleCacheService
|
||||||
|
* @Date:2024/9/30 11:50
|
||||||
|
*/
|
||||||
|
public class VehicleCacheWarnService extends CacheAbsBasic<String, List<WarnStrategy>> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "WarnStrategy:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("vehicle:info:","");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationService
|
com.muyu.enterprise.cache.car.VehicleCacheCarInformationService
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationRespService
|
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationAddService
|
com.muyu.enterprise.cache.car.VehicleCacheCarInformationAddService
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationUpdService
|
com.muyu.enterprise.cache.car.VehicleCacheCarInformationUpdService
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationFenceRespService
|
com.muyu.enterprise.cache.car.VehicleCacheCarTypeService
|
||||||
com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService
|
com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService
|
||||||
|
com.muyu.enterprise.cache.fence.VehicleCacheFenceService
|
||||||
|
com.muyu.enterprise.cache.fence.VehicleCacheFenceAddService
|
||||||
|
com.muyu.enterprise.cache.fault.VehicleCacheFaultService
|
||||||
|
com.muyu.enterprise.cache.warn.VehicleCacheWarnService
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -25,6 +27,7 @@ public class CarFenceClazz {
|
||||||
/**
|
/**
|
||||||
* 业务类型ID
|
* 业务类型ID
|
||||||
*/
|
*/
|
||||||
|
@TableId(value = "clazz_id",type = IdType.AUTO)
|
||||||
private Integer clazzId;
|
private Integer clazzId;
|
||||||
/**
|
/**
|
||||||
* 业务类型名称
|
* 业务类型名称
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -25,6 +27,7 @@ public class CarFenceType {
|
||||||
/**
|
/**
|
||||||
* 围栏类型ID
|
* 围栏类型ID
|
||||||
*/
|
*/
|
||||||
|
@TableId(value = "type_id",type = IdType.AUTO)
|
||||||
private Integer typeId;
|
private Integer typeId;
|
||||||
/**
|
/**
|
||||||
* 围栏类型名称
|
* 围栏类型名称
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -25,6 +27,7 @@ public class CarMessage {
|
||||||
/**
|
/**
|
||||||
* 自增主键
|
* 自增主键
|
||||||
*/
|
*/
|
||||||
|
@TableId(value = "message_type_id",type = IdType.AUTO)
|
||||||
private Long messageTypeId;
|
private Long messageTypeId;
|
||||||
/**
|
/**
|
||||||
* 报文编码
|
* 报文编码
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -26,7 +28,8 @@ public class CarType {
|
||||||
/**
|
/**
|
||||||
* 车辆类型ID
|
* 车辆类型ID
|
||||||
*/
|
*/
|
||||||
private long carTypeId;
|
@TableId(value = "car_type_id",type = IdType.AUTO)
|
||||||
|
private Long carTypeId;
|
||||||
/**
|
/**
|
||||||
* 车辆类型名
|
* 车辆类型名
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class FaultCode {
|
||||||
*故障码Id
|
*故障码Id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "faultcode_id",type = IdType.AUTO)
|
@TableId(value = "faultcode_id",type = IdType.AUTO)
|
||||||
private long faultcodeId;
|
private Long faultcodeId;
|
||||||
/**
|
/**
|
||||||
*故障名称Id
|
*故障名称Id
|
||||||
*/
|
*/
|
||||||
|
@ -97,7 +97,7 @@ public class FaultCode {
|
||||||
|
|
||||||
public static FaultCode updfaultcode(FaultCodeUpdReq faultCodeUpdReq){
|
public static FaultCode updfaultcode(FaultCodeUpdReq faultCodeUpdReq){
|
||||||
return FaultCode.builder()
|
return FaultCode.builder()
|
||||||
.faultcodeId(0)
|
.faultcodeId(0L)
|
||||||
.messageTypeId(faultCodeUpdReq.getMessageTypeId())
|
.messageTypeId(faultCodeUpdReq.getMessageTypeId())
|
||||||
.faultcodeNumber(faultCodeUpdReq.getFaultcodeNumber())
|
.faultcodeNumber(faultCodeUpdReq.getFaultcodeNumber())
|
||||||
.faultGroup(faultCodeUpdReq.getFaultGroup())
|
.faultGroup(faultCodeUpdReq.getFaultGroup())
|
||||||
|
|
|
@ -23,25 +23,15 @@ import java.util.List;
|
||||||
@Tag(name = "故障码,电子围栏,车辆,报文")
|
@Tag(name = "故障码,电子围栏,车辆,报文")
|
||||||
public class FaultCodeCache {
|
public class FaultCodeCache {
|
||||||
|
|
||||||
/**
|
|
||||||
* 电子围栏信息
|
|
||||||
*/
|
|
||||||
private List<CarFence> carFences;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障标签信息
|
|
||||||
*/
|
|
||||||
private WarnStrategy warnStrategies;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆信息
|
* 车辆信息
|
||||||
*/
|
*/
|
||||||
public List<CarInformation> carInformation;
|
public CarInformation carInformation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障码信息
|
* 故障码信息
|
||||||
*/
|
*/
|
||||||
private List<FaultCode> faultCode;
|
private FaultCode faultCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障标签
|
* 故障标签
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class FaultCondition {
|
||||||
* 故障规则表Id
|
* 故障规则表Id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "carcondition_id",type = IdType.AUTO)
|
@TableId(value = "carcondition_id",type = IdType.AUTO)
|
||||||
private long carconditionId;
|
private Long carconditionId;
|
||||||
/**
|
/**
|
||||||
* 车辆类型Id
|
* 车辆类型Id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class FaultLabel {
|
||||||
*自增主键
|
*自增主键
|
||||||
*/
|
*/
|
||||||
@TableId(value = "message_type_id",type = IdType.AUTO)
|
@TableId(value = "message_type_id",type = IdType.AUTO)
|
||||||
private long messageTypeId;
|
private Long messageTypeId;
|
||||||
/**
|
/**
|
||||||
*报文编码
|
*报文编码
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class FaultLog {
|
||||||
* 故障日志Id
|
* 故障日志Id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "log_id",type = IdType.AUTO)
|
@TableId(value = "log_id",type = IdType.AUTO)
|
||||||
private long logId;
|
private Long logId;
|
||||||
/**
|
/**
|
||||||
* 故障码Id
|
* 故障码Id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class FaultType {
|
||||||
*故障类型Id
|
*故障类型Id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "faulttype_id",type = IdType.AUTO)
|
@TableId(value = "faulttype_id",type = IdType.AUTO)
|
||||||
private long faulttypeId;
|
private Long faulttypeId;
|
||||||
/**
|
/**
|
||||||
*故障类型名称
|
*故障类型名称
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class FirmPermission {
|
||||||
* 企业权限Id
|
* 企业权限Id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "permission_id")
|
@TableId(value = "permission_id")
|
||||||
private long permissionId;
|
private Long permissionId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限等级
|
* 权限等级
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class Message {
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id",type = IdType.AUTO)
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
private long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送者
|
* 发送者
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class CarFenceController {
|
||||||
@Validated @RequestBody CarFenceReq req
|
@Validated @RequestBody CarFenceReq req
|
||||||
){
|
){
|
||||||
Page<CarFenceResp> connects = carFenceService.selectCarFence(req);
|
Page<CarFenceResp> connects = carFenceService.selectCarFence(req);
|
||||||
|
|
||||||
log.info("查询数据:"+ connects);
|
log.info("查询数据:"+ connects);
|
||||||
|
|
||||||
return Result.success(
|
return Result.success(
|
||||||
|
|
|
@ -35,32 +35,21 @@ public class CarInformationController {
|
||||||
@Resource
|
@Resource
|
||||||
private CarInformationService carInformationService;
|
private CarInformationService carInformationService;
|
||||||
private VehicleCacheCarInformationService vehicleCacheCarInformationService;
|
private VehicleCacheCarInformationService vehicleCacheCarInformationService;
|
||||||
private VehicleCacheCarInformationRespService vehicleCacheCarInformationRespService;
|
|
||||||
private VehicleCacheCarInformationAddService vehicleCacheCarInformationAddService;
|
private VehicleCacheCarInformationAddService vehicleCacheCarInformationAddService;
|
||||||
private VehicleCacheCarInformationUpdService vehicleCacheCarInformationUpdService;
|
private VehicleCacheCarInformationUpdService vehicleCacheCarInformationUpdService;
|
||||||
private VehicleCacheCarInformationFenceRespService vehicleCacheCarInformationFenceRespService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询围栏业务信息
|
* 查询车辆业务信息
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectCarInformation")
|
@PostMapping("/selectCarInformation")
|
||||||
@Operation(summary = "查询数据",description = "查询数据")
|
@Operation(summary = "查询数据",description = "查询数据")
|
||||||
public Result<List<CarInformation>> selectConnect(){
|
public Result<List<CarInformation>> selectConnect(){
|
||||||
List<CarInformation> carFenceRespPage = vehicleCacheCarInformationService
|
|
||||||
.get(vehicleCacheCarInformationService
|
|
||||||
.keyPre()+ ObtainRootLogin
|
|
||||||
.obtain());
|
|
||||||
if (CollectionUtils.isEmpty(carFenceRespPage)) {
|
|
||||||
return Result.success(carFenceRespPage);
|
|
||||||
}
|
|
||||||
List<CarInformation> connects = carInformationService.list()
|
List<CarInformation> connects = carInformationService.list()
|
||||||
.stream()
|
.stream()
|
||||||
.map(CarInformation::carInformationBuilder)
|
.map(CarInformation::carInformationBuilder)
|
||||||
.toList();
|
.toList();
|
||||||
vehicleCacheCarInformationService.put(
|
|
||||||
vehicleCacheCarInformationService.keyPre()+ObtainRootLogin.obtain()
|
|
||||||
,connects);
|
|
||||||
return Result.success(
|
return Result.success(
|
||||||
connects, "操作成功"
|
connects, "操作成功"
|
||||||
);
|
);
|
||||||
|
@ -88,18 +77,14 @@ public class CarInformationController {
|
||||||
@Operation(summary = "企业车辆管理列表")
|
@Operation(summary = "企业车辆管理列表")
|
||||||
public Result<Page<CarInformationResp>> selectCarInformationList(@Validated @RequestBody CarInformationListReq carInformationListReq) {
|
public Result<Page<CarInformationResp>> selectCarInformationList(@Validated @RequestBody CarInformationListReq carInformationListReq) {
|
||||||
|
|
||||||
Page<CarInformationResp> carFenceRespPage = vehicleCacheCarInformationRespService
|
|
||||||
.get(vehicleCacheCarInformationRespService
|
|
||||||
.keyPre()+ ObtainRootLogin
|
|
||||||
.obtain());
|
|
||||||
if (CollectionUtils.isEmpty(carFenceRespPage.getRecords())) {
|
|
||||||
return Result.success(carFenceRespPage);
|
|
||||||
}
|
|
||||||
Page<CarInformationResp> pageInfo = carInformationService.selectCarInformationList(carInformationListReq);
|
Page<CarInformationResp> pageInfo = carInformationService.selectCarInformationList(carInformationListReq);
|
||||||
log.info("企业车辆管理列表查询",carInformationListReq,pageInfo);
|
log.info("企业车辆管理列表查询",carInformationListReq,pageInfo);
|
||||||
vehicleCacheCarInformationRespService.put(
|
List<CarInformationResp> records = pageInfo.getRecords();
|
||||||
vehicleCacheCarInformationRespService.keyPre()+ObtainRootLogin.obtain()
|
records.forEach(carInformation -> {
|
||||||
,pageInfo);
|
vehicleCacheCarInformationService.put(
|
||||||
|
vehicleCacheCarInformationService.keyPre()+carInformation.getCarInformationVIN()
|
||||||
|
,records);
|
||||||
|
});
|
||||||
return Result.success(pageInfo);
|
return Result.success(pageInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -116,7 +101,7 @@ public class CarInformationController {
|
||||||
|
|
||||||
vehicleCacheCarInformationAddService.put(
|
vehicleCacheCarInformationAddService.put(
|
||||||
vehicleCacheCarInformationAddService
|
vehicleCacheCarInformationAddService
|
||||||
.keyPre()+ObtainRootLogin.obtain(), carInformationAddReq);
|
.keyPre()+carInformationAddReq.getCarInformationVIN(), carInformationAddReq);
|
||||||
return carInformationService.addCarInformation(carInformationAddReq)
|
return carInformationService.addCarInformation(carInformationAddReq)
|
||||||
?Result.success("添加车辆成功")
|
?Result.success("添加车辆成功")
|
||||||
:Result.error(402,"添加车辆失败");
|
:Result.error(402,"添加车辆失败");
|
||||||
|
@ -169,17 +154,8 @@ public class CarInformationController {
|
||||||
@GetMapping("/selectCarInformationIdAndLicensePlate")
|
@GetMapping("/selectCarInformationIdAndLicensePlate")
|
||||||
@Operation(summary = "查询企业车辆 carInformationID 和 carInformationLicensePlate")
|
@Operation(summary = "查询企业车辆 carInformationID 和 carInformationLicensePlate")
|
||||||
public Result<List<CarInformationResp>> selectCarInformationIdAndLicensePlate(){
|
public Result<List<CarInformationResp>> selectCarInformationIdAndLicensePlate(){
|
||||||
List<CarInformationResp> carFenceRespPage = vehicleCacheCarInformationFenceRespService
|
|
||||||
.get(vehicleCacheCarInformationFenceRespService
|
|
||||||
.keyPre()+ ObtainRootLogin
|
|
||||||
.obtain());
|
|
||||||
if (CollectionUtils.isEmpty(carFenceRespPage)) {
|
|
||||||
return Result.success(carFenceRespPage);
|
|
||||||
}
|
|
||||||
List<CarInformationResp> carInformations = carInformationService.selectBycarInformationIDAndLicensePlate();
|
List<CarInformationResp> carInformations = carInformationService.selectBycarInformationIDAndLicensePlate();
|
||||||
vehicleCacheCarInformationFenceRespService.put(
|
|
||||||
vehicleCacheCarInformationFenceRespService.keyPre()+ObtainRootLogin.obtain()
|
|
||||||
,carInformations);
|
|
||||||
return Result.success(carInformations);
|
return Result.success(carInformations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
package com.muyu.server.controller;
|
package com.muyu.server.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.domain.CarInformation;
|
||||||
import com.muyu.domain.CarType;
|
import com.muyu.domain.CarType;
|
||||||
|
import com.muyu.enterprise.cache.car.VehicleCacheCarTypeService;
|
||||||
|
import com.muyu.server.service.CarInformationService;
|
||||||
import com.muyu.server.service.CarTypeService;
|
import com.muyu.server.service.CarTypeService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆类型控制层
|
* 车辆类型控制层
|
||||||
|
@ -23,10 +28,12 @@ import java.util.List;
|
||||||
|
|
||||||
@RequestMapping("/cartype")
|
@RequestMapping("/cartype")
|
||||||
@RestController
|
@RestController
|
||||||
|
@AllArgsConstructor
|
||||||
public class CarTypeController {
|
public class CarTypeController {
|
||||||
|
|
||||||
@Autowired
|
private final CarTypeService carTypeService;
|
||||||
private CarTypeService carTypeService;
|
private final CarInformationService carInformationService;
|
||||||
|
private final VehicleCacheCarTypeService vehicleCacheCarTypeService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,7 +45,16 @@ public class CarTypeController {
|
||||||
public Result carTypeList(){
|
public Result carTypeList(){
|
||||||
|
|
||||||
List<CarType> data = carTypeService.selectcarType();
|
List<CarType> data = carTypeService.selectcarType();
|
||||||
|
data.forEach(carType -> {
|
||||||
|
List<CarInformation> list = carInformationService.list(new LambdaQueryWrapper<CarInformation>()
|
||||||
|
.eq(CarInformation::getCarInformationType, carType.getCarTypeId()));
|
||||||
|
list.forEach(carInformation -> {
|
||||||
|
vehicleCacheCarTypeService
|
||||||
|
.put(vehicleCacheCarTypeService
|
||||||
|
.keyPre()+carInformation
|
||||||
|
.getCarInformationVIN(),carType);
|
||||||
|
});
|
||||||
|
});
|
||||||
return Result.success(data);
|
return Result.success(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.muyu.domain.resp.FaultCodeTotalListResp;
|
||||||
import com.muyu.server.service.FaultCodeService;
|
import com.muyu.server.service.FaultCodeService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -25,11 +25,12 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/faultcode")
|
@RequestMapping("/faultcode")
|
||||||
|
@AllArgsConstructor
|
||||||
@Tag(name = "车辆故障码控制层",description = "从故障信息表中查询数据")
|
@Tag(name = "车辆故障码控制层",description = "从故障信息表中查询数据")
|
||||||
public class FaultCodeController {
|
public class FaultCodeController {
|
||||||
|
|
||||||
@Autowired
|
private final FaultCodeService faultCodeService;
|
||||||
private FaultCodeService faultCodeService;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,10 +59,7 @@ public class FaultConditionController {
|
||||||
if (faultConditionList.size()>0){
|
if (faultConditionList.size()>0){
|
||||||
return Result.error("此车辆类型已存在所对应的故障规则,无需重新制定,可在原规则上进行修改");
|
return Result.error("此车辆类型已存在所对应的故障规则,无需重新制定,可在原规则上进行修改");
|
||||||
}
|
}
|
||||||
boolean save = faultConditionService.save(FaultCondition.faultConditionadd(faultConditionAddReq));
|
faultConditionService.save(FaultCondition.faultConditionadd(faultConditionAddReq));
|
||||||
if (save){
|
|
||||||
faultConditionService.RunCarCondition();
|
|
||||||
}
|
|
||||||
return Result.success(null,"规则制定成功");
|
return Result.success(null,"规则制定成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,4 @@ public interface FaultConditionService extends IService<FaultCondition> {
|
||||||
*/
|
*/
|
||||||
List<FaultCondition> saveFaultConditionList();
|
List<FaultCondition> saveFaultConditionList();
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加缓存
|
|
||||||
*/
|
|
||||||
void RunCarCondition();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,11 @@ import com.muyu.domain.req.*;
|
||||||
import com.muyu.domain.resp.CarFenceGroupResp;
|
import com.muyu.domain.resp.CarFenceGroupResp;
|
||||||
import com.muyu.domain.resp.CarFenceGroupsResp;
|
import com.muyu.domain.resp.CarFenceGroupsResp;
|
||||||
import com.muyu.domain.resp.CarFenceResp;
|
import com.muyu.domain.resp.CarFenceResp;
|
||||||
|
import com.muyu.enterprise.cache.fence.VehicleCacheFenceAddService;
|
||||||
|
import com.muyu.enterprise.cache.fence.VehicleCacheFenceService;
|
||||||
import com.muyu.server.mapper.CarFenceMapper;
|
import com.muyu.server.mapper.CarFenceMapper;
|
||||||
import com.muyu.server.service.*;
|
import com.muyu.server.service.*;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -28,6 +31,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Log4j2
|
@Log4j2
|
||||||
|
@AllArgsConstructor
|
||||||
public class CarFenceServiceImpl
|
public class CarFenceServiceImpl
|
||||||
extends ServiceImpl<CarFenceMapper, CarFence>
|
extends ServiceImpl<CarFenceMapper, CarFence>
|
||||||
implements CarFenceService {
|
implements CarFenceService {
|
||||||
|
@ -44,6 +48,8 @@ public class CarFenceServiceImpl
|
||||||
private CarMiddleSerivce carMiddleSerivce;
|
private CarMiddleSerivce carMiddleSerivce;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CarInformationService carInformationService;
|
private CarInformationService carInformationService;
|
||||||
|
private final VehicleCacheFenceService vehicleCacheFenceService;
|
||||||
|
private final VehicleCacheFenceAddService vehicleCacheFenceAddService;
|
||||||
/**
|
/**
|
||||||
* 查询围栏信息
|
* 查询围栏信息
|
||||||
*/
|
*/
|
||||||
|
@ -83,8 +89,9 @@ public class CarFenceServiceImpl
|
||||||
.toList();
|
.toList();
|
||||||
List<CarFence> carFenceList = carFencePage.getRecords();
|
List<CarFence> carFenceList = carFencePage.getRecords();
|
||||||
this.optimizeEntity(carFenceList,carFenceClazzList,carFenceTypeList);
|
this.optimizeEntity(carFenceList,carFenceClazzList,carFenceTypeList);
|
||||||
|
|
||||||
//构建一个新的分页响应对象
|
//构建一个新的分页响应对象
|
||||||
return new Page<>() {{
|
Page<CarFenceResp> carFenceRespPage = new Page<>() {{
|
||||||
//从查询结果中获取记录,并使用流式处理将每条记录转换为EtlDataScoreResp对象
|
//从查询结果中获取记录,并使用流式处理将每条记录转换为EtlDataScoreResp对象
|
||||||
List<CarFenceResp> etlDataScoreRespList = carFencePage.getRecords().stream()
|
List<CarFenceResp> etlDataScoreRespList = carFencePage.getRecords().stream()
|
||||||
//使用map操作将EtlDataScore对象转换为EtlDataScoreResp对象
|
//使用map操作将EtlDataScore对象转换为EtlDataScoreResp对象
|
||||||
|
@ -100,6 +107,17 @@ public class CarFenceServiceImpl
|
||||||
//设置分页响应中的每页记录数
|
//设置分页响应中的每页记录数
|
||||||
setSize(carFencePage.getSize());
|
setSize(carFencePage.getSize());
|
||||||
}};
|
}};
|
||||||
|
List<CarFenceResp> records = carFenceRespPage.getRecords();
|
||||||
|
records.forEach(carFenceResp -> {
|
||||||
|
List<CarInformation> list = carInformationService
|
||||||
|
.list(new LambdaQueryWrapper<CarInformation>()
|
||||||
|
.eq(CarInformation::getCarInformationFence, carFenceResp.getId()));
|
||||||
|
list.forEach(carInformation -> {
|
||||||
|
vehicleCacheFenceService.put(vehicleCacheFenceService.keyPre()+carInformation.getCarInformationVIN(),carFenceResp);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
return carFenceRespPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,6 +136,12 @@ public class CarFenceServiceImpl
|
||||||
carMiddleGroup.setFenceGroupId(carFenceGroup.getId());
|
carMiddleGroup.setFenceGroupId(carFenceGroup.getId());
|
||||||
carMiddleGroupService.save(carMiddleGroup);
|
carMiddleGroupService.save(carMiddleGroup);
|
||||||
});
|
});
|
||||||
|
List<CarInformation> list = carInformationService
|
||||||
|
.list(new LambdaQueryWrapper<CarInformation>()
|
||||||
|
.eq(CarInformation::getCarInformationFence, carFence.getId()));
|
||||||
|
list.forEach(carInformation -> {
|
||||||
|
vehicleCacheFenceAddService.put(vehicleCacheFenceAddService.keyPre()+carInformation.getCarInformationVIN(),carFence);
|
||||||
|
});
|
||||||
return connects;
|
return connects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,9 @@ import com.muyu.domain.req.FaultCodeUpdReq;
|
||||||
import com.muyu.domain.resp.FaultCodeListResp;
|
import com.muyu.domain.resp.FaultCodeListResp;
|
||||||
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
||||||
import com.muyu.domain.resp.FaultConditionListResp;
|
import com.muyu.domain.resp.FaultConditionListResp;
|
||||||
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
|
import com.muyu.domain.resp.FaultConditionResp;
|
||||||
|
import com.muyu.enterprise.cache.car.VehicleCacheCarInformationService;
|
||||||
|
import com.muyu.enterprise.cache.fault.VehicleCacheFaultService;
|
||||||
import com.muyu.server.mapper.FaultCodeMapper;
|
import com.muyu.server.mapper.FaultCodeMapper;
|
||||||
import com.muyu.server.service.CarFenceService;
|
import com.muyu.server.service.CarFenceService;
|
||||||
import com.muyu.server.service.CarInformationService;
|
import com.muyu.server.service.CarInformationService;
|
||||||
|
@ -54,7 +56,7 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
||||||
long count = this.count(queryWrapper);
|
long count = this.count(queryWrapper);
|
||||||
|
|
||||||
MPJLambdaWrapper<FaultCode> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<FaultCode> wrapper = new MPJLambdaWrapper<>();
|
||||||
wrapper.select(
|
MPJLambdaWrapper<FaultCode> eq = wrapper.select(
|
||||||
FaultCode::getFaultcodeId,
|
FaultCode::getFaultcodeId,
|
||||||
FaultCode::getMessageTypeId,
|
FaultCode::getMessageTypeId,
|
||||||
FaultCode::getFaultcodeNumber,
|
FaultCode::getFaultcodeNumber,
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.muyu.server.service.impl;
|
||||||
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.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
|
||||||
import com.muyu.domain.*;
|
import com.muyu.domain.*;
|
||||||
import com.muyu.domain.req.FaultConditionAddReq;
|
import com.muyu.domain.req.FaultConditionAddReq;
|
||||||
import com.muyu.domain.req.FaultConditionListReq;
|
import com.muyu.domain.req.FaultConditionListReq;
|
||||||
|
@ -12,12 +11,11 @@ import com.muyu.domain.resp.FaultConditionTotalListResp;
|
||||||
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
|
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
|
||||||
import com.muyu.server.mapper.FaultConditionMapper;
|
import com.muyu.server.mapper.FaultConditionMapper;
|
||||||
import com.muyu.server.service.*;
|
import com.muyu.server.service.*;
|
||||||
import com.muyu.server.util.RunCarCondition;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,12 +35,12 @@ public class FaultConditionServiceImpl
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaultConditionMapper faultConditionMapper;
|
private FaultConditionMapper faultConditionMapper;
|
||||||
private final VehicleCacheFaultCodeAddService vehicleCacheFaultCodeAddService;
|
|
||||||
private final CarInformationService carInformationService;
|
private final CarInformationService carInformationService;
|
||||||
private final CarFenceService carFenceService;
|
private final CarFenceService carFenceService;
|
||||||
private final WarnStrategyService warnStrategyService;
|
private final WarnStrategyService warnStrategyService;
|
||||||
private final FaultCodeService faultCodeService;
|
private final FaultCodeService faultCodeService;
|
||||||
private final FaultLabelService faultLabelService;
|
private final FaultLabelService faultLabelService;
|
||||||
|
private final VehicleCacheFaultCodeAddService vehicleCacheFaultCodeAddService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,9 +72,36 @@ public class FaultConditionServiceImpl
|
||||||
}
|
}
|
||||||
wrapper.last("LIMIT "+ ((faultConditionListReq.getPageNum()-1)*faultConditionListReq.getPageSize())+", "+faultConditionListReq.getPageSize());
|
wrapper.last("LIMIT "+ ((faultConditionListReq.getPageNum()-1)*faultConditionListReq.getPageSize())+", "+faultConditionListReq.getPageSize());
|
||||||
List<FaultConditionListResp> faultConditionListResps = faultConditionMapper.selectJoinList(FaultConditionListResp.class, wrapper);
|
List<FaultConditionListResp> faultConditionListResps = faultConditionMapper.selectJoinList(FaultConditionListResp.class, wrapper);
|
||||||
|
//添加故障车辆缓存
|
||||||
|
this.CacheFault(faultConditionListResps);
|
||||||
return FaultConditionTotalListResp.faultConditionTotalListResp(faultConditionListResps,count);
|
return FaultConditionTotalListResp.faultConditionTotalListResp(faultConditionListResps,count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CacheFault(@NotNull List<FaultConditionListResp> faultConditionListResps) {
|
||||||
|
faultConditionListResps.forEach(faultConditionListResp -> {
|
||||||
|
List<CarInformation> list = carInformationService
|
||||||
|
.list(new LambdaQueryWrapper<CarInformation>()
|
||||||
|
.eq(CarInformation::getCarInformationType, faultConditionListResp.getCarTypeId()));
|
||||||
|
list.forEach(carInformation -> {
|
||||||
|
List<FaultCode> list1 = faultCodeService.list(new LambdaQueryWrapper<FaultCode>()
|
||||||
|
.eq(FaultCode::getFaultcodeId, faultConditionListResp.getMessageTypeId()));
|
||||||
|
list1.forEach(faultCode -> {
|
||||||
|
FaultCodeCache faultCodeCache = new FaultCodeCache();
|
||||||
|
faultCodeCache.setCarInformation(carInformation);
|
||||||
|
faultCodeCache.setFaultCode(faultCode);
|
||||||
|
FaultLabel faultLabel = new FaultLabel();
|
||||||
|
faultLabel.setMessageTypeId(faultConditionListResp.getMessageTypeId());
|
||||||
|
faultLabel.setMessageTypeName(faultConditionListResp.getMessageTypeName());
|
||||||
|
faultLabel.setMessageTypeCode(faultConditionListResp.getMessageTypeCode());
|
||||||
|
faultCodeCache.setFaultLabels(faultLabel);
|
||||||
|
vehicleCacheFaultCodeAddService.put(vehicleCacheFaultCodeAddService
|
||||||
|
.keyPre()+carInformation
|
||||||
|
.getCarInformationVIN(),faultCodeCache);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障规则添加 判断故障规则是否存在
|
* 故障规则添加 判断故障规则是否存在
|
||||||
|
@ -90,6 +115,7 @@ public class FaultConditionServiceImpl
|
||||||
queryWrapper.eq(FaultCondition::getCarTypeId,faultConditionAddReq.getCarTypeId())
|
queryWrapper.eq(FaultCondition::getCarTypeId,faultConditionAddReq.getCarTypeId())
|
||||||
.eq(FaultCondition::getMessageTypeId,faultConditionAddReq.getMessageTypeId());
|
.eq(FaultCondition::getMessageTypeId,faultConditionAddReq.getMessageTypeId());
|
||||||
List<FaultCondition> list = this.list(queryWrapper);
|
List<FaultCondition> list = this.list(queryWrapper);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,67 +124,4 @@ public class FaultConditionServiceImpl
|
||||||
List<FaultCondition> list = this.list();
|
List<FaultCondition> list = this.list();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加缓存
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void RunCarCondition() {
|
|
||||||
List<FaultCondition> list = this.saveFaultConditionList();
|
|
||||||
text(list, carInformationService, carFenceService, warnStrategyService, faultCodeService, faultLabelService, vehicleCacheFaultCodeAddService);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void text(List<FaultCondition> list, CarInformationService carInformationService, CarFenceService carFenceService, WarnStrategyService warnStrategyService, FaultCodeService faultCodeService, FaultLabelService faultLabelService, VehicleCacheFaultCodeAddService vehicleCacheFaultCodeAddService) {
|
|
||||||
list.forEach(faultCondition -> {
|
|
||||||
List<CarInformation> carInformationList = carInformationService.selectCarInformation(faultCondition.getCarTypeId());
|
|
||||||
carInformationList.forEach(carInformation -> {
|
|
||||||
FaultCodeCache faultCodeCache = new FaultCodeCache();
|
|
||||||
if (StringUtils.isNotNull(carInformation.getCarInformationFence())){
|
|
||||||
faultCodeCache.setCarFences(carFenceService.CarFenceList(carInformation.getCarInformationFence()));
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotNull(carInformation.getCarInformationState())) {
|
|
||||||
faultCodeCache.setWarnStrategies(warnStrategyService
|
|
||||||
.selectWarnStrategyById(Long.valueOf(carInformation.getCarInformationState())));
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotNull(faultCondition.getMessageTypeId())) {
|
|
||||||
faultCodeCache.setFaultCode(faultCodeService.faultCodeList(faultCondition.getMessageTypeId()));
|
|
||||||
faultCodeCache.setFaultLabels(faultLabelService.faultLabelList(faultCondition.getMessageTypeId()));
|
|
||||||
}
|
|
||||||
ArrayList<CarInformation> carInformations = new ArrayList<>();
|
|
||||||
carInformations.add(carInformation);
|
|
||||||
faultCodeCache.setCarInformation(carInformations);
|
|
||||||
vehicleCacheFaultCodeAddService.put(vehicleCacheFaultCodeAddService
|
|
||||||
.keyPre()+carInformation
|
|
||||||
.getCarInformationVIN(), faultCodeCache);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// private void faultCache(long messageTypeId, Long faulttypeId,String faultcodeNumber) {
|
|
||||||
// FaultCodeCache faultCodeCache = new FaultCodeCache();
|
|
||||||
//
|
|
||||||
// //添加故障标签
|
|
||||||
// faultCodeCache.getFaultLabels().addAll(faultLabelService.selectFaultCode(messageTypeId));
|
|
||||||
//
|
|
||||||
// //添加车辆
|
|
||||||
// List<CarInformation> carInformationList = carInformationService.selectCarInformation(faulttypeId);
|
|
||||||
// faultCodeCache.getCarInformation().addAll(carInformationList);
|
|
||||||
//
|
|
||||||
// //添加故障码
|
|
||||||
// faultCodeCache.getFaultCode().addAll(this.list(new LambdaQueryWrapper<FaultCode>()
|
|
||||||
// .eq(FaultCode::getFaultcodeNumber, faultcodeNumber))
|
|
||||||
// .stream().map(FaultCode::faultCodeBuilder)
|
|
||||||
// .toList());
|
|
||||||
//
|
|
||||||
// //添加围栏
|
|
||||||
// ArrayList<CarFence> carFences1 = new ArrayList<>();
|
|
||||||
// carInformationList.forEach(carInformation -> {
|
|
||||||
// CarFence carFence = carFenceService.selectCarFenceList(carInformation.getCarInformationFence());
|
|
||||||
// carFences1.add(carFence);
|
|
||||||
// });
|
|
||||||
// faultCodeCache.getCarFences().addAll(carFences1);
|
|
||||||
// vehicleCacheFaultCodeAddService.put(vehicleCacheFaultCodeAddService.keyPre()
|
|
||||||
// + ObtainRootLogin.obtain()
|
|
||||||
// , faultCodeCache);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,15 @@ package com.muyu.server.service.impl;
|
||||||
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.domain.CarInformation;
|
||||||
import com.muyu.domain.CarType;
|
import com.muyu.domain.CarType;
|
||||||
import com.muyu.domain.WarnStrategy;
|
import com.muyu.domain.WarnStrategy;
|
||||||
import com.muyu.domain.req.WarnStrategyReq;
|
import com.muyu.domain.req.WarnStrategyReq;
|
||||||
|
import com.muyu.enterprise.cache.warn.VehicleCacheWarnService;
|
||||||
import com.muyu.server.mapper.WarnStrategyMapper;
|
import com.muyu.server.mapper.WarnStrategyMapper;
|
||||||
|
import com.muyu.server.service.CarInformationService;
|
||||||
import com.muyu.server.service.WarnStrategyService;
|
import com.muyu.server.service.WarnStrategyService;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
@ -23,10 +27,14 @@ import java.util.List;
|
||||||
* @Date:2024/9/20 下午7:29
|
* @Date:2024/9/20 下午7:29
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
public class WarnStrategyServiceImpl
|
public class WarnStrategyServiceImpl
|
||||||
extends ServiceImpl<WarnStrategyMapper, WarnStrategy>
|
extends ServiceImpl<WarnStrategyMapper, WarnStrategy>
|
||||||
implements WarnStrategyService {
|
implements WarnStrategyService {
|
||||||
|
|
||||||
|
private final CarInformationService carInformationService;
|
||||||
|
private final VehicleCacheWarnService vehicleCacheWarnService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 精确查询预警策略
|
* 精确查询预警策略
|
||||||
*
|
*
|
||||||
|
@ -62,7 +70,16 @@ public class WarnStrategyServiceImpl
|
||||||
if (StringUtils.isNotNull(warnStrategy.getMsgId())){
|
if (StringUtils.isNotNull(warnStrategy.getMsgId())){
|
||||||
queryWrapper.eq(WarnStrategy::getMsgId, warnStrategy.getMsgId());
|
queryWrapper.eq(WarnStrategy::getMsgId, warnStrategy.getMsgId());
|
||||||
}
|
}
|
||||||
return this.list(queryWrapper);
|
List<WarnStrategy> list = this.list(queryWrapper);
|
||||||
|
list.forEach(warnStrategy1 -> {
|
||||||
|
List<CarInformation> list1 = carInformationService
|
||||||
|
.list(new LambdaQueryWrapper<CarInformation>()
|
||||||
|
.eq(CarInformation::getCarInformationType, warnStrategy1.getCarTypeId()));
|
||||||
|
list1.forEach(carInformation -> {
|
||||||
|
vehicleCacheWarnService.put(vehicleCacheWarnService.keyPre()+carInformation.getCarInformationVIN(),list);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
package com.muyu.server.util;
|
|
||||||
|
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
|
||||||
import com.muyu.domain.*;
|
|
||||||
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
|
|
||||||
import com.muyu.server.service.*;
|
|
||||||
import com.muyu.server.service.impl.FaultConditionServiceImpl;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录存储redis缓存
|
|
||||||
* @Author:yang
|
|
||||||
* @Package:com.muyu.server.util
|
|
||||||
* @Project:cloud-server-8
|
|
||||||
* @name:RunCarCondition
|
|
||||||
* @Date:2024/10/7 19:43
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class RunCarCondition {
|
|
||||||
|
|
||||||
private final VehicleCacheFaultCodeAddService vehicleCacheFaultCodeAddService;
|
|
||||||
private final FaultConditionService faultConditionService;
|
|
||||||
private final CarInformationService carInformationService;
|
|
||||||
private final CarFenceService carFenceService;
|
|
||||||
private final WarnStrategyService warnStrategyService;
|
|
||||||
private final FaultCodeService faultCodeService;
|
|
||||||
private final FaultLabelService faultLabelService;
|
|
||||||
|
|
||||||
@GetMapping("text")
|
|
||||||
public void runCarCondition(){
|
|
||||||
List<FaultCondition> list = faultConditionService.saveFaultConditionList();
|
|
||||||
FaultConditionServiceImpl.text(list, carInformationService, carFenceService, warnStrategyService, faultCodeService, faultLabelService, vehicleCacheFaultCodeAddService);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue