feat:()添加存储围栏组Redis信息方法
parent
813fcf1b55
commit
f166853e31
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.49.53:8848
|
addr: 47.101.49.53:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: seven
|
namespace: fence
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.49.53:8848
|
addr: 47.101.49.53:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: seven
|
namespace: fence
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.BoundMiddle;
|
||||||
|
import com.muyu.domain.resp.BoundFenceGroup;
|
||||||
|
import com.muyu.domain.resp.FenceResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有电子围栏缓存
|
||||||
|
*/
|
||||||
|
public class AllFenceGroupCahceService extends CacheAbsBacis<String, List<BoundFenceGroup>> {
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "AllFenceGroup:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("AllFenceGroup:info:", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,11 +1,12 @@
|
||||||
package com.muyu.enterprise.cache;
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
import com.muyu.common.cache.CacheAbsBacis;
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.FaultInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障缓存服务
|
* 故障缓存服务
|
||||||
*/
|
*/
|
||||||
public class FaultCacheService extends CacheAbsBacis {
|
public class FaultCacheService extends CacheAbsBacis<String, FaultInfo> {
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.Fence;
|
||||||
|
import com.muyu.domain.FenceGroup;
|
||||||
|
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||||
|
import com.muyu.domain.req.FenceGroupAddReq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏缓存
|
||||||
|
*/
|
||||||
|
public class FenceGroupCahceService extends CacheAbsBacis<String, BoundFenceGroupReq> {
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "fenceGroup:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("fenceGroup:info:", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
com.muyu.enterprise.cache.AllFaultCacheService
|
com.muyu.enterprise.cache.AllFaultCacheService
|
||||||
com.muyu.enterprise.cache.AllFenceCahceService
|
com.muyu.enterprise.cache.AllFenceCahceService
|
||||||
|
com.muyu.enterprise.cache.AllFenceGroupCahceService
|
||||||
com.muyu.enterprise.cache.AllMessageValueCacheService
|
com.muyu.enterprise.cache.AllMessageValueCacheService
|
||||||
com.muyu.enterprise.cache.AllVehicleCacheService
|
com.muyu.enterprise.cache.AllVehicleCacheService
|
||||||
com.muyu.enterprise.cache.AllVehicleTypeCacheService
|
com.muyu.enterprise.cache.AllVehicleTypeCacheService
|
||||||
|
@ -8,6 +9,7 @@ com.muyu.enterprise.cache.AllWarnStrategyAndVinCacheService
|
||||||
com.muyu.enterprise.cache.AllWarnStrategyCacheService
|
com.muyu.enterprise.cache.AllWarnStrategyCacheService
|
||||||
com.muyu.enterprise.cache.FaultCacheService
|
com.muyu.enterprise.cache.FaultCacheService
|
||||||
com.muyu.enterprise.cache.FenceCahceService
|
com.muyu.enterprise.cache.FenceCahceService
|
||||||
|
com.muyu.enterprise.cache.FenceGroupCahceService
|
||||||
com.muyu.enterprise.cache.MessageTemplateCacheService
|
com.muyu.enterprise.cache.MessageTemplateCacheService
|
||||||
com.muyu.enterprise.cache.MessageValueCacheService
|
com.muyu.enterprise.cache.MessageValueCacheService
|
||||||
com.muyu.enterprise.cache.VehicleCacheService
|
com.muyu.enterprise.cache.VehicleCacheService
|
||||||
|
|
|
@ -123,6 +123,13 @@ public class Vehicle extends BaseEntity {
|
||||||
@Schema(type = "Long",description = "策略id")
|
@Schema(type = "Long",description = "策略id")
|
||||||
private Long warnStrategyId;
|
private Long warnStrategyId;
|
||||||
|
|
||||||
|
|
||||||
|
/** 故障id */
|
||||||
|
@Schema(type = "Long",description = "策略id")
|
||||||
|
private Long faultId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static Vehicle addBuild(VehicleAddReq vehicleAddReq){
|
public static Vehicle addBuild(VehicleAddReq vehicleAddReq){
|
||||||
return Vehicle.builder()
|
return Vehicle.builder()
|
||||||
.licenceNumber(vehicleAddReq.getLicenceNumber())
|
.licenceNumber(vehicleAddReq.getLicenceNumber())
|
||||||
|
@ -137,6 +144,7 @@ public class Vehicle extends BaseEntity {
|
||||||
.companyId(vehicleAddReq.getCompanyId())
|
.companyId(vehicleAddReq.getCompanyId())
|
||||||
.fenceGroupId(vehicleAddReq.getFenceGroupId())
|
.fenceGroupId(vehicleAddReq.getFenceGroupId())
|
||||||
.warnStrategyId(vehicleAddReq.getWarnStrategyId())
|
.warnStrategyId(vehicleAddReq.getWarnStrategyId())
|
||||||
|
.faultId(vehicleAddReq.getFaultId())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +163,7 @@ public class Vehicle extends BaseEntity {
|
||||||
.companyId(vehicleUpdReq.getCompanyId())
|
.companyId(vehicleUpdReq.getCompanyId())
|
||||||
.fenceGroupId(vehicleUpdReq.getFenceGroupId())
|
.fenceGroupId(vehicleUpdReq.getFenceGroupId())
|
||||||
.warnStrategyId(vehicleUpdReq.getWarnStrategyId())
|
.warnStrategyId(vehicleUpdReq.getWarnStrategyId())
|
||||||
|
.faultId(vehicleUpdReq.getFaultId())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,4 +101,9 @@ public class VehicleAddReq {
|
||||||
@Schema(type = "Long",description = "策略id")
|
@Schema(type = "Long",description = "策略id")
|
||||||
@TableId( type = IdType.AUTO)
|
@TableId( type = IdType.AUTO)
|
||||||
private Long warnStrategyId;
|
private Long warnStrategyId;
|
||||||
|
|
||||||
|
/** 故障id */
|
||||||
|
@Schema(type = "Long",description = "策略id")
|
||||||
|
private Long faultId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,5 +102,8 @@ public class VehicleUpdReq {
|
||||||
@TableId( type = IdType.AUTO)
|
@TableId( type = IdType.AUTO)
|
||||||
private Long warnStrategyId;
|
private Long warnStrategyId;
|
||||||
|
|
||||||
|
/** 故障id */
|
||||||
|
@Schema(type = "Long",description = "策略id")
|
||||||
|
private Long faultId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Tag(name = "车辆绑定的围栏组", description = "车辆绑定的围栏组")
|
||||||
|
public class BoundFenceGroup {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "fence_group_id" ,type = IdType.AUTO)
|
||||||
|
@Schema(type = "Long",description = "围栏组id")
|
||||||
|
private Long fenceGroupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优先级
|
||||||
|
*/
|
||||||
|
@Schema(type = "String",description = "优先级")
|
||||||
|
private String priority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 0:启用 1:禁止
|
||||||
|
*/
|
||||||
|
@Schema(type = "Integer",description = "状态 0:启用 1:禁止")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组类型
|
||||||
|
*/
|
||||||
|
@Schema(type = "String",description = "围栏组类型")
|
||||||
|
private String groupType;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -19,12 +19,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:ChenYan
|
* 故障管理
|
||||||
* @Project:2112-car-cloud-server
|
|
||||||
* @Package:com.muyu.fault.controller
|
|
||||||
* @Filename:FaultController
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2024/9/17 11:08
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.enterprise.controller;
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
|
import com.muyu.enterprise.cache.FaultCacheService;
|
||||||
import com.muyu.enterprise.service.FaultInfoService;
|
import com.muyu.enterprise.service.FaultInfoService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
@ -38,6 +39,8 @@ public class FaultInfoController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaultInfoService service;
|
private FaultInfoService service;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FaultCacheService faultCacheService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆故障管理列表
|
* 查询车辆故障管理列表
|
||||||
|
@ -80,8 +83,10 @@ public class FaultInfoController extends BaseController {
|
||||||
@Log(title = "车辆故障管理", businessType = BusinessType.INSERT)
|
@Log(title = "车辆故障管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@RequiresPermissions("fault:info:add")
|
@RequiresPermissions("fault:info:add")
|
||||||
public Result add(@RequestBody FaultInfo fault) {
|
public Result add(@RequestBody FaultInfo faultInfo) {
|
||||||
service.save(fault);
|
service.save(faultInfo);
|
||||||
|
//添加的数据存进缓存
|
||||||
|
// faultCacheService.put(faultInfo.);
|
||||||
return Result.success(null, "成功");
|
return Result.success(null, "成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:ChenYan
|
* 故障日志
|
||||||
* @Project:2112-car-cloud-server
|
|
||||||
* @Package:com.muyu.fault.controller
|
|
||||||
* @Filename:FaultLogController
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2024/9/16 20:20
|
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/log")
|
@RequestMapping("/log")
|
||||||
|
|
|
@ -17,12 +17,7 @@ import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: LiDongJia
|
* 报文模版控制层
|
||||||
* @Package: com.muyu.car.controller
|
|
||||||
* @Project: 2112-car-cloud-server
|
|
||||||
* @name: MessageTypeController
|
|
||||||
* @Date: 2024/9/18 20:18
|
|
||||||
* @Description: 报文模版控制层
|
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RestController
|
@RestController
|
||||||
|
|
|
@ -17,12 +17,7 @@ import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: LiDongJia
|
* 报文数据控制层
|
||||||
* @Package: com.muyu.car.controller
|
|
||||||
* @Project: 2112-car-cloud-server
|
|
||||||
* @name: MessageValueController
|
|
||||||
* @Date: 2024/9/19 15:46
|
|
||||||
* @Description: 报文数据控制层
|
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RestController
|
@RestController
|
||||||
|
|
|
@ -12,6 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中间表Controller
|
||||||
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RequestMapping("/middle")
|
@RequestMapping("/middle")
|
||||||
@RestController
|
@RestController
|
||||||
|
|
|
@ -22,12 +22,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:ChenYan
|
* 故障规则
|
||||||
* @Project:2112-car-cloud-server
|
|
||||||
* @Package:com.muyu.fault.controller
|
|
||||||
* @Filename:RuleController
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2024/9/21 18:42
|
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RestController
|
@RestController
|
||||||
|
|
|
@ -4,12 +4,10 @@ import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.domain.WarnStrategy;
|
import com.muyu.domain.WarnStrategy;
|
||||||
import com.muyu.domain.req.BoundFenceGroupReq;
|
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||||
|
import com.muyu.domain.resp.BoundFenceGroup;
|
||||||
import com.muyu.domain.resp.WarnRuleResp;
|
import com.muyu.domain.resp.WarnRuleResp;
|
||||||
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||||
import com.muyu.enterprise.cache.AllVehicleCacheService;
|
import com.muyu.enterprise.cache.*;
|
||||||
import com.muyu.enterprise.cache.AllWarnStrategyAndVinCacheService;
|
|
||||||
import com.muyu.enterprise.cache.VehicleCacheService;
|
|
||||||
import com.muyu.enterprise.cache.WarnStrategyCacheService;
|
|
||||||
import com.muyu.enterprise.service.VehicleService;
|
import com.muyu.enterprise.service.VehicleService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
@ -35,12 +33,7 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: LiDongJia
|
* 车辆管理控制层
|
||||||
* @Package: com.muyu.car.controller
|
|
||||||
* @Project: 2112-car-cloud-server
|
|
||||||
* @name: VehicleController
|
|
||||||
* @Date: 2024/9/17 17:35
|
|
||||||
* @Description: 车辆管理控制层
|
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -65,6 +58,12 @@ public class VehicleController extends BaseController {
|
||||||
private WarnStrategyService warnStrategyService;
|
private WarnStrategyService warnStrategyService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WarnStrategyCacheService warnStrategyCacheService;
|
private WarnStrategyCacheService warnStrategyCacheService;
|
||||||
|
//添加围栏组缓存信息
|
||||||
|
@Autowired
|
||||||
|
private FenceGroupCahceService fenceGroupCahceService;
|
||||||
|
//绑定的围栏组信息
|
||||||
|
@Autowired
|
||||||
|
private AllFenceGroupCahceService allFenceGroupCahceService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,10 +80,17 @@ public class VehicleController extends BaseController {
|
||||||
List<Vehicle> vehicleList = vehicleService.list();
|
List<Vehicle> vehicleList = vehicleService.list();
|
||||||
vehicleList.forEach(vehicle -> {
|
vehicleList.forEach(vehicle -> {
|
||||||
vehicleCacheService.put(vehicle.getVehicleVin(), vehicle);
|
vehicleCacheService.put(vehicle.getVehicleVin(), vehicle);
|
||||||
|
//根据车辆vin存储策略已经规则信息
|
||||||
if(vehicle.getWarnStrategyId()!=null){
|
if(vehicle.getWarnStrategyId()!=null){
|
||||||
WarnRuleResp respList = warnStrategyService.findByWarnStrategyId(vehicle.getWarnStrategyId());
|
WarnRuleResp respList = warnStrategyService.findByWarnStrategyId(vehicle.getWarnStrategyId());
|
||||||
warnStrategyCacheService.put(vehicle.getVehicleVin(), respList);
|
warnStrategyCacheService.put(vehicle.getVehicleVin(), respList);
|
||||||
}
|
}
|
||||||
|
//根据车辆vin存储围栏信息
|
||||||
|
if(vehicle.getFenceGroupId()!=null){
|
||||||
|
//根据外键查询围栏组信息
|
||||||
|
List<BoundFenceGroup> boundMiddles = vehicleService.findByFenceGroupId(vehicle.getVehicleId());
|
||||||
|
allFenceGroupCahceService.put(vehicle.getVehicleVin(), boundMiddles);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
@ -177,6 +183,12 @@ public class VehicleController extends BaseController {
|
||||||
public Result boundFenceGroup(
|
public Result boundFenceGroup(
|
||||||
@Validated @RequestBody BoundFenceGroupReq boundFenceGroupReq){
|
@Validated @RequestBody BoundFenceGroupReq boundFenceGroupReq){
|
||||||
vehicleService.boundFenceGroup(boundFenceGroupReq);
|
vehicleService.boundFenceGroup(boundFenceGroupReq);
|
||||||
|
Vehicle byId = vehicleService.getById(boundFenceGroupReq.getVehicleId());
|
||||||
|
String vehicleVin = byId.getVehicleVin();
|
||||||
|
if(byId!=null){
|
||||||
|
//将围栏组信息存入Redis
|
||||||
|
fenceGroupCahceService.put(vehicleVin, boundFenceGroupReq);
|
||||||
|
}
|
||||||
return Result.success("绑定成功");
|
return Result.success("绑定成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: LiDongJia
|
车辆类型
|
||||||
* @Package: com.muyu.car.controller
|
|
||||||
* @Project: 2112-car-cloud-server
|
|
||||||
* @name: VehicleTypeController
|
|
||||||
* @Date: 2024/9/17 17:08
|
|
||||||
* @Description: 车辆类型实体类
|
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RestController
|
@RestController
|
||||||
|
|
|
@ -11,6 +11,9 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警日志
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/logs")
|
@RequestMapping("/logs")
|
||||||
public class WarnLogsController {
|
public class WarnLogsController {
|
||||||
|
|
|
@ -14,6 +14,9 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/rule")
|
@RequestMapping("/rule")
|
||||||
public class WarnRuleController {
|
public class WarnRuleController {
|
||||||
|
|
|
@ -19,6 +19,9 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/strategy")
|
@RequestMapping("/strategy")
|
||||||
public class WarnStrategyController {
|
public class WarnStrategyController {
|
||||||
|
|
|
@ -9,6 +9,9 @@ import org.apache.ibatis.annotations.Update;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏Mapper
|
||||||
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ElectMapper extends MPJBaseMapper<Fence> {
|
public interface ElectMapper extends MPJBaseMapper<Fence> {
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package com.muyu.enterprise.mapper;
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.muyu.domain.BoundMiddle;
|
||||||
import com.muyu.domain.FenceGroup;
|
import com.muyu.domain.FenceGroup;
|
||||||
import com.muyu.domain.Vehicle;
|
import com.muyu.domain.Vehicle;
|
||||||
import com.muyu.domain.req.BoundFenceGroupReq;
|
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||||
import com.muyu.domain.req.VehicleManageReq;
|
import com.muyu.domain.req.VehicleManageReq;
|
||||||
|
import com.muyu.domain.resp.BoundFenceGroup;
|
||||||
import com.muyu.domain.resp.VehicleManageResp;
|
import com.muyu.domain.resp.VehicleManageResp;
|
||||||
import org.apache.ibatis.annotations.Insert;
|
import org.apache.ibatis.annotations.Insert;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
@ -29,7 +31,7 @@ public interface VehicleMapper extends MPJBaseMapper<Vehicle> {
|
||||||
* @param vehicleManageReq
|
* @param vehicleManageReq
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<VehicleManageResp> findAll(VehicleManageReq vehicleManageReq);
|
// List<VehicleManageResp> findAll(VehicleManageReq vehicleManageReq);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据车辆vin查询模版id
|
* 根据车辆vin查询模版id
|
||||||
|
@ -46,12 +48,13 @@ public interface VehicleMapper extends MPJBaseMapper<Vehicle> {
|
||||||
// @Insert("INSERT INTO `vehicle-basic`.`bound_middle` (`fence_group_id`,`vehicle_id`) VALUES <foreach collection=\"fenceGroupIds\" item=\"id\" separator=\",\"> (#{id},#{vehicleId}) </foreach>")
|
// @Insert("INSERT INTO `vehicle-basic`.`bound_middle` (`fence_group_id`,`vehicle_id`) VALUES <foreach collection=\"fenceGroupIds\" item=\"id\" separator=\",\"> (#{id},#{vehicleId}) </foreach>")
|
||||||
@Insert({
|
@Insert({
|
||||||
"<script> INSERT INTO `vehicle-basic`.`bound_middle` (fence_group_id,vehicle_id) VALUES <foreach collection='fenceGroupIds' item='id' separator=','> (#{id}, #{vehicleId}) </foreach> </script>"
|
"<script> INSERT INTO `vehicle-basic`.`bound_middle` (fence_group_id,vehicle_id) VALUES <foreach collection='fenceGroupIds' item='id' separator=','> (#{id}, #{vehicleId}) </foreach> </script>"
|
||||||
// "INSERT INTO `vehicle-basic`.`bound_middle` (fence_group_id, vehicle_id) VALUES <foreach collection=\"fenceGroupIds\" item=\"id\" separator=\",\"> (#{id}, #{vehicleId}) </foreach> "
|
|
||||||
})
|
})
|
||||||
void boundFenceGroup(BoundFenceGroupReq boundFenceGroupReq);
|
void boundFenceGroup(BoundFenceGroupReq boundFenceGroupReq);
|
||||||
|
|
||||||
@Select("SELECT * FROM bound_middle bm LEFT JOIN vehicle v ON bm.vehicle_id=v.vehicle_id WHERE bm.fence_group_id = #{fenceGroupId}")
|
@Select("SELECT * FROM bound_middle bm LEFT JOIN vehicle v ON bm.vehicle_id=v.vehicle_id WHERE bm.fence_group_id = #{fenceGroupId}")
|
||||||
List<FenceGroup> showBoundFenceGroup(@Param("fenceGroupId") Long fenceGroupId);
|
List<FenceGroup> showBoundFenceGroup(@Param("fenceGroupId") Long fenceGroupId);
|
||||||
|
|
||||||
|
@Select("SELECT fence_group.group_type, fence_group.priority,fence_group.`status`,bound_middle.fence_group_id FROM fence_group LEFT JOIN bound_middle ON fence_group.fence_group_id = bound_middle.fence_group_id WHERE bound_middle.vehicle_id = #{vehicleId}")
|
||||||
|
List<BoundFenceGroup> findByFenceGroupId(Long vehicleId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package com.muyu.enterprise.service;
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.domain.BoundMiddle;
|
||||||
import com.muyu.domain.FenceGroup;
|
import com.muyu.domain.FenceGroup;
|
||||||
import com.muyu.domain.Vehicle;
|
import com.muyu.domain.Vehicle;
|
||||||
import com.muyu.domain.req.BoundFenceGroupReq;
|
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||||
import com.muyu.domain.req.VehicleManageReq;
|
import com.muyu.domain.req.VehicleManageReq;
|
||||||
|
import com.muyu.domain.resp.BoundFenceGroup;
|
||||||
import com.muyu.domain.resp.VehicleManageResp;
|
import com.muyu.domain.resp.VehicleManageResp;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@ -47,4 +49,10 @@ public interface VehicleService extends IService<Vehicle> {
|
||||||
*/
|
*/
|
||||||
List<FenceGroup> showBoundFenceGroup(@Param("fenceGroupId") Long fenceGroupId);
|
List<FenceGroup> showBoundFenceGroup(@Param("fenceGroupId") Long fenceGroupId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据围栏组id查询围栏信息
|
||||||
|
* @param vehicleId
|
||||||
|
*/
|
||||||
|
List<BoundFenceGroup> findByFenceGroupId(Long vehicleId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.muyu.enterprise.service.impl;
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.enterprise.cache.FenceGroupCahceService;
|
||||||
import com.muyu.enterprise.mapper.FencegroupMapper;
|
import com.muyu.enterprise.mapper.FencegroupMapper;
|
||||||
import com.muyu.enterprise.service.IFencegroupService;
|
import com.muyu.enterprise.service.IFencegroupService;
|
||||||
import com.muyu.domain.FenceGroup;
|
import com.muyu.domain.FenceGroup;
|
||||||
|
@ -25,6 +26,11 @@ public class FencegroupServiceImpl
|
||||||
@Autowired
|
@Autowired
|
||||||
private FencegroupMapper fencegroupMapper;
|
private FencegroupMapper fencegroupMapper;
|
||||||
|
|
||||||
|
//围栏组缓存
|
||||||
|
@Autowired
|
||||||
|
private FenceGroupCahceService fenceGroupCahceService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FenceGroup> showGroupList(FenceGroupReq req) {
|
public List<FenceGroup> showGroupList(FenceGroupReq req) {
|
||||||
List<FenceGroup> fenceGroups = fencegroupMapper.showGroupList(req);
|
List<FenceGroup> fenceGroups = fencegroupMapper.showGroupList(req);
|
||||||
|
@ -37,6 +43,12 @@ public class FencegroupServiceImpl
|
||||||
this.save(build);
|
this.save(build);
|
||||||
//添加中间表
|
//添加中间表
|
||||||
Long fenceGroupId = build.getFenceGroupId();
|
Long fenceGroupId = build.getFenceGroupId();
|
||||||
|
// //添加缓存
|
||||||
|
// if(fenceGroupId != null){
|
||||||
|
// //获取车辆vin
|
||||||
|
//
|
||||||
|
// fenceGroupCahceService.put();
|
||||||
|
// }
|
||||||
fencegroupMapper.addMiddle(addReq.getFenceIds(),fenceGroupId);
|
fencegroupMapper.addMiddle(addReq.getFenceIds(),fenceGroupId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,13 @@ package com.muyu.enterprise.service.impl;
|
||||||
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.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.domain.BoundMiddle;
|
||||||
import com.muyu.domain.FenceGroup;
|
import com.muyu.domain.FenceGroup;
|
||||||
import com.muyu.domain.Vehicle;
|
import com.muyu.domain.Vehicle;
|
||||||
import com.muyu.domain.VehicleType;
|
import com.muyu.domain.VehicleType;
|
||||||
import com.muyu.domain.req.BoundFenceGroupReq;
|
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||||
import com.muyu.domain.req.VehicleManageReq;
|
import com.muyu.domain.req.VehicleManageReq;
|
||||||
|
import com.muyu.domain.resp.BoundFenceGroup;
|
||||||
import com.muyu.domain.resp.VehicleManageResp;
|
import com.muyu.domain.resp.VehicleManageResp;
|
||||||
import com.muyu.enterprise.cache.AllVehicleCacheService;
|
import com.muyu.enterprise.cache.AllVehicleCacheService;
|
||||||
import com.muyu.enterprise.mapper.VehicleMapper;
|
import com.muyu.enterprise.mapper.VehicleMapper;
|
||||||
|
@ -84,5 +86,11 @@ public class VehicleServiceImpl
|
||||||
return fenceGroups;
|
return fenceGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BoundFenceGroup> findByFenceGroupId(Long vehicleId) {
|
||||||
|
List<BoundFenceGroup> list = vehicleMapper.findByFenceGroupId(vehicleId);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ nacos:
|
||||||
addr: 47.101.49.53:8848
|
addr: 47.101.49.53:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: seven
|
namespace: fence
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.49.53:8848
|
addr: 47.101.49.53:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: seven
|
namespace: fence
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.49.53:8848
|
addr: 47.101.49.53:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: seven
|
namespace: fence
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.49.53:8848
|
addr: 47.101.49.53:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: seven
|
namespace: fence
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.49.53:8848
|
addr: 47.101.49.53:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: seven
|
namespace: fence
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.49.53:8848
|
addr: 47.101.49.53:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: seven
|
namespace: fence
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.49.53:8848
|
addr: 47.101.49.53:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: seven
|
namespace: fence
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.49.53:8848
|
addr: 47.101.49.53:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: seven
|
namespace: fence
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
Loading…
Reference in New Issue