feat():修复缓存Redis-five
parent
cd4a07e637
commit
c5f79db964
|
@ -34,6 +34,12 @@
|
|||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
</dependency>
|
||||
<!-- 企业实体类-->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>enterpise-common</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.muyu.data.domain;
|
||||
|
||||
import com.muyu.domain.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/10/6 20:21
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class EnterpriseCommon {
|
||||
/**
|
||||
* 车辆基础信息
|
||||
*/
|
||||
private SysCar sysCar;
|
||||
|
||||
/**
|
||||
* 车辆策略信息
|
||||
*/
|
||||
private WarnStrategy warnStrategy;
|
||||
|
||||
/**
|
||||
* 车辆规则信息
|
||||
*/
|
||||
private WarnRule warnRule;
|
||||
|
||||
/**
|
||||
* 车辆与围栏组
|
||||
*/
|
||||
private List<FenceGroup> fenceGroup;
|
||||
|
||||
/**
|
||||
* 围栏组与围栏信息
|
||||
*/
|
||||
private List<FenceAndGroupMiddle> fenceAndGroupMiddles;
|
||||
|
||||
}
|
|
@ -82,6 +82,12 @@
|
|||
<artifactId>cloud-common-xxl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 获取缓存 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>enterprise-cache</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.data.warn;
|
||||
|
||||
import com.muyu.domain.SysCar;
|
||||
import com.muyu.enterpise.cache.SysCarCacheService;
|
||||
import com.muyu.enterpise.cache.SysCarTypeCacheService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.apache.catalina.mapper.*;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/10/6 15:21
|
||||
* @注释 事件预警
|
||||
*/
|
||||
@Component
|
||||
public class WarningJudgment {
|
||||
|
||||
@Resource
|
||||
private SysCarCacheService sysCarCacheService;
|
||||
|
||||
@Resource
|
||||
private SysCarTypeCacheService sysCarTypeCacheService;
|
||||
|
||||
@PostConstruct
|
||||
public void getCache(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 车辆电子围栏中间表
|
||||
* * @Author:yan
|
||||
* * @Package:com.muyu.car.domain
|
||||
* * @Project:plues
|
||||
* * @name:FenceAndGroupMiddle
|
||||
* * @Date:2024/9/22 09:59
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Tag(name = "车辆和电子围栏组中间表")
|
||||
@TableName(value = "car_group_middle",autoResultMap = true)
|
||||
public class CarAndGroupMiddle {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@Schema(name = "id")
|
||||
private Long id;
|
||||
/**
|
||||
* 车id
|
||||
*/
|
||||
@Schema(name = "围栏id")
|
||||
private Integer carId;
|
||||
/**
|
||||
* 围栏组id
|
||||
*/
|
||||
@Schema(name = "围栏组id")
|
||||
private Long groupId;
|
||||
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.domain
|
||||
* @Project:plus
|
||||
* @name:Cars
|
||||
* @Date:2024/10/4 20:45
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class Cars {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Schema
|
||||
private Integer id;
|
||||
/**
|
||||
* name
|
||||
*/
|
||||
@Schema
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* w
|
||||
*/
|
||||
@Schema
|
||||
private String w;
|
||||
|
||||
/**
|
||||
* q
|
||||
*/
|
||||
@Schema
|
||||
private String q;
|
||||
|
||||
/**
|
||||
* e
|
||||
*/
|
||||
@Schema
|
||||
private String e;
|
||||
|
||||
/**
|
||||
* r
|
||||
*/
|
||||
@Schema
|
||||
private String r;
|
||||
|
||||
/**
|
||||
* t
|
||||
*/
|
||||
@Schema
|
||||
private String t;
|
||||
|
||||
/**
|
||||
* g
|
||||
*/
|
||||
@Schema
|
||||
private String y;
|
||||
|
||||
/**
|
||||
* a
|
||||
*/
|
||||
@Schema
|
||||
private String a;
|
||||
|
||||
/**
|
||||
* s
|
||||
*/
|
||||
@Schema
|
||||
private String s;
|
||||
|
||||
/**
|
||||
* d
|
||||
*/
|
||||
@Schema
|
||||
private String d;
|
||||
|
||||
/**
|
||||
* f
|
||||
*/
|
||||
@Schema
|
||||
private String f;
|
||||
|
||||
/**
|
||||
* g
|
||||
*/
|
||||
@Schema
|
||||
private String g;
|
||||
|
||||
/**
|
||||
* z
|
||||
*/
|
||||
@Schema
|
||||
private String z;
|
||||
|
||||
/**
|
||||
* x
|
||||
*/
|
||||
|
||||
@Schema
|
||||
private String x;
|
||||
|
||||
/**
|
||||
* c
|
||||
*/
|
||||
@Schema
|
||||
private String c;
|
||||
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.muyu.domain;
|
|||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.domain.req.FenceGroupUpdateReq;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -30,7 +31,7 @@ public class FenceGroup {
|
|||
*/
|
||||
@TableId(value = "group_id",type = IdType.AUTO)
|
||||
@Schema(name = "围栏组id")
|
||||
private Integer groupId;
|
||||
private Long groupId;
|
||||
/**
|
||||
* 围栏组名称
|
||||
*/
|
||||
|
@ -43,4 +44,17 @@ public class FenceGroup {
|
|||
private Integer groupStates;
|
||||
|
||||
|
||||
public static FenceGroup carFenceUpdateById(Integer states, FenceGroupUpdateReq fenceGroupBuilder ){
|
||||
return FenceGroup.builder()
|
||||
.groupId(fenceGroupBuilder.getGroupId())
|
||||
.groupStates(states)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static FenceGroup closeCarFenceUpdateById(Integer states, Long groupId ){
|
||||
return FenceGroup.builder()
|
||||
.groupId(groupId)
|
||||
.groupStates(states)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ public class SysCar extends BaseEntity{
|
|||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class SysCarType extends BaseEntity {
|
|||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Schema(name = "车辆类型主键")
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 车辆类型名称
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.domain.req;
|
||||
|
||||
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.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.domain.req
|
||||
* @Project:plues
|
||||
* @name:CarFenceUpdateReq
|
||||
* @Date:2024/9/29 20:22
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "修改围栏的状态", description = "修改围栏的状态")
|
||||
public class FenceGroupUpdateReq {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "group_id", type = IdType.AUTO)
|
||||
@Schema(title = "围栏组Id")
|
||||
private Long groupId;
|
||||
|
||||
}
|
|
@ -19,6 +19,13 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<!-- Mybatis Plus 两大件-->
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join</artifactId>
|
||||
<version>1.4.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>enterpise-common</artifactId>
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.muyu.enterpise.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
|
||||
import com.muyu.enterpise.service.CarAndFenceGroupMiddleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆和围栏组中间表
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.controller
|
||||
* @Project:plues
|
||||
* @name:CarAndFenceGroupMiddleController
|
||||
* @Date:2024/9/29 20:09
|
||||
*/
|
||||
@RequestMapping("/carandfencemiddle")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@Log4j2
|
||||
@Tag(name = "车辆和围栏组中间表")
|
||||
public class CarAndFenceGroupMiddleController {
|
||||
@Autowired
|
||||
private CarAndFenceGroupMiddleService carAndFenceGroupMiddleService;
|
||||
|
||||
/**
|
||||
* 根据围栏组和车辆的id添加中间表
|
||||
*/
|
||||
@PostMapping("/addFenceGroupAddCarMiddle")
|
||||
@Operation(summary = "根据围栏组和车辆的id添加中间表",description = "根据围栏组和车辆的id添加中间表")
|
||||
public Result addFenceGroupAddCarMiddle(@RequestParam("carId") Integer carId , @RequestBody List<FenceGroup> fenceGroups ){
|
||||
boolean b = carAndFenceGroupMiddleService.saveBatch(fenceGroups,carId);
|
||||
return Result.success("成功");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.muyu.enterpise.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.domain.req.FenceGroupUpdateReq;
|
||||
|
||||
import com.muyu.enterpise.service.CarFenceUpdateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 围栏组的修改状态
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.controller
|
||||
* @Project:plues
|
||||
* @name:CarFenceUpdateController
|
||||
* @Date:2024/9/30 09:10
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/fenceUpdate")
|
||||
@AllArgsConstructor
|
||||
@Log4j2
|
||||
@Tag(name = "修改围栏组的状态")
|
||||
public class CarFenceUpdateController {
|
||||
@Autowired
|
||||
private CarFenceUpdateService carFenceUpdateService;
|
||||
|
||||
/**
|
||||
* 启动围栏组
|
||||
*/
|
||||
@PutMapping("/activate")
|
||||
@Operation(summary = "启动围栏状态",description = "启动围栏状态")
|
||||
public Result activate(@RequestBody FenceGroupUpdateReq fenceGroupUpdateReq){
|
||||
Integer states = 0;
|
||||
boolean b = carFenceUpdateService.updateById(FenceGroup.carFenceUpdateById(states, fenceGroupUpdateReq));
|
||||
return Result.success("成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改围栏状态为关闭
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/updateFenceGroupById")
|
||||
@Operation(summary = "修改围栏状态为关闭",description = "修改围栏状态为关闭")
|
||||
public Result updateFenceGroupById(@RequestParam("groupId") Long groupId){
|
||||
Integer states = 1;
|
||||
carFenceUpdateService.updateById(FenceGroup.closeCarFenceUpdateById(states,groupId));
|
||||
|
||||
return Result.success("成功");
|
||||
}
|
||||
|
||||
}
|
|
@ -33,7 +33,7 @@ public class MessageValueController extends BaseController {
|
|||
private MessageValueService messageValueService;
|
||||
|
||||
@Autowired
|
||||
private MessageValueCacheService messageValueCacheService;
|
||||
private MessageValueCacheService enterpiseCacheService;
|
||||
|
||||
/**
|
||||
* 报文数据列表查询
|
||||
|
@ -56,6 +56,7 @@ public class MessageValueController extends BaseController {
|
|||
@Operation(summary = "添加报文数据", description = "新增报文数据")
|
||||
public Result<String> save(@RequestBody MessageValueAddReq messageValueAddReq){
|
||||
messageValueService.save(MessageValue.addBuild(messageValueAddReq));
|
||||
// enterpiseCacheService.put(String.valueOf(messageValueAddReq.getTemplateId()),MessageValue.addBuild(messageValueAddReq));
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
|
||||
|
@ -80,4 +81,12 @@ public class MessageValueController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@PostMapping({"/findByTemplateId/{stringVin}"})
|
||||
@Operation(
|
||||
summary = "根据车辆类型查询报文模版ID",
|
||||
description = "根据车辆类型查询报文模版ID"
|
||||
)
|
||||
public Result<Long> findByTemplateId(@PathVariable("stringVin") String stringVin) {
|
||||
return Result.success(this.messageValueService.findByTemplateId(stringVin), "查询成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.domain.SysCar;
|
||||
import com.muyu.domain.req.SysCarReq;
|
||||
import com.muyu.domain.resp.SysCarResp;
|
||||
import com.muyu.enterpise.cache.SysCarCacheService;
|
||||
import com.muyu.enterpise.service.SysCarService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -31,13 +30,10 @@ public class SysCarController extends BaseController
|
|||
@Resource
|
||||
private SysCarService sysCarService;
|
||||
|
||||
@Resource
|
||||
private SysCarCacheService sysCarCacheService;
|
||||
|
||||
/**
|
||||
* 查询车辆基础信息列表
|
||||
*/
|
||||
@RequiresPermissions("car:car:list")
|
||||
@RequiresPermissions("saas:car:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<SysCarResp>> list(SysCarReq sysCarReq)
|
||||
{
|
||||
|
@ -49,7 +45,7 @@ public class SysCarController extends BaseController
|
|||
/**
|
||||
* 获取车辆基础信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("car:car:query")
|
||||
@RequiresPermissions("saas:car:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<List<SysCar>> getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
|
@ -67,9 +63,7 @@ public class SysCarController extends BaseController
|
|||
if (sysCarService.checkIdUnique(sysCar)) {
|
||||
return error("新增 车辆基础信息 '" + sysCar + "'失败,车辆基础信息已存在");
|
||||
}
|
||||
|
||||
sysCar.setCreateBy(SecurityUtils.getUsername());
|
||||
sysCarCacheService.put(sysCar.getCarVin(),sysCar);
|
||||
return toAjax(sysCarService.save(sysCar));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.muyu.common.core.domain.Result;
|
|||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.domain.SysCarType;
|
||||
import com.muyu.enterpise.cache.SysCarTypeCacheService;
|
||||
import com.muyu.enterpise.service.SysTypeService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -30,9 +29,6 @@ public class SysTypeController extends BaseController {
|
|||
@Resource
|
||||
private SysTypeService sysTypeService;
|
||||
|
||||
@Resource
|
||||
private SysCarTypeCacheService sysCarTypeCacheService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆类型列表
|
||||
|
@ -41,10 +37,6 @@ public class SysTypeController extends BaseController {
|
|||
public Result<TableDataInfo<SysCarType>> list() {
|
||||
startPage();
|
||||
List<SysCarType> list = sysTypeService.selectSysTypeList();
|
||||
for (SysCarType sysCarType : list) {
|
||||
sysCarTypeCacheService.put(String.valueOf(sysCarType.getId()),sysCarType);
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.enterpise.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.domain.CarAndGroupMiddle;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 车辆和围栏组中间表
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.mapper
|
||||
* @Project:plues
|
||||
* @name:CarAndFenceGroupMiddleMapper
|
||||
* @Date:2024/9/29 20:12
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarAndFenceGroupMiddleMapper extends BaseMapper<CarAndGroupMiddle> {
|
||||
|
||||
}
|
|
@ -64,7 +64,7 @@ public interface CarFenceServiceMybaitsMapper {
|
|||
* @param id
|
||||
* @param groupId
|
||||
*/
|
||||
void addFenceGroupAddCarMiddle(@Param("id") Integer id, @Param("groupId") Integer groupId);
|
||||
void addFenceGroupAddCarMiddle(@Param("id") Integer id, @Param("groupId") Long groupId);
|
||||
|
||||
/**
|
||||
* 获取绑定的围栏组
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.enterpise.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 围栏组的修改状态
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.mapper
|
||||
* @Project:plues
|
||||
* @name:CarFenceUpdateMapper
|
||||
* @Date:2024/9/30 09:13
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarFenceUpdateMapper extends BaseMapper<FenceGroup> {
|
||||
}
|
|
@ -14,5 +14,6 @@ import org.apache.ibatis.annotations.Select;
|
|||
*/
|
||||
@Mapper
|
||||
public interface MessageValueMapper extends BaseMapper<MessageValue> {
|
||||
|
||||
@Select({"SELECT sct.message_template_id FROM sys_car sc LEFT JOIN sys_car_type sct on sct.id = sc.car_type WHERE sc.car_vin = ${stringVin}"})
|
||||
Long findByTemplateId(String stringVin);
|
||||
}
|
||||
|
|
|
@ -15,5 +15,5 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface SysCarMapper extends BaseMapper<SysCar>{
|
||||
|
||||
// List<SysCarResp> selectSysCarList(SysCar sysCar);
|
||||
List<SysCarResp> selectSysCarList(SysCar sysCar);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface SysTypeMapper extends BaseMapper<SysCarType> {
|
||||
|
||||
// List<SysCarType> selectSysList();
|
||||
List<SysCarType> selectSysList();
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.enterpise.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.CarAndGroupMiddle;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆和围栏组中间表
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.service
|
||||
* @Project:plues
|
||||
* @name:CarAndFenceGroupMiddleService
|
||||
* @Date:2024/9/29 20:10
|
||||
*/
|
||||
public interface CarAndFenceGroupMiddleService extends IService<CarAndGroupMiddle> {
|
||||
/**
|
||||
* 根据围栏组和车辆的id添加中间表
|
||||
*/
|
||||
boolean saveBatch(List<FenceGroup> fenceGroups, Integer carId);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.enterpise.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
|
||||
/**
|
||||
* 围栏组的修改状态
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.service
|
||||
* @Project:plues
|
||||
* @name:CarFenceUpdateService
|
||||
* @Date:2024/9/30 09:12
|
||||
*/
|
||||
public interface CarFenceUpdateService extends IService<FenceGroup> {
|
||||
}
|
|
@ -27,6 +27,6 @@ public interface MessageValueService extends IService<MessageValue> {
|
|||
* @param str
|
||||
*/
|
||||
void test(String str);
|
||||
|
||||
Long findByTemplateId(String stringVin);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.muyu.enterpise.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.CarAndGroupMiddle;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
|
||||
import com.muyu.enterpise.mapper.CarAndFenceGroupMiddleMapper;
|
||||
import com.muyu.enterpise.service.CarAndFenceGroupMiddleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆和围栏组中间表
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.service.impl
|
||||
* @Project:plues
|
||||
* @name:CarAndFenceGroupMiddleServiceImpl
|
||||
* @Date:2024/9/29 20:11
|
||||
*/
|
||||
@Service
|
||||
public class CarAndFenceGroupMiddleServiceImpl extends ServiceImpl<CarAndFenceGroupMiddleMapper, CarAndGroupMiddle> implements CarAndFenceGroupMiddleService {
|
||||
@Autowired
|
||||
private CarAndFenceGroupMiddleMapper carAndFenceGroupMiddleMapper;
|
||||
|
||||
/**
|
||||
* 根据围栏组和车辆的id添加中间表
|
||||
*/
|
||||
@Override
|
||||
public boolean saveBatch(List<FenceGroup> fenceGroups, Integer carId) {
|
||||
List<CarAndGroupMiddle> list = fenceGroups.stream().map(fenceGroup -> {
|
||||
CarAndGroupMiddle carAndGroupMiddle = new CarAndGroupMiddle();
|
||||
//获取围栏组的id
|
||||
carAndGroupMiddle.setGroupId(fenceGroup.getGroupId());
|
||||
carAndGroupMiddle.setCarId(carId);
|
||||
return carAndGroupMiddle;
|
||||
}).toList();
|
||||
boolean b = this.saveBatch(list);
|
||||
return b;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.enterpise.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.CarMiddle;
|
||||
import com.muyu.domain.FenceAndGroupMiddle;
|
||||
|
@ -102,7 +103,7 @@ public class CarFenceServiceMybaitsImpl implements CarFenceServiceMybaits {
|
|||
//遍历集合
|
||||
for (FenceGroup fenceGroup : fenceGroups) {
|
||||
//获取围栏组的id
|
||||
Integer groupId = fenceGroup.getGroupId();
|
||||
Long groupId = fenceGroup.getGroupId();
|
||||
carFenceServiceMybaitsMapper.addFenceGroupAddCarMiddle(id,groupId);
|
||||
}
|
||||
|
||||
|
@ -115,6 +116,10 @@ public class CarFenceServiceMybaitsImpl implements CarFenceServiceMybaits {
|
|||
@Override
|
||||
public List<FenceGroup> selectBoundGFenceGroup(Integer carId) {
|
||||
/*根据id查询围栏组的id*/
|
||||
|
||||
// new LambdaQueryWrapper<>()
|
||||
|
||||
|
||||
List<FenceAndGroupMiddle> list = carFenceServiceMybaitsMapper.selectBoundGFenceGroup(carId);
|
||||
ArrayList<FenceGroup> fenceGroups = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.enterpise.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
|
||||
import com.muyu.enterpise.mapper.CarFenceUpdateMapper;
|
||||
import com.muyu.enterpise.service.CarFenceUpdateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 围栏组的修改状态
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.service.impl
|
||||
* @Project:plues
|
||||
* @name:CarFenceUpdateServiceImpl
|
||||
* @Date:2024/9/30 09:12
|
||||
* 围栏组的修改状态
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class CarFenceUpdateServiceImpl extends ServiceImpl<CarFenceUpdateMapper, FenceGroup> implements CarFenceUpdateService {
|
||||
@Autowired
|
||||
private CarFenceUpdateMapper carFenceUpdateMapper;
|
||||
|
||||
}
|
|
@ -10,6 +10,7 @@ import com.muyu.domain.resp.MessageValueListResp;
|
|||
import com.muyu.enterpise.cache.MessageValueCacheService;
|
||||
import com.muyu.enterpise.mapper.MessageValueMapper;
|
||||
import com.muyu.enterpise.service.MessageValueService;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -29,10 +30,11 @@ public class MessageValueServiceImpl
|
|||
|
||||
@Resource
|
||||
private MessageValueMapper messageValueMapper;
|
||||
|
||||
@Resource
|
||||
private MessageValueCacheService messageValueCacheService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有消息值
|
||||
* @param messageValueReq
|
||||
|
@ -54,7 +56,9 @@ public class MessageValueServiceImpl
|
|||
}
|
||||
|
||||
List<MessageValue> list = this.list(queryWrapper);
|
||||
messageValueCacheService.put(String.valueOf(messageValueReq.getMessageTemplateId()),list);
|
||||
messageValueCacheService.put(String.valueOf(messageValueReq.getMessageTemplateId()),list);
|
||||
List<MessageValue> messageValues = messageValueCacheService.get(String.valueOf(messageValueReq.getMessageTemplateId()));
|
||||
System.out.println("asoldonasond:"+messageValues);
|
||||
return list.stream()
|
||||
.map(messageValue -> MessageValueListResp.valueBuild(
|
||||
messageValue
|
||||
|
@ -77,7 +81,10 @@ public class MessageValueServiceImpl
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Long findByTemplateId(String stringVin) {
|
||||
return messageValueMapper.findByTemplateId(stringVin);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.domain.SysCar;
|
||||
import com.muyu.domain.req.SysCarReq;
|
||||
import com.muyu.domain.resp.SysCarResp;
|
||||
import com.muyu.enterpise.cache.SysCarCacheService;
|
||||
import com.muyu.enterpise.mapper.SysCarMapper;
|
||||
import com.muyu.enterpise.service.SysCarService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -28,6 +29,9 @@ public class SysCarServiceImpl
|
|||
@Autowired
|
||||
private SysCarMapper sysCarMapper;
|
||||
|
||||
@Autowired
|
||||
private SysCarCacheService sysCarCacheService;
|
||||
|
||||
/**
|
||||
* 精确查询车辆基础信息
|
||||
*
|
||||
|
@ -39,6 +43,8 @@ public class SysCarServiceImpl
|
|||
LambdaQueryWrapper<SysCar> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Assert.notNull(id, "id不可为空");
|
||||
queryWrapper.eq(SysCar::getId, id);
|
||||
|
||||
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
|
@ -64,13 +70,23 @@ public class SysCarServiceImpl
|
|||
if (StringUtils.isNotEmpty(sysCarReq.getCarModel())) {
|
||||
queryWrapper.eq(SysCar::getCarModel, sysCarReq.getCarModel());
|
||||
}
|
||||
if (null == sysCarReq.getCarType()) {
|
||||
if (null != sysCarReq.getCarType()) {
|
||||
queryWrapper.eq(SysCar::getCarType, sysCarReq.getCarType());
|
||||
}
|
||||
if (null == sysCarReq.getState()) {
|
||||
if (null != sysCarReq.getState()) {
|
||||
queryWrapper.eq(SysCar::getState, sysCarReq.getState());
|
||||
}
|
||||
//就是下面两个判断有问题 还有问题吗 没有我就下了
|
||||
List<SysCar> list = this.list(queryWrapper);
|
||||
for (SysCar sysCar : list) {
|
||||
String carVin = sysCar.getCarVin();
|
||||
//MQTTX是啥 跟MQ差不多 这样就行吧 OK 这个缓存 是老懂教我们的
|
||||
|
||||
sysCarCacheService.put(carVin, sysCar);
|
||||
System.out.println("s够不够水电费健康发动机刚发打卡机这咋广发卡缴纳:"+carVin);
|
||||
SysCar sysCar1 = sysCarCacheService.get(carVin);
|
||||
System.out.println("asfih"+sysCar1);
|
||||
}
|
||||
return list.stream()
|
||||
.map(SysCarResp::reverseResp)
|
||||
.toList();
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SysTypeServiceImpl
|
|||
*/
|
||||
@Override
|
||||
public List<SysCarType> selectSysTypeList() {
|
||||
return this.list();
|
||||
return sysTypeMapper.selectSysList();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,8 +4,10 @@ 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.domain.WarnStrategy;
|
||||
import com.muyu.enterpise.cache.WarnStrategyCacjeService;
|
||||
import com.muyu.enterpise.mapper.WarnStrategyMapper;
|
||||
import com.muyu.enterpise.service.IWarnStrategyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -20,6 +22,9 @@ public class WarnStrategyServiceImpl
|
|||
extends ServiceImpl<WarnStrategyMapper, WarnStrategy>
|
||||
implements IWarnStrategyService {
|
||||
|
||||
@Autowired
|
||||
private WarnStrategyCacjeService warnStrategyCacjeService;
|
||||
|
||||
/**
|
||||
* 精确查询预警策略
|
||||
*
|
||||
|
@ -56,7 +61,15 @@ public class WarnStrategyServiceImpl
|
|||
if (null!=warnStrategy.getMsgId()){
|
||||
queryWrapper.eq(WarnStrategy::getMsgId, warnStrategy.getMsgId());
|
||||
}
|
||||
return this.list(queryWrapper);
|
||||
|
||||
List<WarnStrategy> list = this.list(queryWrapper);
|
||||
|
||||
for (WarnStrategy strategy : list) {
|
||||
|
||||
warnStrategyCacjeService.put(String.valueOf(strategy.getId()),strategy);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 123.57.152.124:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: xyr
|
||||
namespace: yan1
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-cache</artifactId>
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.muyu.common.cache.CacheAbsBasic;
|
|||
import com.muyu.domain.SysCar;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.enterpise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBasic;
|
||||
import com.muyu.domain.WarnStrategy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.enterpise.cache
|
||||
* @Project:plus
|
||||
* @name:WarnStrategyCacjeService
|
||||
* @Date:2024/10/6 19:26
|
||||
*/
|
||||
@Component
|
||||
public class WarnStrategyCacjeService extends CacheAbsBasic<String, WarnStrategy> {
|
||||
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "sysCarType:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String encode(String key) {
|
||||
return super.encode(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return super.decode(key);
|
||||
}
|
||||
}
|
|
@ -1,2 +1,5 @@
|
|||
com.muyu.enterpise.cache.MessageValueCacheService
|
||||
com.muyu.enterpise.cache.SysCarCacheService
|
||||
com.muyu.enterpise.cache.SysCarTypeCacheService
|
||||
com.muyu.enterpise.cache.WarnStrategyCacjeService
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import javax.annotation.PostConstruct;
|
|||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/9/26 15:31
|
||||
* @注释
|
||||
* @注释 MQTT监听者
|
||||
*/
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ import javax.annotation.PostConstruct;
|
|||
@NoArgsConstructor
|
||||
public class MqttConsumerConfig {
|
||||
|
||||
String topic = "xxx";
|
||||
String topic = "yyy";
|
||||
String content = "Message from MqttPublishSample";
|
||||
int qos = 2;
|
||||
String broker = "tcp://123.57.152.124:1883";
|
||||
|
|
|
@ -28,8 +28,7 @@ import java.util.List;
|
|||
@Log4j2
|
||||
public class ProcessData {
|
||||
|
||||
@Resource
|
||||
private static RemoteMessageValueService remoteMessageValueService;
|
||||
|
||||
|
||||
//报文模版信息
|
||||
@Resource
|
||||
|
|
|
@ -7,7 +7,7 @@ import lombok.extern.log4j.Log4j2;
|
|||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/9/28 16:48
|
||||
* @注释
|
||||
* @注释 进制转换
|
||||
*/
|
||||
@Log4j2
|
||||
public class DataParseUtil {
|
||||
|
|
Loading…
Reference in New Issue