Merge branch 'dev.parse' into dev
# Conflicts: # cloud-common/cloud-common-saas/pom.xml # cloud-modules/cloud-modules-data-process/cloud-modules-data-process-common/pom.xml # cloud-modules/cloud-modules-enterprise/enterpise-cache/src/main/java/com/muyu/enterpise/cache/WarnStrategyCacjeService.java # cloud-modules/cloud-modules-enterprise/enterpise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports # cloud-modules/cloud-modules-enterprise/enterpise-common/src/main/java/com/muyu/domain/req/FenceGroupUpdateReq.java # cloud-modules/cloud-modules-enterprise/enterpise-service/pom.xml # cloud-modules/cloud-modules-enterprise/enterpise-service/src/main/java/com/muyu/enterpise/controller/CarAndFenceGroupMiddleController.java # cloud-modules/cloud-modules-enterprise/enterpise-service/src/main/java/com/muyu/enterpise/controller/CarFenceUpdateController.java # cloud-modules/cloud-modules-enterprise/enterpise-service/src/main/java/com/muyu/enterpise/mapper/CarAndFenceGroupMiddleMapper.java # cloud-modules/cloud-modules-enterprise/enterpise-service/src/main/java/com/muyu/enterpise/mapper/CarFenceUpdateMapper.java # cloud-modules/cloud-modules-enterprise/enterpise-service/src/main/java/com/muyu/enterpise/service/CarAndFenceGroupMiddleService.java # cloud-modules/cloud-modules-enterprise/enterpise-service/src/main/java/com/muyu/enterpise/service/CarFenceUpdateService.java # cloud-modules/cloud-modules-enterprise/enterpise-service/src/main/java/com/muyu/enterpise/service/impl/CarAndFenceGroupMiddleServiceImpl.java # cloud-modules/cloud-modules-enterprise/enterpise-service/src/main/java/com/muyu/enterpise/service/impl/CarFenceServiceMybaitsImpl.java # cloud-modules/cloud-modules-enterprise/enterpise-service/src/main/java/com/muyu/enterpise/service/impl/CarFenceUpdateServiceImpl.java # cloud-modules/cloud-modules-enterprise/enterpise-service/src/main/resources/bootstrap.yml # cloud-modules/cloud-modules-parse/pom.xml # cloud-modules/cloud-modules-parse/src/main/java/com/muyu/parse/process/ProcessData.javadev.gateway
commit
b29b1f18db
|
@ -1,6 +1,5 @@
|
|||
package com.muyu.common.cache;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
|
@ -23,7 +22,7 @@ public abstract class CacheAbsBasic <K, V> implements CacheBasic<K, V>{
|
|||
public void put(K key, V value) {
|
||||
|
||||
try {
|
||||
redisService.setCacheObject(encode(key), value,30L,TimeUnit.MINUTES);
|
||||
redisService.setCacheObject(encode(key), value);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("运行时异常,异常信息为:{}"+e.getMessage());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
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<CarAndGroupMiddle> carAndGroupMiddleList;
|
||||
|
||||
/**
|
||||
* 围栏组与围栏信息
|
||||
*/
|
||||
private List<FenceAndGroupMiddle> fenceAndGroupMiddles;
|
||||
|
||||
/**
|
||||
* 故障信息和车辆
|
||||
*/
|
||||
|
||||
}
|
|
@ -119,6 +119,11 @@
|
|||
<artifactId>cloud-common-xxl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 获取缓存 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>enterprise-cache</artifactId>
|
||||
</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(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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,3 +1,5 @@
|
|||
com.muyu.enterpise.cache.MessageValueCacheService
|
||||
com.muyu.enterpise.cache.SysCarCacheService
|
||||
com.muyu.enterpise.cache.SysCarTypeCacheService
|
||||
com.muyu.enterpise.cache.WarnStrategyCacjeService
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
||||
}
|
|
@ -57,4 +57,17 @@ public class FenceGroup {
|
|||
.build();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,6 +88,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;
|
||||
|
||||
/**
|
||||
* 车辆类型名称
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package com.muyu.controller;
|
||||
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.service.CarFenceUpdateService;
|
||||
|
||||
import com.muyu.enterpise.service.CarFenceUpdateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -54,5 +55,4 @@ public class CarFenceUpdateController {
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public interface CarFenceServiceMybaitsMapper extends BaseMapper<CarMiddle> {
|
|||
* @param id
|
||||
* @param groupId
|
||||
*/
|
||||
void addFenceGroupAddCarMiddle(@Param("id") Integer id, @Param("groupId") Integer groupId);
|
||||
void addFenceGroupAddCarMiddle(@Param("id") Integer id, @Param("groupId") Long groupId);
|
||||
|
||||
/**
|
||||
* 获取绑定的围栏组
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.mapper;
|
||||
package com.muyu.enterpise.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.CarFence;
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.service;
|
||||
package com.muyu.enterpise.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.CarAndGroupMiddle;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.service;
|
||||
package com.muyu.enterpise.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.CarFence;
|
||||
|
|
|
@ -27,6 +27,6 @@ public interface MessageValueService extends IService<MessageValue> {
|
|||
* @param str
|
||||
*/
|
||||
void test(String str);
|
||||
|
||||
Long findByTemplateId(String stringVin);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package com.muyu.service.impl;
|
||||
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.mapper.CarAndFenceGroupMiddleMapper;
|
||||
import com.muyu.service.CarAndFenceGroupMiddleService;
|
||||
|
||||
import com.muyu.enterpise.mapper.CarAndFenceGroupMiddleMapper;
|
||||
import com.muyu.enterpise.service.CarAndFenceGroupMiddleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
|
@ -4,10 +4,9 @@ package com.muyu.enterpise.service.impl;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.CarMiddle;
|
||||
import com.muyu.domain.CarAndGroupMiddle;
|
||||
import com.muyu.domain.FenceAndGroupMiddle;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.domain.req.CarFenceAdd;
|
||||
|
||||
import com.muyu.enterpise.mapper.CarFenceServiceMybaitsMapper;
|
||||
import com.muyu.enterpise.service.CarFenceServiceMybaits;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
|
@ -32,30 +31,55 @@ public class CarFenceServiceMybaitsImpl extends ServiceImpl<CarFenceServiceMybai
|
|||
private CarFenceServiceMybaitsMapper carFenceServiceMybaitsMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 添加多对多围栏组
|
||||
* @param fenceGroupId
|
||||
* @param carFenceId
|
||||
*/
|
||||
@Override
|
||||
public void add(Integer fenceGroupId, List<Integer> carFenceId) {
|
||||
|
||||
for (Integer integer : carFenceId) {
|
||||
Integer addMiddle = carFenceServiceMybaitsMapper.addGroup(fenceGroupId,integer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加多对多围栏组
|
||||
*
|
||||
* @param fenceGroupId
|
||||
* @param carFences
|
||||
*/
|
||||
@Override
|
||||
public void addFenceGroup(Integer fenceGroupId, List<CarFenceAdd> carFences) {
|
||||
for (CarFenceAdd carFence : carFences) {
|
||||
Integer id = carFence.getId();
|
||||
Integer addMiddle = carFenceServiceMybaitsMapper.addFenceGroup(fenceGroupId,id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改围栏组状态
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean saveBatch(List<CarFenceAdd> carFences, Integer fenceGroupId) {
|
||||
List<CarMiddle> list = carFences.stream().map(carFenceAdd -> {
|
||||
CarMiddle carMiddle = new CarMiddle();
|
||||
carMiddle.setCarFenceId(carFenceAdd.getId());
|
||||
carMiddle.setCarGroupId(fenceGroupId);
|
||||
return carMiddle;
|
||||
}).toList();
|
||||
boolean b = this.saveBatch(list);
|
||||
return b;
|
||||
public Object updateFenceGroupById(Integer groupId) {
|
||||
carFenceServiceMybaitsMapper.updateFenceGroupById(groupId);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 启动围栏
|
||||
*/
|
||||
@Override
|
||||
public Object activate(Integer groupId) {
|
||||
carFenceServiceMybaitsMapper.activate(groupId);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据围栏组的id查询绑定的围栏的中间表
|
||||
|
@ -74,9 +98,20 @@ public class CarFenceServiceMybaitsImpl extends ServiceImpl<CarFenceServiceMybai
|
|||
return carFences;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据围栏组和车辆的id添加中间表
|
||||
*/
|
||||
@Override
|
||||
public void addFenceGroupAddCarMiddle(Integer id, List<FenceGroup> fenceGroups) {
|
||||
|
||||
//遍历集合
|
||||
for (FenceGroup fenceGroup : fenceGroups) {
|
||||
//获取围栏组的id
|
||||
Long groupId = fenceGroup.getGroupId();
|
||||
carFenceServiceMybaitsMapper.addFenceGroupAddCarMiddle(id,groupId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取绑定的围栏组
|
||||
|
@ -85,22 +120,18 @@ public class CarFenceServiceMybaitsImpl extends ServiceImpl<CarFenceServiceMybai
|
|||
@Override
|
||||
public List<FenceGroup> selectBoundGFenceGroup(Integer carId) {
|
||||
/*根据id查询围栏组的id*/
|
||||
List<CarAndGroupMiddle> list = carFenceServiceMybaitsMapper.selectBoundGFenceGroup(carId);
|
||||
List<FenceAndGroupMiddle> list = carFenceServiceMybaitsMapper.selectBoundGFenceGroup(carId);
|
||||
ArrayList<FenceGroup> fenceGroups = new ArrayList<>();
|
||||
|
||||
/*循环*/
|
||||
for (CarAndGroupMiddle fenceAndGroupMiddle : list) {
|
||||
for (FenceAndGroupMiddle fenceAndGroupMiddle : list) {
|
||||
/**
|
||||
* 获取围栏组的id
|
||||
*/
|
||||
Long carGroupId = fenceAndGroupMiddle.getGroupId();
|
||||
Integer carGroupId = fenceAndGroupMiddle.getGroupId();
|
||||
//获取围栏组的数据 并 存入list
|
||||
fenceGroups.add(carFenceServiceMybaitsMapper.selectGroup(carGroupId));
|
||||
}
|
||||
return fenceGroups;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package com.muyu.service.impl;
|
||||
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.mapper.CarFenceUpdateMapper;
|
||||
import com.muyu.service.CarFenceUpdateService;
|
||||
|
||||
import com.muyu.enterpise.mapper.CarFenceUpdateMapper;
|
||||
import com.muyu.enterpise.service.CarFenceUpdateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.muyu.common.domain.InformationData;
|
|||
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;
|
||||
|
@ -13,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -29,9 +29,11 @@ public class SysCarServiceImpl
|
|||
@Autowired
|
||||
private SysCarMapper sysCarMapper;
|
||||
|
||||
@Autowired
|
||||
private SysCarCacheService sysCarCacheService;
|
||||
|
||||
/**
|
||||
* 精确查询车辆基础信息
|
||||
*
|
||||
* @param id 车辆基础信息主键
|
||||
* @return 车辆基础信息
|
||||
*/
|
||||
|
@ -40,13 +42,14 @@ public class SysCarServiceImpl
|
|||
LambdaQueryWrapper<SysCar> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Assert.notNull(id, "id不可为空");
|
||||
queryWrapper.eq(SysCar::getId, id);
|
||||
|
||||
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆基础信息列表
|
||||
*
|
||||
* @param sysCarReq 车辆基础信息
|
||||
* @return 车辆基础信息
|
||||
*/
|
||||
|
@ -65,13 +68,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,10 +4,10 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 127.0.0.1:8848
|
||||
addr: 123.57.152.124:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: wx
|
||||
namespace: xyr
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
@ -19,7 +19,7 @@ spring:
|
|||
allow-bean-definition-overriding: true
|
||||
application:
|
||||
# 应用名称
|
||||
name: cloud-warn
|
||||
name: cloud-saas
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
</parent>
|
||||
|
||||
<artifactId>cloud-modules-parse</artifactId>
|
||||
|
||||
<description>
|
||||
cloud-modules-parse 协议解析
|
||||
</description>
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
|
@ -109,7 +111,6 @@
|
|||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-kafka</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -10,12 +10,13 @@ import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/9/26 15:31
|
||||
* @注释
|
||||
* @注释 MQTT监听者
|
||||
*/
|
||||
|
||||
|
||||
|
@ -26,12 +27,15 @@ 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";
|
||||
String clientId = "xyr123456789";
|
||||
|
||||
@Resource
|
||||
private ProcessData processData;
|
||||
|
||||
@PostConstruct
|
||||
public void connect() {
|
||||
try {
|
||||
|
@ -55,7 +59,7 @@ public class MqttConsumerConfig {
|
|||
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
||||
String s1 = new String(mqttMessage.getPayload());
|
||||
System.out.println("接收到的主题是:" + s + "内容是:{}" + s1);
|
||||
ProcessData.DataConversion(s1);
|
||||
processData.DataConversion(s1);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,10 @@ import com.muyu.enterpise.cache.SysCarTypeCacheService;
|
|||
import com.muyu.parse.uitl.DataParseUtil;
|
||||
import com.muyu.remote.RemoteMessageValueService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.kafka.clients.producer.Callback;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.apache.kafka.clients.producer.RecordMetadata;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
@ -24,29 +27,29 @@ import java.util.List;
|
|||
* @注释
|
||||
*/
|
||||
@Log4j2
|
||||
@Configuration
|
||||
public class ProcessData {
|
||||
|
||||
@Resource
|
||||
private static RemoteMessageValueService remoteMessageValueService;
|
||||
|
||||
|
||||
//报文模版信息
|
||||
@Resource
|
||||
private static MessageValueCacheService messageValueCacheService;
|
||||
private MessageValueCacheService messageValueCacheService;
|
||||
|
||||
//车辆信息
|
||||
@Resource
|
||||
private static SysCarCacheService sysCarCacheService;
|
||||
private SysCarCacheService sysCarCacheService;
|
||||
|
||||
//车辆类型信息
|
||||
@Resource
|
||||
private static SysCarTypeCacheService sysCarTypeCacheService;
|
||||
private SysCarTypeCacheService sysCarTypeCacheService;
|
||||
|
||||
@Resource
|
||||
private static KafkaProducerConfig kafkaProducerConfig;
|
||||
private KafkaProducerConfig kafkaProducerConfig;
|
||||
|
||||
private final static String topic = "sysCar_vin_topic";
|
||||
|
||||
public static void DataConversion(String jsonVin ) {
|
||||
public void DataConversion(String jsonVin ) {
|
||||
//设置数组存储车辆数据
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String vin = DataParseUtil.dataParsing(jsonVin);
|
||||
|
@ -79,7 +82,7 @@ public class ProcessData {
|
|||
|
||||
|
||||
|
||||
private static void sendKafkaMessage(JSONObject jsonObject){
|
||||
private void sendKafkaMessage(JSONObject jsonObject){
|
||||
ProducerRecord<Object, JSONObject> producerRecord = new ProducerRecord<>(topic, jsonObject);
|
||||
try {
|
||||
kafkaProducerConfig.kafkaProducer().send(new ProducerRecord<>(topic,jsonObject.toString()));
|
||||
|
|
|
@ -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 {
|
||||
|
|
29
pom.xml
29
pom.xml
|
@ -283,11 +283,30 @@
|
|||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.muyu</groupId>-->
|
||||
<!-- <artifactId>enterpise-common</artifactId>-->
|
||||
<!-- <version>${muyu.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>enterpise-remote</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
<!-- 实体类 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>enterpise-common</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
<!-- 缓存框架 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>enterprise-cache</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- kafka 公共配置 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-kafka</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.muyu</groupId>-->
|
||||
|
|
Loading…
Reference in New Issue