fast()预警系统
parent
dc61e01cea
commit
ad1accf68e
|
@ -0,0 +1,81 @@
|
||||||
|
package com.muyu.common.goods.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业对象 enterprise
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Enterprise extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 企业名称 */
|
||||||
|
@Excel(name = "企业名称")
|
||||||
|
private String enterpriseName;
|
||||||
|
|
||||||
|
/** 法定代表人 */
|
||||||
|
@Excel(name = "法定代表人")
|
||||||
|
private String legalPerson;
|
||||||
|
|
||||||
|
/** 经营执照凭证号码 */
|
||||||
|
@Excel(name = "经营执照凭证号码")
|
||||||
|
private String businessLincenseNumber;
|
||||||
|
|
||||||
|
/** 企业成立日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "企业成立日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date estabinessDate;
|
||||||
|
|
||||||
|
/** 经营范围 */
|
||||||
|
@Excel(name = "经营范围")
|
||||||
|
private String businessScope;
|
||||||
|
|
||||||
|
/** 注册地址 */
|
||||||
|
@Excel(name = "注册地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/** 企业联系方式 */
|
||||||
|
@Excel(name = "企业联系方式")
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
/** 公司邮箱 */
|
||||||
|
@Excel(name = "公司邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/** 企业当前状态(正常运营/负载运营) */
|
||||||
|
@Excel(name = "企业当前状态(正常运营/负载运营)")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** 企业入驻平台日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "企业入驻平台日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date registrationDate;
|
||||||
|
|
||||||
|
/** 是否认证0/1 */
|
||||||
|
@Excel(name = "是否认证0/1")
|
||||||
|
private Integer authentication;
|
||||||
|
|
||||||
|
/** 认证时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "认证时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date authenticationDate;
|
||||||
|
|
||||||
|
/** 服务等级0/1/2 */
|
||||||
|
@Excel(name = "服务等级0/1/2")
|
||||||
|
private Integer serviceLevel;
|
||||||
|
|
||||||
|
@Excel(name = "定制服务")
|
||||||
|
private String customized;
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.muyu.common.goods.remote;
|
||||||
|
|
||||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.goods.domain.Enterprise;
|
||||||
import com.muyu.common.goods.domain.Sources;
|
import com.muyu.common.goods.domain.Sources;
|
||||||
import com.muyu.common.goods.remote.factory.RemoteSourcesFallbackFactory;
|
import com.muyu.common.goods.remote.factory.RemoteSourcesFallbackFactory;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
@ -22,4 +23,11 @@ public interface RemoteSourcesService {
|
||||||
*/
|
*/
|
||||||
@PostMapping("enterprise/listSources")
|
@PostMapping("enterprise/listSources")
|
||||||
public Result<List<Sources>> listSources();
|
public Result<List<Sources>> listSources();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业详情
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("enterprise/lists")
|
||||||
|
public Result<List<Enterprise>> lists();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.muyu.common.goods.remote.factory;
|
package com.muyu.common.goods.remote.factory;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.goods.domain.Enterprise;
|
||||||
import com.muyu.common.goods.domain.Sources;
|
import com.muyu.common.goods.domain.Sources;
|
||||||
import com.muyu.common.goods.remote.RemoteSourcesService;
|
import com.muyu.common.goods.remote.RemoteSourcesService;
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
@ -17,6 +18,11 @@ public class RemoteSourcesFallbackFactory implements FallbackFactory<RemoteSourc
|
||||||
public Result<List<Sources>> listSources() {
|
public Result<List<Sources>> listSources() {
|
||||||
return Result.error(cause.getMessage());
|
return Result.error(cause.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<Enterprise>> lists() {
|
||||||
|
return Result.error(cause.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,15 +25,11 @@ public class BusinessConfigRunner implements ApplicationRunner {
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
//初始化
|
//初始化
|
||||||
Result<List<SysUser>> lists = remoteUserService.lists();
|
Result<List<SysUser>> lists = remoteUserService.lists();
|
||||||
log.info("获取:{}",lists);
|
|
||||||
List<SysUser> data = lists.getData();
|
List<SysUser> data = lists.getData();
|
||||||
for (SysUser datum : data) {
|
for (SysUser datum : data) {
|
||||||
if (datum.getFirm()!= null){
|
if (datum.getFirm()!= null){
|
||||||
SystemUserConfig.index(datum);
|
SystemUserConfig.index(datum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap<Long, SysUser> ser = SystemUserConfig.ser();
|
|
||||||
log.info("ser:{}",ser);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.business.common.Select;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class BreakdownSel {
|
||||||
|
/**
|
||||||
|
* 故障类型
|
||||||
|
*/
|
||||||
|
private String faultCode;
|
||||||
|
/**
|
||||||
|
* 多
|
||||||
|
*/
|
||||||
|
private Date faultStartTime;
|
||||||
|
/**
|
||||||
|
* 少
|
||||||
|
*/
|
||||||
|
private Date faultEndTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.business.common.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class Breakdown {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 故障码
|
||||||
|
*/
|
||||||
|
private String faultCode;
|
||||||
|
/**
|
||||||
|
* 车辆标识
|
||||||
|
*/
|
||||||
|
private String vin;
|
||||||
|
/**
|
||||||
|
* 故障状态
|
||||||
|
*/
|
||||||
|
private Integer faultState;
|
||||||
|
/**
|
||||||
|
* 故障产生时间
|
||||||
|
*/
|
||||||
|
private Date faultStartTime;
|
||||||
|
/**
|
||||||
|
* 故障解决时间
|
||||||
|
*/
|
||||||
|
private Date faultEndTime;
|
||||||
|
/**
|
||||||
|
* 故障级别
|
||||||
|
*/
|
||||||
|
private Integer faultLevel;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.business.common.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class FaultCode {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 故障码
|
||||||
|
*/
|
||||||
|
private String faultCode;
|
||||||
|
/**
|
||||||
|
* 故障标签
|
||||||
|
*/
|
||||||
|
private String faultLabel;
|
||||||
|
/**
|
||||||
|
* 故障位
|
||||||
|
*/
|
||||||
|
private Long faultBit;
|
||||||
|
/**
|
||||||
|
* 故障值
|
||||||
|
*/
|
||||||
|
private Long faultValue;
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.business.common.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class Sources {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 企业id
|
||||||
|
*/
|
||||||
|
private Long enterpriseId;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 连接库
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* ip
|
||||||
|
*/
|
||||||
|
private String ip;
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.business.common.psvm;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障信息
|
||||||
|
* @ClassName FaultInfo
|
||||||
|
* @Author GuanTieLin
|
||||||
|
* @Date 2024/6/20 16:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class FaultInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆唯一标识
|
||||||
|
*/
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障编码
|
||||||
|
*/
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private Date time;
|
||||||
|
}
|
|
@ -1,37 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>muyu</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>muyu-business-kafka</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>muyu-business-common</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.kafka</groupId>
|
|
||||||
<artifactId>spring-kafka</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,13 +0,0 @@
|
||||||
package muyu.business.kafka.common;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.kafka.annotation.KafkaListener;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class KafkaMonitor {
|
|
||||||
|
|
||||||
@KafkaListener(topics = "${kafka.topic}")
|
|
||||||
public void receive(String message){
|
|
||||||
System.out.println("监听到:" + message);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +1,20 @@
|
||||||
package com.muyu.goods.client;
|
package com.muyu.goods.client;
|
||||||
|
|
||||||
|
import org.springframework.amqp.core.AmqpAdmin;
|
||||||
import org.springframework.amqp.core.ExchangeTypes;
|
import org.springframework.amqp.core.ExchangeTypes;
|
||||||
import org.springframework.amqp.core.FanoutExchange;
|
import org.springframework.amqp.core.FanoutExchange;
|
||||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class MqConsumer {
|
public class MqConsumer {
|
||||||
|
@Autowired
|
||||||
|
private AmqpAdmin amqpAdmin;
|
||||||
|
|
||||||
|
|
||||||
// @RabbitListener(queuesToDeclare = {@Queue("vehicle.event")})
|
// @RabbitListener(queuesToDeclare = {@Queue("vehicle.event")})
|
||||||
|
@ -19,6 +23,7 @@ public class MqConsumer {
|
||||||
exchange = @Exchange(value = "vehicle.event", type = ExchangeTypes.FANOUT))})
|
exchange = @Exchange(value = "vehicle.event", type = ExchangeTypes.FANOUT))})
|
||||||
public void handleMessage(String message) {
|
public void handleMessage(String message) {
|
||||||
System.out.println("Received message: " + message);
|
System.out.println("Received message: " + message);
|
||||||
|
amqpAdmin.deleteQueue("vehicle.event");
|
||||||
// 在这里处理接收到的消息
|
// 在这里处理接收到的消息
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.muyu.goods.controller;
|
||||||
|
|
||||||
|
import com.business.common.Select.BreakdownSel;
|
||||||
|
import com.business.common.domain.Breakdown;
|
||||||
|
import com.business.common.domain.FaultCode;
|
||||||
|
import com.business.common.domain.Sources;
|
||||||
|
import com.business.common.psvm.FaultInfo;
|
||||||
|
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.goods.service.IBreakdownService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Log4j2
|
||||||
|
@RequestMapping("breakdown")
|
||||||
|
public class BreakdownController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IBreakdownService service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<Breakdown>> list(BreakdownSel breakdownSel)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Breakdown> list = service.selectBreakdownList(breakdownSel);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加新的故障记录
|
||||||
|
* @param faultInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("indexBreakDown")
|
||||||
|
public Result indexBreakDown(@RequestBody FaultInfo faultInfo) {
|
||||||
|
return success(service.indexBreakDown(faultInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障解决记录
|
||||||
|
* @param faultInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("updateBreakDown")
|
||||||
|
public Result updateBreakDown(@RequestBody FaultInfo faultInfo) {
|
||||||
|
return success(service.updateBreakDown(faultInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部故障值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("listFaultCode")
|
||||||
|
public Result<List<FaultCode>> listFaultCode() {
|
||||||
|
return success(service.listFaultCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("selectVinEnterprise")
|
||||||
|
public Result<Sources> selectVinEnterprise(@RequestParam String vin) {
|
||||||
|
return success(service.selectVinEnterprise(vin));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图形化
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("pies")
|
||||||
|
public Result<List<Map<String,Object>>> pies() {
|
||||||
|
return success(service.pies());
|
||||||
|
}
|
||||||
|
}
|
|
@ -45,19 +45,10 @@ public class MapController extends BaseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("selectFenceGroupsById/{carId}")
|
@PostMapping("selectFenceGroupsById/{carId}")
|
||||||
public Result<List<FenceGroups>> selectFenceGroupsById(@PathVariable Long carId){
|
public Result<List<List<GroupFenceDev>>> selectFenceGroupsById(@PathVariable Long carId){
|
||||||
return success(iMapService.selectFenceGroupsById(carId));
|
return success(iMapService.selectFenceGroupsById(carId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看围栏组绑定围栏
|
|
||||||
* @param groupsId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("selectGroupsFenceDevById/{groupsId}")
|
|
||||||
public Result<List<GroupFenceDev>> selectGroupsFenceDevById(@PathVariable Long groupsId){
|
|
||||||
return success(iMapService.selectGroupsFenceDevById(groupsId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加新的围栏组
|
* 添加新的围栏组
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.goods.mapper;
|
||||||
|
|
||||||
|
import com.business.common.Select.BreakdownSel;
|
||||||
|
import com.business.common.domain.Breakdown;
|
||||||
|
import com.business.common.domain.Car;
|
||||||
|
import com.business.common.domain.FaultCode;
|
||||||
|
import com.business.common.psvm.FaultInfo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface BreakdownMapper {
|
||||||
|
Integer indexBreakDown(FaultInfo faultInfo);
|
||||||
|
|
||||||
|
Integer updateBreakDown(FaultInfo faultInfo);
|
||||||
|
|
||||||
|
List<FaultCode> listFaultCode();
|
||||||
|
|
||||||
|
Car selectVinCar(@Param("vin") String vin);
|
||||||
|
|
||||||
|
List<Breakdown> selectBreakdownList(BreakdownSel breakdownSel);
|
||||||
|
|
||||||
|
List<Map<String, Object>> pies();
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.muyu.goods.monitor.mq;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.business.common.psvm.FaultInfo;
|
||||||
|
import com.muyu.goods.controller.BreakdownController;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.core.AmqpAdmin;
|
||||||
|
import org.springframework.amqp.core.ExchangeTypes;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class breakdownMqConsumer {
|
||||||
|
@Autowired
|
||||||
|
private AmqpAdmin amqpAdmin;
|
||||||
|
@Autowired
|
||||||
|
private BreakdownController breakdownController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理发生的故障
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
//监听交换机 Queue(队列名) @Exchange(value = "交换机名称", type = ExchangeTypes.FANOUT)
|
||||||
|
@RabbitListener(bindings = {@QueueBinding(value = @Queue("fault_start_message"),
|
||||||
|
exchange = @Exchange(value = "fault.message", type = ExchangeTypes.FANOUT))})
|
||||||
|
public void failureOccurrence(String message) {
|
||||||
|
FaultInfo faultInfo = JSONObject.parseObject(message, FaultInfo.class);
|
||||||
|
log.info("获取存在:{}",faultInfo);
|
||||||
|
log.info("获取存在:{}",message);
|
||||||
|
// breakdownController.indexBreakDown(faultInfo);
|
||||||
|
amqpAdmin.deleteQueue("fault_start_message");
|
||||||
|
// 在这里处理接收到的消息
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理解决的故障
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
@RabbitListener(bindings = {@QueueBinding(value = @Queue("fault_end_message"),
|
||||||
|
exchange = @Exchange(value = "fault.message", type = ExchangeTypes.FANOUT))})
|
||||||
|
public void failureShooting(String message) {
|
||||||
|
FaultInfo faultInfo = JSONObject.parseObject(message, FaultInfo.class);
|
||||||
|
log.info("解决:{}",message);
|
||||||
|
log.info("解决:{}",faultInfo);
|
||||||
|
// breakdownController.updateBreakDown(faultInfo);
|
||||||
|
amqpAdmin.deleteQueue("fault_end_message");
|
||||||
|
// 在这里处理接收到的消息
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.muyu.goods.service;
|
||||||
|
|
||||||
|
import com.business.common.Select.BreakdownSel;
|
||||||
|
import com.business.common.domain.Breakdown;
|
||||||
|
import com.business.common.domain.FaultCode;
|
||||||
|
import com.business.common.domain.Sources;
|
||||||
|
import com.business.common.psvm.FaultInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface IBreakdownService {
|
||||||
|
/**
|
||||||
|
* 故障记录
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Breakdown> selectBreakdownList(BreakdownSel breakdownSel);
|
||||||
|
/**
|
||||||
|
* 记录故障发生
|
||||||
|
* @param faultInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer indexBreakDown(FaultInfo faultInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录故障解决
|
||||||
|
* @param faultInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer updateBreakDown(FaultInfo faultInfo);
|
||||||
|
|
||||||
|
List<FaultCode> listFaultCode();
|
||||||
|
|
||||||
|
Sources selectVinEnterprise(String vin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图形化
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Map<String,Object>> pies();
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import com.business.common.middle.GroupFenceDev;
|
||||||
import com.business.common.domain.Fence;
|
import com.business.common.domain.Fence;
|
||||||
import com.business.common.domain.FenceGroups;
|
import com.business.common.domain.FenceGroups;
|
||||||
import com.business.common.psvm.Pences;
|
import com.business.common.psvm.Pences;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -16,9 +17,8 @@ public interface IMapService {
|
||||||
|
|
||||||
List<Fence> selectFence();
|
List<Fence> selectFence();
|
||||||
|
|
||||||
List<CarGroupsDev> selectFenceGroupsById(Long carId);
|
List<List<GroupFenceDev>> selectFenceGroupsById(Long carId);
|
||||||
|
|
||||||
List<GroupFenceDev> selectGroupsFenceDevById(Long groupsId);
|
|
||||||
String getSel(Pences list);
|
String getSel(Pences list);
|
||||||
|
|
||||||
String deleteFence(Long fenceId);
|
String deleteFence(Long fenceId);
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.muyu.goods.service.impl;
|
||||||
|
|
||||||
|
import com.business.common.Select.BreakdownSel;
|
||||||
|
import com.business.common.domain.Breakdown;
|
||||||
|
import com.business.common.domain.Car;
|
||||||
|
import com.business.common.domain.FaultCode;
|
||||||
|
import com.business.common.domain.Sources;
|
||||||
|
import com.business.common.psvm.FaultInfo;
|
||||||
|
import com.muyu.common.goods.domain.Enterprise;
|
||||||
|
import com.muyu.common.goods.remote.RemoteSourcesService;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
|
import com.muyu.goods.mapper.BreakdownMapper;
|
||||||
|
import com.muyu.goods.service.IBreakdownService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class BreakdownService implements IBreakdownService {
|
||||||
|
@Autowired
|
||||||
|
private BreakdownMapper mapper;
|
||||||
|
@Autowired
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
@Autowired
|
||||||
|
private RemoteSourcesService remoteSourcesService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障记录
|
||||||
|
* @param breakdownSel
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Breakdown> selectBreakdownList(BreakdownSel breakdownSel) {
|
||||||
|
return mapper.selectBreakdownList(breakdownSel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer indexBreakDown(FaultInfo faultInfo) {
|
||||||
|
return mapper.indexBreakDown(faultInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer updateBreakDown(FaultInfo faultInfo) {
|
||||||
|
return mapper.updateBreakDown(faultInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FaultCode> listFaultCode() {
|
||||||
|
return mapper.listFaultCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Sources selectVinEnterprise(String vin) {
|
||||||
|
// 查询车辆
|
||||||
|
Car car = mapper.selectVinCar(vin);
|
||||||
|
//根据车辆管理人查询员工
|
||||||
|
List<SysUser> userList = remoteUserService.lists().getData();
|
||||||
|
SysUser sysUser = userList.stream().filter(firm -> firm.getFirm() == car.getOwnerId()).collect(Collectors.toList()).get(0);
|
||||||
|
//根据员工查询到企业
|
||||||
|
List<Enterprise> enterpriseList = remoteSourcesService.lists().getData();
|
||||||
|
Enterprise enterprise1 = enterpriseList.stream().filter(enterprise -> enterprise.getId() == sysUser.getFirm()).collect(Collectors.toList()).get(0);
|
||||||
|
//根据企业查询到企业数据源
|
||||||
|
com.muyu.common.goods.domain.Sources sources = remoteSourcesService.listSources().getData().stream().filter(sour -> sour.getEnterpriseId() == enterprise1.getId()).collect(Collectors.toList()).get(0);
|
||||||
|
Sources sources1 = Sources.builder()
|
||||||
|
.id(sources.getId())
|
||||||
|
.enterpriseId(sources.getEnterpriseId())
|
||||||
|
.name(sources.getName())
|
||||||
|
.url(sources.getUrl())
|
||||||
|
.ip(sources.getIp())
|
||||||
|
.username(sources.getUsername())
|
||||||
|
.password(sources.getPassword())
|
||||||
|
.build();
|
||||||
|
return sources1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> pies() {
|
||||||
|
return mapper.pies();
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -48,17 +49,16 @@ public class MapService implements IMapService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<CarGroupsDev> selectFenceGroupsById(Long carId) {
|
public List<List<GroupFenceDev>> selectFenceGroupsById(Long carId) {
|
||||||
List<CarGroupsDev> carGroupsDevs = selectCarGroups();
|
List<CarGroupsDev> carGroupsDevs = selectCarGroups();
|
||||||
List<CarGroupsDev> carGroupsDevList = carGroupsDevs.stream().filter(group -> group.getCarId() == carId).collect(Collectors.toList());
|
List<CarGroupsDev> carGroupsDevList = carGroupsDevs.stream().filter(group -> group.getCarId() == carId).collect(Collectors.toList());
|
||||||
return carGroupsDevList;
|
List<List<GroupFenceDev>> listList = new ArrayList<>();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<GroupFenceDev> selectGroupsFenceDevById(Long groupsId) {
|
|
||||||
List<GroupFenceDev> groupFenceDevs = selectGroupFence();
|
List<GroupFenceDev> groupFenceDevs = selectGroupFence();
|
||||||
List<GroupFenceDev> groupFenceDevList = groupFenceDevs.stream().filter(group -> group.getGroupsId() == groupsId).collect(Collectors.toList());
|
for (CarGroupsDev carGroupsDev : carGroupsDevList) {
|
||||||
return groupFenceDevList;
|
List<GroupFenceDev> groupFenceDevList = groupFenceDevs.stream().filter(group -> group.getGroupsId() == carGroupsDev.getGroupsId()).collect(Collectors.toList());
|
||||||
|
listList.add(groupFenceDevList);
|
||||||
|
}
|
||||||
|
return listList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.muyu.goods.mapper.BreakdownMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.business.common.domain.Breakdown" id="BreakdownResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="faultCode" column="fault_code" />
|
||||||
|
<result property="vin" column="vin" />
|
||||||
|
<result property="faultState" column="fault_state" />
|
||||||
|
<result property="faultStartTime" column="fault_start_time" />
|
||||||
|
<result property="faultEndTime" column="fault_end_time" />
|
||||||
|
<result property="faultLevel" column="fault_level" />
|
||||||
|
</resultMap>
|
||||||
|
<resultMap type="com.business.common.domain.FaultCode" id="FaultCodeResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="faultCode" column="fault_code" />
|
||||||
|
<result property="faultLabel" column="fault_label" />
|
||||||
|
<result property="faultBit" column="fault_bit" />
|
||||||
|
<result property="faultValue" column="fault_value" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBreakdownVo">
|
||||||
|
select id, fault_code, vin, fault_state, fault_start_time, fault_end_time, fault_level from breakdown
|
||||||
|
</sql>
|
||||||
|
<sql id="selectFaultCodeVo">
|
||||||
|
select id, fault_code, fault_label, fault_bit, fault_value from fault_code;
|
||||||
|
</sql>
|
||||||
|
<insert id="indexBreakDown">
|
||||||
|
insert into breakdown
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="faultCode != null">fault_code,</if>
|
||||||
|
<if test="vin != null">vin,</if>
|
||||||
|
fault_state,
|
||||||
|
<if test="faultStartTime != null">fault_start_time,</if>
|
||||||
|
fault_level,
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="faultCode != null">#{faultCode},</if>
|
||||||
|
<if test="vin != null">#{vin},</if>
|
||||||
|
<if test="faultState != null">0,</if>
|
||||||
|
<if test="faultStartTime != null">#{time},</if>
|
||||||
|
<if test="faultLevel != null">1,</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateBreakDown">
|
||||||
|
update breakdown
|
||||||
|
set fault_end_time = #{time},
|
||||||
|
fault_state = 1
|
||||||
|
where
|
||||||
|
fault_code = #{faultCode} and
|
||||||
|
vin = #{vin} and
|
||||||
|
fault_end_time = null
|
||||||
|
</update>
|
||||||
|
<select id="listFaultCode" resultType="com.business.common.domain.FaultCode">
|
||||||
|
<include refid="selectFaultCodeVo"></include>
|
||||||
|
</select>
|
||||||
|
<select id="selectVinCar" resultType="com.business.common.domain.Car">
|
||||||
|
select *
|
||||||
|
from car where vin = #{vin};
|
||||||
|
</select>
|
||||||
|
<select id="selectBreakdownList" resultType="com.business.common.domain.Breakdown">
|
||||||
|
<include refid="selectBreakdownVo"></include>
|
||||||
|
<where>
|
||||||
|
<if test="faultCode != null and faultCode!=''">and fault_code like concat('%',#{faultCode},'%')</if>
|
||||||
|
<if test="faultStartTime != null and faultStartTime != ''">and fault_start_time >= #{faultStartTime} </if>
|
||||||
|
<if test="faultEndTime != null and faultEndTime != ''">and fault_start_time < = #{faultEndTime} </if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="pies" resultType="java.util.Map">
|
||||||
|
select fault_code name, count(fault_code) value from breakdown group by fault_code
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -16,7 +16,6 @@
|
||||||
<module>muyu-business-common</module>
|
<module>muyu-business-common</module>
|
||||||
<module>muyu-business-server</module>
|
<module>muyu-business-server</module>
|
||||||
<module>muyu-business-client</module>
|
<module>muyu-business-client</module>
|
||||||
<module>muyu-business-kafka</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
Loading…
Reference in New Issue