find()预警缓存
parent
7d0d0418c6
commit
ecd84b4672
|
@ -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:","");
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,3 +6,4 @@ com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService
|
||||||
com.muyu.enterprise.cache.fence.VehicleCacheFenceService
|
com.muyu.enterprise.cache.fence.VehicleCacheFenceService
|
||||||
com.muyu.enterprise.cache.fence.VehicleCacheFenceAddService
|
com.muyu.enterprise.cache.fence.VehicleCacheFenceAddService
|
||||||
com.muyu.enterprise.cache.fault.VehicleCacheFaultService
|
com.muyu.enterprise.cache.fault.VehicleCacheFaultService
|
||||||
|
com.muyu.enterprise.cache.warn.VehicleCacheWarnService
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue