diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/AllFaultCacheService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/AllFaultCacheService.java deleted file mode 100644 index 281a2a4..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/AllFaultCacheService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.muyu.enterprise.cache; - -import com.muyu.common.cache.CacheAbsBacis; -import com.muyu.domain.FaultInfo; - -import java.util.List; - -/** - * 所有故障缓存服务 - */ -public class AllFaultCacheService extends CacheAbsBacis> { - @Override - public void clear() { - - } - - @Override - public String keyPre() { - return "AllFault:info:"; - } - - @Override - public String decode(String key) { - return key.replace("AllFault:info:", ""); - } -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/FaultCacheService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/FaultCacheService.java deleted file mode 100644 index 2bafae7..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/FaultCacheService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.muyu.enterprise.cache; - -import com.muyu.common.cache.CacheAbsBacis; -import com.muyu.domain.FaultInfo; - -/** - * 故障缓存服务 - */ -public class FaultCacheService extends CacheAbsBacis { - @Override - public void clear() { - - } - - @Override - public String keyPre() { - return "fault:info:"; - } - - @Override - public String decode(String key) { - return key.replace("fault:info:", ""); - } -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 98c2aec..3ffa89c 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,4 +1,3 @@ -com.muyu.enterprise.cache.AllFaultCacheService com.muyu.enterprise.cache.AllFenceCahceService com.muyu.enterprise.cache.AllFenceGroupCahceService com.muyu.enterprise.cache.AllMessageValueCacheService @@ -7,7 +6,6 @@ com.muyu.enterprise.cache.AllVehicleTypeCacheService com.muyu.enterprise.cache.AllWarnRuleCacheService com.muyu.enterprise.cache.AllWarnStrategyAndVinCacheService com.muyu.enterprise.cache.AllWarnStrategyCacheService -com.muyu.enterprise.cache.FaultCacheService com.muyu.enterprise.cache.FenceCahceService com.muyu.enterprise.cache.FenceGroupCahceService com.muyu.enterprise.cache.MessageTemplateCacheService @@ -16,5 +14,3 @@ com.muyu.enterprise.cache.VehicleCacheService com.muyu.enterprise.cache.VehicleTypeCacheService com.muyu.enterprise.cache.WarnRuleCacheService com.muyu.enterprise.cache.WarnStrategyCacheService - - diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/Fault.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/Fault.java index caab1d6..a86be50 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/Fault.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/Fault.java @@ -1,92 +1,49 @@ 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.common.core.annotation.Excel; -import com.muyu.common.core.annotation.Excel.ColumnType; import com.muyu.common.core.web.domain.BaseEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.AllArgsConstructor; import lombok.Data; -import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; /** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.domain - * @Filename:Fault - * @Description TODO - * @Date:2024/9/18 11:04 + * 故障信息 */ @Data @SuperBuilder @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode(callSuper = true) -@TableName(value = "fault") +@Tag(name = "fault", description = "故障信息") public class Fault extends BaseEntity { /** - * 自增主键 + * 主键id */ - @Excel(name = "参数主键", cellType = ColumnType.NUMERIC) - @TableId( type = IdType.AUTO) - private Long id; + @TableId(value = "fault_id") + @Schema(description = "主键",type = "Integer") + private Long faultId; + /** - * 车辆故障编码 + * 故障类别 */ - @Excel(name = "车辆故障编码") - private String faultCode; - /** - * 车辆故障名称 - */ - @Excel(name = "车辆故障名称") - private String faultName; - /** - * 车辆故障类型 - */ - @Excel(name = "辆故障类型") + @Schema(description = "故障类别",type = "String") private String faultType; + /** - * 故障VIN编码 + * 故障规则(判定方式) */ - @Excel(name = "故障VIN编码") - private String carVin; + @Schema(description = "故障规则(判定方式)",type = "String") + private String faultCustom; + /** - * 车辆故障标签 + * 报文外键 */ - @Excel(name = "车辆故障标签") - private String faultLabel; - /** - * 车辆故障位 - */ - @Excel(name = "车辆故障位") - private String faultBit; - /** - * 车辆故障值 - */ - @Excel(name = "车辆故障值") - private String faultValue; - /** - * 故障级别 - */ - @Excel(name = "故障级别") - private String faultWarn; - /** - * 报警状态(Y.是,N.否) - */ - @Excel(name = "报警状态(Y.是,N.否)") - private String warnStatus; - /** - * 故障描述信息 - */ - @Excel(name = "故障描述信息") - private String faultDesc; - /** - * 启用状态(1.待处理 2.处理中 3.已处理 4.忽略) - */ - @Excel(name = "启用状态(1.待处理 2.处理中 3.已处理 4.忽略)") - private String state; + @Schema(description = "报文外键",type = "Integer") + private Integer messageId; + + } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultInfo.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultInfo.java deleted file mode 100644 index 36953cb..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultInfo.java +++ /dev/null @@ -1,77 +0,0 @@ -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.common.core.annotation.Excel; -import com.muyu.common.core.web.domain.BaseEntity; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.domain.vo - * @Filename:FaultInfo - * @Description TODO - * @Date:2024/9/16 20:23 - */ -@Data -@SuperBuilder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode(callSuper = true) -@TableName(value = "fault_info", autoResultMap = true) -public class FaultInfo extends BaseEntity { - - /** - * id - */ - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - /** - * 故障码 - */ - @Excel(name = "故障码") - private String faultCode; - - /** - * 故障类型 - */ - @Excel(name = "故障类型") - private String faultType; - - /** - * 故障组 - */ - @Excel(name = "故障组") - private String groupName; - - /** - * 故障位 - */ - @Excel(name = "故障位") - private Integer faultBit; - - /** - * 故障值 - */ - @Excel(name = "故障值") - private String faultValue; - - /** - * 故障标签 - */ - @Excel(name = "故障标签") - private String faultTab; - - /** - * 是否警告 - */ - @Excel(name = "是否警告") - private Long isWarning; -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultLog.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultLog.java deleted file mode 100644 index f730100..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultLog.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.muyu.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.muyu.common.core.annotation.Excel; -import com.muyu.common.core.web.domain.BaseEntity; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; -import org.springframework.format.annotation.DateTimeFormat; - -import java.util.Date; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.domain - * @Filename:FaultLog - * @Description TODO - * @Date:2024/9/16 20:11 - */ -@Data -@SuperBuilder -@NoArgsConstructor -@AllArgsConstructor -@TableName(value = "fault_log", autoResultMap = true) -public class FaultLog{ - - /** - * id - */ - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - /** - * 故障码 - */ - @Excel(name = "故障码") - private String faultCode; - - /** - * 车辆VIN - */ - @Excel(name = "车辆VIN") - private String vin; - - /** - * 开始报警时间 - */ - @JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @Excel(name = "开始报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:dd:ss") - private Date warningTime; - - /** - * 结束报警时间 - */ - @JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @Excel(name = "结束报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:dd:ss") - private Date normalTime; - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultRule.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultRule.java new file mode 100644 index 0000000..a57808c --- /dev/null +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultRule.java @@ -0,0 +1,26 @@ +package com.muyu.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; +import lombok.experimental.SuperBuilder; + +/** + * 故障规则表 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName(value = "fault_rule", autoResultMap = true) +public class FaultRule { + /** + * 主键id + */ + @TableId(value = "fault_rule_id") + private Long faultRuleId; + private Long vehicleTypeId; + private Long messageValueId; + private String faultCondition; + private Double triggerValue; +} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/Rule.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/Rule.java deleted file mode 100644 index e8557f7..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/Rule.java +++ /dev/null @@ -1,45 +0,0 @@ -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.common.core.annotation.Excel; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.domain - * @Filename:Custom - * @Description TODO - * @Date:2024/9/21 18:39 - */ -@Data -@SuperBuilder -@NoArgsConstructor -@AllArgsConstructor -@TableName(value = "rule") -public class Rule { - - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Excel(name = "messageId") - private Long messageId; - - @Excel(name = "carId") - private Integer carId; - - @Excel(name = "cId") - private Integer cId; - - @Excel(name = "tId") - private Integer tId; - - @Excel(name = "ruleValue") - private Integer ruleValue; - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/Type.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/Type.java deleted file mode 100644 index 51bf7ab..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/Type.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.muyu.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.domain - * @Filename:Type - * @Description TODO - * @Date:2024/9/22 10:03 - */ -@Data -@SuperBuilder -@NoArgsConstructor -@AllArgsConstructor -@TableName(value = "type") -public class Type { - @TableId(value = "t_id", type = IdType.AUTO) - private Integer tId; - private String typeName; -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/resp/FaultRuleResp.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/resp/FaultRuleResp.java new file mode 100644 index 0000000..0836f7c --- /dev/null +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/resp/FaultRuleResp.java @@ -0,0 +1,25 @@ +package com.muyu.domain.resp; + +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Builder +@Data +@AllArgsConstructor +@NoArgsConstructor +@Tag(name = "故障规则列表响应数据") +public class FaultRuleResp { + + private Long faultRuleId; + + private String vehicleTypeName; + + private String messageValueName; + + private String faultCondition; + + private Double triggerValue; +} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/FaultInfoController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/FaultInfoController.java deleted file mode 100644 index 704a1c3..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/FaultInfoController.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.muyu.enterprise.controller; - -import com.muyu.enterprise.cache.AllFaultCacheService; -import com.muyu.enterprise.cache.FaultCacheService; -import com.muyu.enterprise.service.FaultInfoService; -import com.muyu.common.core.domain.Result; -import com.muyu.common.core.utils.poi.ExcelUtil; -import com.muyu.common.core.web.controller.BaseController; -import com.muyu.common.core.web.page.TableDataInfo; -import com.muyu.common.log.annotation.Log; -import com.muyu.common.log.enums.BusinessType; -import com.muyu.common.security.annotation.RequiresPermissions; - -import com.muyu.domain.FaultInfo; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.servlet.http.HttpServletResponse; -import lombok.extern.log4j.Log4j2; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Arrays; -import java.util.List; - -/** - * 故障信息 - */ - -@Log4j2 -@RestController -@Tag(name = "故障管理列", description = "故障管理列") -@RequestMapping("/info") -public class FaultInfoController extends BaseController { - - @Autowired - private FaultInfoService service; - - @Autowired - private AllFaultCacheService allFaultCacheService; - - /** - * 查询车辆故障管理列表 - */ - @GetMapping("/list") - @RequiresPermissions("fault:fault:list") - @Operation(summary = "查询集合", description = "查询车辆故障管理列表") - public Result> list(FaultInfo faultInfo) { - startPage(); - List list = service.pageQuery(faultInfo); - allFaultCacheService.put(faultInfo.getFaultCode(),list); - return getDataTable(list); - } - - - /** - * 导出车辆故障管理列表 - */ - @Log(title = "车辆故障管理", businessType = BusinessType.EXPORT) - @PostMapping("/export") - @RequiresPermissions("fault:fault:export") - public void export(HttpServletResponse response, FaultInfo fault) { - List list = service.pageQuery(fault); - ExcelUtil util = new ExcelUtil(FaultInfo.class); - util.exportExcel(response, list, "车辆故障管理数据"); - } - - - /** - * 获取车辆故障管理详细信息 - */ - @GetMapping(value = "/{id}") - public Result getConfigKey (@PathVariable("id") String id) { - return success(service.getById(id)); - } - - - /** - * 新增车辆故障管理 - */ - @Log(title = "车辆故障管理", businessType = BusinessType.INSERT) - @PostMapping - @RequiresPermissions("fault:info:add") - public Result add(@RequestBody FaultInfo faultInfo) { - service.save(faultInfo); - //添加的数据存进缓存 -// faultCacheService.put(faultInfo.); - return Result.success(null, "成功"); - } - - - - /** - * 修改车故障管理 - */ - @Log(title = "车辆故障管理", businessType = BusinessType.UPDATE) - @PutMapping - @RequiresPermissions("fault:info:edit") - public Result edit(@RequestBody FaultInfo fault) { - service.updateById(fault); - return Result.success(null, "成功"); - } - - - - /** - * 删除车辆故障管理 - */ - @Log(title = "车辆故障管理删除", businessType = BusinessType.DELETE) - @DeleteMapping("/{id}") - @RequiresPermissions("fault:info:remove") - public Result remove(@PathVariable("id") Long[] id) { - return Result.success(service.removeBatchByIds(Arrays.asList(id)), "成功"); - } - - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/FaultLogController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/FaultLogController.java deleted file mode 100644 index 70c4cbc..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/FaultLogController.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.muyu.enterprise.controller; - - -import com.muyu.enterprise.service.FaultLogService; -import com.muyu.common.core.domain.Result; -import com.muyu.common.core.utils.poi.ExcelUtil; -import com.muyu.common.core.web.controller.BaseController; -import com.muyu.common.core.web.page.TableDataInfo; -import com.muyu.common.log.enums.BusinessType; -import com.muyu.common.security.annotation.RequiresPermissions; - -import com.muyu.domain.FaultLog; -import io.swagger.v3.oas.annotations.Operation; -import jakarta.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import com.muyu.common.log.annotation.Log; - -import java.util.Arrays; -import java.util.List; - -/** - * 故障日志 - */ -@RestController -@RequestMapping("/log") -public class FaultLogController extends BaseController { - @Autowired - private FaultLogService faultLogService; - - /** - * 查询车辆故障管理列表 - */ - @GetMapping("/list") - @RequiresPermissions("fault:log:list") - @Operation(summary = "查询集合", description = "查询车辆故障管理列表") - public Result> list(FaultLog fault) { - startPage(); - List list = faultLogService.pageQuery(fault); - return getDataTable(list); - } - - - /** - * 导出车辆故障管理列表 - */ - @Log(title = "车辆故障管理", businessType = BusinessType.EXPORT) - @PostMapping("/export") - @RequiresPermissions("fault:log:export") - public void export(HttpServletResponse response, FaultLog fault) { - List list = faultLogService.pageQuery(fault); - ExcelUtil util = new ExcelUtil(FaultLog.class); - util.exportExcel(response, list, "车辆故障管理数据"); - } - - - /** - * 获取车辆故障管理详细信息 - */ - @GetMapping(value = "/{id}") - public Result getConfigKey (@PathVariable("id") String id) { - return success(faultLogService.getById(id)); - } - - - /** - * 新增车辆故障管理 - */ - @Log(title = "车辆故障管理", businessType = BusinessType.INSERT) - @PostMapping - @RequiresPermissions("fault:log:add") - public Result add(@RequestBody FaultLog fault) { - faultLogService.save(fault); - return Result.success(null, "成功"); - } - - - - /** - * 修改车故障管理 - */ - @Log(title = "车辆故障管理", businessType = BusinessType.UPDATE) - @PutMapping - @RequiresPermissions("fault:log:edit") - public Result edit(@RequestBody FaultLog fault) { - faultLogService.updateById(fault); - return Result.success(null, "成功"); - } - - - - /** - * 删除车辆故障管理 - */ - @Log(title = "车辆故障管理删除", businessType = BusinessType.DELETE) - @DeleteMapping("/{id}") - @RequiresPermissions("fault:log:remove") - public Result remove(@PathVariable("id") Long[] id) { - return Result.success(faultLogService.removeBatchByIds(Arrays.asList(id)), "成功"); - } - - - /** - * 新增故障日志 - */ - @PostMapping("/addLog") - public Result addLog(@RequestBody FaultLog log){ - faultLogService.insertFaultLog(log); - return Result.success(); - } - - /** - * 修改结束时间 - */ - @PostMapping("/updateLog") - public Result updateLog(@RequestBody FaultLog log){ - faultLogService.updateFaultLogByStatus(log); - return Result.success(); - } - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/FaultRuleController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/FaultRuleController.java new file mode 100644 index 0000000..db4433f --- /dev/null +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/FaultRuleController.java @@ -0,0 +1,67 @@ +package com.muyu.enterprise.controller; + +import com.muyu.common.core.domain.Result; +import com.muyu.domain.FaultRule; +import com.muyu.domain.resp.FaultRuleResp; +import com.muyu.enterprise.service.FaultRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 故障规则 + */ +@RestController +@RequestMapping("/faultRule") +public class FaultRuleController { + + @Autowired + private FaultRuleService faultRuleService; + + /** + * 故障规则列表 + * @return + */ + @RequestMapping(value = "/list", method = RequestMethod.GET) + public Result> list() { + List list = faultRuleService.selectList(); + return Result.success(list); + } + + /** + * 新增 + * @param faultRule + * @return + */ + @PostMapping("/add") + public Result add(@RequestBody FaultRule faultRule) { + faultRuleService.save(faultRule); + return Result.success("新增成功"); + } + + /** + * 修改 + * @param faultRule + * @return + */ + @PutMapping("/update") + public Result update(@RequestBody FaultRule faultRule) { + faultRuleService.updateById(faultRule); + return Result.success("更新成功"); + } + + /** + * 删除 + * @param faultRuleId + * @return + */ + @DeleteMapping("delete/{faultRuleId}") + public Result delete(@PathVariable("faultRuleId") Long faultRuleId) { + faultRuleService.removeById(faultRuleId); + return Result.success("删除成功"); + } + + + +} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/RuleController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/RuleController.java deleted file mode 100644 index b25ed84..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/RuleController.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.muyu.enterprise.controller; - -import com.muyu.common.core.domain.Result; -import com.muyu.common.core.utils.poi.ExcelUtil; -import com.muyu.common.core.web.controller.BaseController; -import com.muyu.common.core.web.page.TableDataInfo; -import com.muyu.common.log.annotation.Log; -import com.muyu.common.log.enums.BusinessType; -import com.muyu.common.security.annotation.RequiresPermissions; - -import com.muyu.domain.*; -import com.muyu.domain.vo.RuleVo; -import com.muyu.enterprise.service.RuleService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.servlet.http.HttpServletResponse; -import lombok.extern.log4j.Log4j2; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Arrays; -import java.util.List; - -/** - * 故障规则 - */ -@Log4j2 -@RestController -@Tag(name = "规则", description = "故障管理列") -@RequestMapping("/rules") -public class RuleController extends BaseController { - - @Autowired - private RuleService ruleService; - - - /** - * 查询车辆故障管理列表 - */ - @GetMapping("/list") - @RequiresPermissions("fault:rules:list") - @Operation(summary = "查询集合", description = "查询车辆故障管理列表") - public Result> list(RuleVo fault) { - startPage(); - List list = ruleService.pageQueryRule(fault); - return getDataTable(list); - } - - /** - * 导出车辆故障管理列表 - */ - @Log(title = "车辆故障管理", businessType = BusinessType.EXPORT) - @PostMapping("/export") - @RequiresPermissions("fault:rules:export") - public void export(HttpServletResponse response, Rule fault) { - List list = ruleService.pageQuery(fault); - ExcelUtil util = new ExcelUtil(Rule.class); - util.exportExcel(response, list, "车辆故障管理数据"); - } - - - /** - * 获取车辆故障管理详细信息 - */ - @GetMapping(value = "/{id}") - public Result getConfigKey(@PathVariable("id") String id) { - return success(ruleService.getById(id)); - } - - - /** - * 新增车辆故障管理 - */ - @Log(title = "车辆故障管理", businessType = BusinessType.INSERT) - @PostMapping - @RequiresPermissions("fault:rules:add") - public Result add(@RequestBody Rule fault) { - return Result.success(ruleService.insertFault(fault), "成功"); - } - - - /** - * 修改车故障管理 - */ - @Log(title = "车辆故障管理", businessType = BusinessType.UPDATE) - @PutMapping - @RequiresPermissions("fault:rules:edit") - public Result edit(@RequestBody Rule fault) { - return Result.success(ruleService.updateFault(fault), "成功"); - } - - - /** - * 删除车辆故障管理 - */ - @Log(title = "车辆故障管理删除", businessType = BusinessType.DELETE) - @DeleteMapping("/{id}") - @RequiresPermissions("fault:rules:remove") - public Result remove(@PathVariable("id") Long[] id) { - return Result.success(ruleService.removeBatchByIds(Arrays.asList(id)), "成功"); - } - - - /** - * 查询车辆故障管理列表 - */ - @GetMapping("/custom") - @Operation(summary = "查询集合", description = "查询车辆故障管理列表") - public Result> custom(Custom fault) { - return ruleService.pageQueryList(fault); - } - - - /** - * 查询车辆故障管理列表 - */ - @GetMapping("/car") - @Operation(summary = "查询集合", description = "查询车辆故障管理列表") - public Result> car(Vehicle fault) { - return ruleService.pageQueryCar(fault); - } - - - /** - * 查询车辆故障管理列表 - */ - @GetMapping("/type") - @Operation(summary = "查询集合", description = "查询车辆故障管理列表") - public Result> type(Type fault) { - return ruleService.pageQueryType(fault); - } - - /** - * 查询车辆故障管理列表 - */ - @GetMapping("/MessageValue") - @Operation(summary = "查询集合", description = "查询车辆故障管理列表") - public Result> MessageValue(MessageValue fault) { - return ruleService.pageQueryMessageValue(fault); - } - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/VehicleController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/VehicleController.java index e680b97..0d16c94 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/VehicleController.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/VehicleController.java @@ -1,35 +1,33 @@ package com.muyu.enterprise.controller; -import com.muyu.common.security.utils.SecurityUtils; -import com.muyu.common.system.domain.LoginUser; -import com.muyu.domain.WarnStrategy; -import com.muyu.domain.req.BoundFenceGroupReq; -import com.muyu.domain.resp.BoundFenceGroup; -import com.muyu.domain.resp.WarnRuleResp; -import com.muyu.domain.resp.WarnStrategyAndVinResp; -import com.muyu.enterprise.cache.*; -import com.muyu.enterprise.service.VehicleService; import com.muyu.common.core.domain.Result; import com.muyu.common.core.utils.poi.ExcelUtil; import com.muyu.common.core.web.controller.BaseController; import com.muyu.common.core.web.page.TableDataInfo; -import com.muyu.domain.BoundMiddle; +import com.muyu.common.security.utils.SecurityUtils; +import com.muyu.common.system.domain.LoginUser; import com.muyu.domain.Vehicle; +import com.muyu.domain.req.BoundFenceGroupReq; import com.muyu.domain.req.VehicleAddReq; import com.muyu.domain.req.VehicleManageReq; import com.muyu.domain.req.VehicleUpdReq; +import com.muyu.domain.resp.BoundFenceGroup; import com.muyu.domain.resp.VehicleManageResp; +import com.muyu.domain.resp.WarnRuleResp; +import com.muyu.enterprise.cache.AllFenceGroupCahceService; +import com.muyu.enterprise.cache.FenceGroupCahceService; +import com.muyu.enterprise.cache.VehicleCacheService; +import com.muyu.enterprise.cache.WarnStrategyCacheService; +import com.muyu.enterprise.service.VehicleService; import com.muyu.enterprise.service.WarnStrategyService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisTemplate; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.util.Collections; import java.util.List; /** @@ -47,12 +45,6 @@ public class VehicleController extends BaseController { //添加车辆缓存 @Autowired private VehicleCacheService vehicleCacheService; - //车辆信息 - @Autowired - private AllVehicleCacheService allVehicleCacheService; - //缓存策略和vin - @Autowired - private AllWarnStrategyAndVinCacheService allWarnStrategyAndVinCacheService; //缓存策略 @Autowired private WarnStrategyService warnStrategyService; @@ -80,7 +72,7 @@ public class VehicleController extends BaseController { List vehicleList = vehicleService.list(); vehicleList.forEach(vehicle -> { vehicleCacheService.put(vehicle.getVehicleVin(), vehicle); - //根据车辆vin存储策略已经规则信息 + //根据车辆vin存储策略规则信息 if(vehicle.getWarnStrategyId()!=null){ WarnRuleResp respList = warnStrategyService.findByWarnStrategyId(vehicle.getWarnStrategyId()); warnStrategyCacheService.put(vehicle.getVehicleVin(), respList); @@ -107,6 +99,7 @@ public class VehicleController extends BaseController { boolean save = vehicleService.save(Vehicle.addBuild(vehicleAddReq)); //获取用户信息 LoginUser loginUser = SecurityUtils.getLoginUser(); + loginUser.getSysUser(); //存到redis vehicleCacheService.put(vehicleAddReq.getVehicleVin(), Vehicle.addBuild(vehicleAddReq)); return Result.success(save? "新增成功" : "新增失败"); @@ -155,7 +148,6 @@ public class VehicleController extends BaseController { /** * 批量删除车辆 - * * @param vehicleIds * @return */ diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnStrategyController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnStrategyController.java index 7baccce..dff3028 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnStrategyController.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnStrategyController.java @@ -29,13 +29,6 @@ public class WarnStrategyController { @Autowired private WarnStrategyService warnStrategyService; - //缓存策略 - @Autowired - private WarnStrategyCacheService warnStrategyCacheService; - - //列表 - @Autowired - private AllWarnStrategyCacheService allWarnStrategyCacheService; //缓存策略和vin @Autowired @@ -50,10 +43,6 @@ public class WarnStrategyController { @Operation(summary = "策略列表", description = "获取所有策略列表") public Result> strategyList(@RequestBody @Validated WarnVehicleReq req) { List list = warnStrategyService.selectList(req); -// for (WarnVehicleResp warnVehicleResp : list) { -// //存进Redis -// allWarnStrategyCacheService.put(String.valueOf(warnVehicleResp.getVehicleVin()), warnVehicleResp); -// } return Result.success(list); } @@ -78,12 +67,6 @@ public class WarnStrategyController { public Result strategyAdd(@Validated @RequestBody WarnStrategy warnStrategy){ boolean save = warnStrategyService.save(warnStrategy); -// //存进Redis -// //获取用户信息 -// LoginUser loginUser = SecurityUtils.getLoginUser(); -// //获取租户唯一标识 -// String databaseName = loginUser.getSysUser().getDatabaseName(); -// warnStrategyCacheService.put(databaseName+warnStrategy.getWarnStrategyId(),warnStrategy); return Result.success(save); } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultInfoMapper.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultInfoMapper.java deleted file mode 100644 index 167c89d..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultInfoMapper.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.muyu.enterprise.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -import com.muyu.domain.FaultInfo; -import org.apache.ibatis.annotations.Mapper; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.mapper - * @Filename:FaultInfoMapper - * @Description TODO - * @Date:2024/9/19 22:19 - */ -@Mapper -public interface FaultInfoMapper extends BaseMapper { - - int insertFaultinfo(FaultInfo faultInfo); - - - int updateFaultinfo(FaultInfo faultInfo); - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultLogMapper.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultLogMapper.java deleted file mode 100644 index 52b1d3a..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultLogMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.muyu.enterprise.mapper; - - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.muyu.domain.FaultLog; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.ArrayList; -import java.util.List; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.mapper - * @Filename:FaultLogMapper - * @Description TODO - * @Date:2024/9/16 21:15 - */ -@Mapper -public interface FaultLogMapper extends BaseMapper { - - Long selectFaultId(FaultLog log); - - - int updateFaultLogByTime(FaultLog log); - - - void insertBatchFaultLog(@Param("logs") List logs); -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultMapper.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultMapper.java deleted file mode 100644 index 4541e7e..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.muyu.enterprise.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.muyu.domain.Fault; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.mapper - * @Filename:FaultMapper - * @Description TODO - * @Date:2024/9/18 11:16 - */ -@Mapper -public interface FaultMapper extends BaseMapper { -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultRuleMapper.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultRuleMapper.java new file mode 100644 index 0000000..4c9e2d3 --- /dev/null +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/FaultRuleMapper.java @@ -0,0 +1,10 @@ +package com.muyu.enterprise.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.github.yulichang.base.MPJBaseMapper; +import com.muyu.domain.FaultRule; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface FaultRuleMapper extends MPJBaseMapper { +} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/RuleMapper.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/RuleMapper.java deleted file mode 100644 index ebd96e4..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/RuleMapper.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.muyu.enterprise.mapper; - - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.muyu.domain.*; -import com.muyu.domain.vo.RuleVo; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.mapper - * @Filename:RuleMapper - * @Description TODO - * @Date:2024/9/21 18:50 - */ -@Mapper -public interface RuleMapper extends BaseMapper { - int insertFault(Rule faultInfo); - - int updateFault(Rule faultInfo); - - - List pageQueryRule(RuleVo fault); - - List pageQueryList(Custom fault); - - List pageQueryCar(Vehicle fault); - List pageQueryType(Type fault); - - List pageQueryMessageValue(MessageValue fault); - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultInfoService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultInfoService.java deleted file mode 100644 index bb0e47f..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultInfoService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.muyu.enterprise.service; - - - -import com.baomidou.mybatisplus.extension.service.IService; -import com.muyu.domain.FaultInfo; - -import java.util.List; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.service - * @Filename:IFaultInfoService - * @Description TODO - * @Date:2024/9/19 22:15 - */ -public interface FaultInfoService extends IService { - - /** - * 查询车辆故障管理 - * - * @param faultInfo 车辆故障管理主键 - * @return 车辆故障管理 - */ - List pageQuery(FaultInfo faultInfo); - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultLogService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultLogService.java deleted file mode 100644 index 07b1304..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultLogService.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.muyu.enterprise.service; - - - -import com.baomidou.mybatisplus.extension.service.IService; -import com.muyu.domain.FaultLog; - -import java.util.List; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.service - * @Filename:IFaultLogService - * @Description TODO - * @Date:2024/9/16 20:26 - */ -public interface FaultLogService extends IService { - - /** - * - * @param fault - * @return - */ - List pageQuery(FaultLog fault); - - - public int insertFaultLog(FaultLog log); - - - public int updateFaultLogByStatus(FaultLog log); - - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultRuleService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultRuleService.java new file mode 100644 index 0000000..9209e61 --- /dev/null +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultRuleService.java @@ -0,0 +1,16 @@ +package com.muyu.enterprise.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.domain.FaultRule; +import com.muyu.domain.resp.FaultRuleResp; + +import java.util.List; + +public interface FaultRuleService extends IService { + + /** + * 查询故障规则列表 + * @return + */ + List selectList(); +} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultService.java deleted file mode 100644 index bfeb93a..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/FaultService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.muyu.enterprise.service; - -; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.muyu.domain.Fault; - -import java.util.List; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.service - * @Filename:IFaultService - * @Description TODO - * @Date:2024/9/18 11:12 - */ -public interface FaultService extends IService { - - /** - * 查询车辆故障管理 - * - * @param fault 车辆故障管理主键 - * @return 车辆故障管理 - */ - List pageQuery(Fault fault); - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/RuleService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/RuleService.java deleted file mode 100644 index 221e690..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/RuleService.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.muyu.enterprise.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.muyu.common.core.domain.Result; -import com.muyu.domain.*; -import com.muyu.domain.vo.RuleVo; - - -import java.util.List; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.service - * @Filename:RuleService - * @Description TODO - * @Date:2024/9/21 18:47 - */ -public interface RuleService extends IService { - /** - * 查询车辆故障管理 - * - * @param fault 车辆故障管理主键 - * @return 车辆故障管理 - */ - List pageQuery(Rule fault); - List pageQueryRule(RuleVo fault); - /** - * 新增车辆故障管理 - * - * @param fault 车辆故障管理 - * @return 结果 - */ - public int insertFault(Rule fault); - - /** - * 修改车辆故障管理 - * - * @param fault 车辆故障管理 - * @return 结果 - */ - public int updateFault(Rule fault); - - Result> pageQueryList(Custom fault); - - Result> pageQueryCar(Vehicle fault); - Result> pageQueryType(Type fault); - - - Result> pageQueryMessageValue(MessageValue fault); - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultInfoServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultInfoServiceImpl.java deleted file mode 100644 index d792289..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultInfoServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.muyu.enterprise.service.impl; - -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.FaultInfo; -import com.muyu.enterprise.mapper.FaultInfoMapper; -import com.muyu.enterprise.service.FaultInfoService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.*; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.service.impl - * @Filename:IFaultInfoServiceImpl - * @Description TODO - * @Date:2024/9/19 22:16 - */ -@Service -public class FaultInfoServiceImpl extends ServiceImpl implements FaultInfoService { - - @Autowired - private FaultInfoMapper faultInfoMapper; - - /** - * - * @param faultInfo 车辆故障管理主键 - * @return fault - */ - @Override - public List pageQuery(FaultInfo faultInfo) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if (StringUtils.isNotEmpty(faultInfo.getFaultCode())) { - queryWrapper.like(FaultInfo::getFaultCode, faultInfo.getFaultCode()); - } - if (StringUtils.isNotEmpty(faultInfo.getFaultType())) { - queryWrapper.like(FaultInfo::getFaultType, faultInfo.getFaultType()); - } - if (StringUtils.isNotEmpty(faultInfo.getGroupName())) { - queryWrapper.like(FaultInfo::getGroupName, faultInfo.getGroupName()); - } - - return this.list(queryWrapper); - } -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultLogServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultLogServiceImpl.java deleted file mode 100644 index 7c709fe..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultLogServiceImpl.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.muyu.enterprise.service.impl; - -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.FaultLog; -import com.muyu.enterprise.mapper.FaultLogMapper; -import com.muyu.enterprise.service.FaultLogService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import java.util.Date; -import java.util.List; -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.service - * @Filename:IFaultLogServiceImpl - * @Description TODO - * @Date:2024/9/16 20:37 - */ -@Service -public class FaultLogServiceImpl extends ServiceImpl implements FaultLogService { - - -@Autowired -private FaultLogMapper faultLogMapper; - - @Override - public List pageQuery(FaultLog fault) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if (StringUtils.isNotEmpty(fault.getFaultCode())) { - queryWrapper.like(FaultLog::getFaultCode, fault.getFaultCode()); - } - if (StringUtils.isNotEmpty(fault.getVin())) { - queryWrapper.like(FaultLog::getVin, fault.getVin()); - } - - // 时间区间查询 - if (fault.getWarningTime() != null ) { - queryWrapper.gt(FaultLog::getWarningTime, fault.getWarningTime()); - } - - - - if (fault.getNormalTime() != null ) { - queryWrapper.lt(FaultLog::getNormalTime, fault.getNormalTime()); - } - - - return this.list(queryWrapper); - } - - /** - * 添加 - * @param log - */ - @Override - public int insertFaultLog(FaultLog log) { - - return 0; - } - /** - *修改 - * @param log - */ - @Override - public int updateFaultLogByStatus(FaultLog log) { - log.setId(faultLogMapper.selectFaultId(log)); - return faultLogMapper.updateFaultLogByTime(log); - } - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultRuleServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultRuleServiceImpl.java new file mode 100644 index 0000000..60969c5 --- /dev/null +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultRuleServiceImpl.java @@ -0,0 +1,39 @@ +package com.muyu.enterprise.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.muyu.domain.FaultRule; +import com.muyu.domain.MessageValue; +import com.muyu.domain.VehicleType; +import com.muyu.domain.resp.FaultRuleResp; +import com.muyu.enterprise.mapper.FaultRuleMapper; +import com.muyu.enterprise.service.FaultRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class FaultRuleServiceImpl extends ServiceImpl implements FaultRuleService { + + @Autowired + private FaultRuleMapper faultRuleMapper; + + /** + * 查询故障规则列表 + * @return 故障规则列表 + */ + @Override + public List selectList() { + MPJLambdaWrapper wrapper = new MPJLambdaWrapper<>(); + wrapper.selectAs(FaultRule::getFaultRuleId, "faultRuleId") + .selectAs(FaultRule::getFaultCondition, "faultCondition") + .selectAs(FaultRule::getTriggerValue, "triggerValue") + .selectAs(VehicleType::getVehicleTypeName, "vehicleTypeName") + .selectAs(MessageValue::getMessageLabel, "messageValueName") + .leftJoin(VehicleType.class, VehicleType::getVehicleTypeId, FaultRule::getVehicleTypeId) + .leftJoin(MessageValue.class, MessageValue::getMessageId, FaultRule::getMessageValueId); + List list = faultRuleMapper.selectJoinList(FaultRuleResp.class, wrapper); + return list; + } +} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultServiceImpl.java deleted file mode 100644 index d4d15d5..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/FaultServiceImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.muyu.enterprise.service.impl; - -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.common.core.web.domain.BaseEntity; - -import com.muyu.domain.Fault; -import com.muyu.enterprise.mapper.FaultMapper; -import com.muyu.enterprise.service.FaultService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Date; -import java.util.List; -import java.util.Objects; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.service - * @Filename:IFaultServiceImpl - * @Description TODO - * @Date:2024/9/18 11:14 - */ -@Service -public class FaultServiceImpl extends ServiceImpl implements FaultService { - - - @Autowired - private FaultMapper faultMapper; - - /** - * - * @param fault 车辆故障管理主键 - * @return fault - */ - @Override - public List pageQuery(Fault fault) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if (StringUtils.isNotEmpty(fault.getFaultCode())) { - queryWrapper.like(Fault::getFaultCode, fault.getFaultCode()); - } - if (StringUtils.isNotEmpty(fault.getFaultType())) { - queryWrapper.like(Fault::getFaultType, fault.getFaultType()); - } - if (StringUtils.isNotEmpty(fault.getFaultName())) { - queryWrapper.like(Fault::getFaultName, fault.getFaultName()); - } - - - Object beginTime = fault.getParams().get("beginTime"); - if (Objects.nonNull(beginTime) && beginTime instanceof Date beginDate) { - queryWrapper.gt(BaseEntity::getCreateTime, beginDate); - } - Object endTime = fault.getParams().get("endTime"); - if (Objects.nonNull(endTime) && endTime instanceof Date endDate) { - queryWrapper.lt(BaseEntity::getCreateTime, endDate); - } - return this.list(queryWrapper); - } - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/RuleServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/RuleServiceImpl.java deleted file mode 100644 index 4d1bff7..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/RuleServiceImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.muyu.enterprise.service.impl; - - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.muyu.common.core.domain.Result; - -import com.muyu.domain.*; -import com.muyu.domain.vo.RuleVo; -import com.muyu.enterprise.mapper.RuleMapper; -import com.muyu.enterprise.service.RuleService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * @Author:ChenYan - * @Project:2112-car-cloud-server - * @Package:com.muyu.fault.service - * @Filename:RuleServiceImpl - * @Description TODO - * @Date:2024/9/21 18:49 - */ -@Service -public class RuleServiceImpl extends ServiceImpl implements RuleService { - - - @Autowired - private RuleMapper ruleMapper; - - /** - * - * @param fault 车辆故障管理主键 - * @return fault - */ - @Override - public List pageQuery(Rule fault) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if (fault.getRuleValue()!=null) { - queryWrapper.like(Rule::getRuleValue, fault.getRuleValue()); - } - return this.list(queryWrapper); - } - - @Override - public List pageQueryRule(RuleVo fault) { - Listlist=ruleMapper.pageQueryRule(fault); - return list; - } - - /** - * 下拉框 - * @param fault - * @return - */ - @Override - public Result> pageQueryList(Custom fault) { - Listlist=ruleMapper.pageQueryList(fault); - return Result.success(list,"成功"); - } - - @Override - public Result> pageQueryCar(Vehicle fault) { - Listlist=ruleMapper.pageQueryCar(fault); - return Result.success(list,"成功"); - } - - @Override - public Result> pageQueryType(Type fault) { - Listlist=ruleMapper.pageQueryType(fault); - return Result.success(list,"成功"); - } - - @Override - public Result> pageQueryMessageValue(MessageValue fault) { - Listlist=ruleMapper.pageQueryMessageValue(fault); - return Result.success(list,"成功"); - } - - - /*** - * 车辆故障管理insertFault - * @param faultInfo - * @return - */ - @Override - public int insertFault(Rule faultInfo) { - int i = ruleMapper.insertFault(faultInfo); - return i; - } - - - /** - * 车辆故障管理updateFault - * @param faultInfo - * @return - */ - @Override - public int updateFault(Rule faultInfo) { - int i = ruleMapper.updateFault(faultInfo); - return i; - } - - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/VehicleServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/VehicleServiceImpl.java index 8e727dd..34002a9 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/VehicleServiceImpl.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/VehicleServiceImpl.java @@ -3,7 +3,6 @@ package com.muyu.enterprise.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.muyu.common.core.utils.StringUtils; -import com.muyu.domain.BoundMiddle; import com.muyu.domain.FenceGroup; import com.muyu.domain.Vehicle; import com.muyu.domain.VehicleType; @@ -11,13 +10,11 @@ import com.muyu.domain.req.BoundFenceGroupReq; import com.muyu.domain.req.VehicleManageReq; import com.muyu.domain.resp.BoundFenceGroup; import com.muyu.domain.resp.VehicleManageResp; -import com.muyu.enterprise.cache.AllVehicleCacheService; import com.muyu.enterprise.mapper.VehicleMapper; import com.muyu.enterprise.service.VehicleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Collections; import java.util.List; /** diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/car/FaultLogMapper.xml b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/car/FaultLogMapper.xml deleted file mode 100644 index 9de29e6..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/car/FaultLogMapper.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - insert into faultlog (fault_code, vin, warning_time) - values - - (#{temp.faultCode},#{temp.vin},#{temp.warningTime}) - - - - - update faultlog - set normal_time = #{normalTime} - where id = #{id} - - - - - - diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/car/RuleMapper.xml b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/car/RuleMapper.xml deleted file mode 100644 index 089eaa2..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/car/RuleMapper.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - INSERT INTO `vehicle-basic`.`rule` ( `message_id`, `car_id`, `c_id`, `t_id`, `rule_value`) - VALUES ( #{messageId}, #{carId}, #{cId}, #{tId}, #{ruleValue}) - - - - - UPDATE `rule` - SET `message_id`=#{messageId}, - `car_id` = #{carId}, - `c_id` = #{cId}, - `t_id` = #{tId}, - `rule_value` = #{ruleValue} - WHERE `id` = #{id}; - - - - - - - - - diff --git a/cloud-modules/cloud-modules-processing/src/main/java/com/muyu/processing/consumer/OnLineMonitoringConsumer.java b/cloud-modules/cloud-modules-processing/src/main/java/com/muyu/processing/consumer/OnLineMonitoringConsumer.java index c9d0d83..f22ad7c 100644 --- a/cloud-modules/cloud-modules-processing/src/main/java/com/muyu/processing/consumer/OnLineMonitoringConsumer.java +++ b/cloud-modules/cloud-modules-processing/src/main/java/com/muyu/processing/consumer/OnLineMonitoringConsumer.java @@ -47,8 +47,8 @@ public class OnLineMonitoringConsumer { @Resource private AllVehicleCacheService allVehicleCacheService; - @Resource - private FaultCacheService faultCacheService; +// @Resource +// private FaultCacheService faultCacheService; @Resource private FenceCahceService fenceCahceService; @@ -69,7 +69,7 @@ public class OnLineMonitoringConsumer { log.info("添加本地缓存,车辆vin: {}", vin); // 获取redis中的数据 Fence fence = fenceCahceService.get(vin); - Object breakdown = faultCacheService.get(vin); +// Object breakdown = faultCacheService.get(vin); Vehicle vehicle = vehicleCacheService.get(vin); WarnRule warnRule = warnRuleCacheService.get(vin); WarnRuleResp warnRuleResp = warnStrategyCacheService.get(vin); @@ -77,7 +77,7 @@ public class OnLineMonitoringConsumer { // 封装从redis中获得的数据 HashMap map = new HashMap<>(); map.put("fence",fence); - map.put("breakdown",breakdown); +// map.put("breakdown",breakdown); map.put("vehicle",vehicle); map.put("warnRule",warnRule); map.put("warnRuleResp",warnRuleResp); diff --git a/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/bootstrap.yml b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/bootstrap.yml index 6da166b..7678337 100644 --- a/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/bootstrap.yml +++ b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/bootstrap.yml @@ -8,7 +8,7 @@ nacos: addr: 47.101.49.53:8848 user-name: nacos password: nacos - namespace: seven + namespace: warn # SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all # Spring spring: @@ -59,3 +59,13 @@ spring: logging: level: com.muyu.system.mapper: DEBUG +aliyun: + access-key-id: LTAI5t7Fnx2QLTYLSu9357wP + access-key-secret: 3LOnydNZ25ytsTGczuSygElx0HJ6nN + endpoint: ecs-cn-hangzhou.aliyuncs.com + region-id: cn-shanghai + image-id: m-uf66taa8r57ky0pg3e7s + instance-type: ecs.t6-c1m1.large + security-group-id: sg-uf6hyictocodexptlgiv + switch-id: vsw-uf6ags5luz17qd6ckn2tb + amount: 1