Compare commits
11 Commits
5cd149e502
...
09c28eb1fb
Author | SHA1 | Date |
---|---|---|
|
09c28eb1fb | |
|
089068a745 | |
|
3303cfd0b3 | |
|
3a4ddc8f2e | |
|
2f74b536d9 | |
|
21045e1d5a | |
|
203e7b6561 | |
|
e59a8b3300 | |
|
486e7a3c7a | |
|
f26476a526 | |
|
9b649d2e60 |
|
@ -15,9 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -62,6 +62,7 @@ public class BaseEntity implements Serializable {
|
|||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
|
|
|
@ -83,14 +83,13 @@ public class SysDept extends BaseEntity {
|
|||
/**
|
||||
* 父部门名称
|
||||
*/
|
||||
|
||||
@TableField(exist = false)
|
||||
private String parentName;
|
||||
|
||||
@TableField(exist = false)
|
||||
/**
|
||||
* 子部门
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<SysDept> children = new ArrayList<SysDept>();
|
||||
|
||||
public Long getDeptId () {
|
||||
|
|
|
@ -13,13 +13,30 @@ public class SysFirm {
|
|||
/**
|
||||
* 企业id
|
||||
**/
|
||||
private Integer firmId;
|
||||
private Integer deptId;
|
||||
/**
|
||||
* 企业名称
|
||||
**/
|
||||
private String firmName;
|
||||
private String deptName;
|
||||
/**
|
||||
* 企业认证
|
||||
**/
|
||||
private Integer approveId;
|
||||
* 企业负责人
|
||||
**/
|
||||
private String leader;
|
||||
/**
|
||||
* 企业联系电话
|
||||
**/
|
||||
private String phone;
|
||||
/**
|
||||
* 企业删除
|
||||
**/
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 企业状态
|
||||
**/
|
||||
private String status;
|
||||
/**
|
||||
* 企业创建人
|
||||
**/
|
||||
private String createBy;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.couplet.common.log.aop;
|
||||
|
||||
/**
|
||||
* @author DongXiaoDong
|
||||
* @version 1.0
|
||||
* @date 2024/3/28 23:12
|
||||
* @description
|
||||
*/
|
||||
public class AopRecord {
|
||||
}
|
|
@ -15,9 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>couplet-modules-mqtt</artifactId>
|
||||
<artifactId>couplet-modules-mq</artifactId>
|
||||
|
||||
<!-- <properties>-->
|
||||
<!-- <maven.compiler.source>17</maven.compiler.source>-->
|
||||
|
@ -18,7 +18,7 @@
|
|||
<!-- </properties>-->
|
||||
|
||||
<description>
|
||||
couplet-modules-mqttx获取报文模块
|
||||
couplet-modules-mq MQ模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
@ -91,6 +91,11 @@
|
|||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RabbitMQ依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
|
@ -1,4 +1,4 @@
|
|||
package com.couplet.mqtt;
|
||||
package com.couplet.mq;
|
||||
|
||||
import com.couplet.common.security.annotation.EnableCustomConfig;
|
||||
import com.couplet.common.security.annotation.EnableMyFeignClients;
|
||||
|
@ -10,15 +10,15 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* @ProjectName: Default (Template) Project
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description: 获取报文模块启动类
|
||||
* @Description: rabbitMq模块启动类
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class CoupletMqttxApplatcaion {
|
||||
public class CoupletMqApplatcaion {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CoupletMqttxApplatcaion.class, args);
|
||||
System.out.println("获取报文模块启动成功");
|
||||
SpringApplication.run(CoupletMqApplatcaion.class, args);
|
||||
System.out.println("获取报文、RabbitMQ模块启动成功");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
package com.couplet.mq.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/29
|
||||
* @Description: rabbitMQ配置类
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class RabbitMQConfig implements RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnsCallback {
|
||||
// 通过注入的方式获取队列名、交换机名和路由键
|
||||
//队列名
|
||||
@Value("${mq.queueName}")
|
||||
public String queueName;
|
||||
|
||||
//交换机
|
||||
@Value("${mq.exchangeName}")
|
||||
public String exchangeName;
|
||||
|
||||
//路由键
|
||||
@Value(("${mq.routingKey}"))
|
||||
public String routingKey;
|
||||
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/29 21:25
|
||||
* @Description: 创建并返回一个消息转换器,用于转换消息体。
|
||||
* @Param: []
|
||||
* @Return: 返回一个Jackson2JsonMessageConverter实例,用于JSON格式的消息转换。
|
||||
**/
|
||||
@Bean
|
||||
public MessageConverter messageConverter() {
|
||||
return new Jackson2JsonMessageConverter();
|
||||
}
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/29 21:26
|
||||
* @Description: 创建并返回一个持久化的队列。
|
||||
* @Param: []
|
||||
* @Return: 返回一个配置好的Queue实例。
|
||||
**/
|
||||
@Bean
|
||||
public Queue queue() {
|
||||
return new Queue(queueName, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/29 21:26
|
||||
* @Description: 创建并返回一个直连交换机。
|
||||
* @Param: []
|
||||
* @Return: 返回一个配置好的DirectExchange实例。
|
||||
**/
|
||||
@Bean("exchange")
|
||||
public DirectExchange directExchange() {
|
||||
return new DirectExchange(exchangeName);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/29 21:27
|
||||
* @Description: 配置并返回RabbitTemplate实例,用于发送消息。
|
||||
* @Param: connectionFactory RabbitMQ连接工厂。
|
||||
* @Return: 配置好的RabbitTemplate实例。
|
||||
**/
|
||||
@Primary
|
||||
@Bean
|
||||
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
|
||||
RabbitTemplate rabbitTempalte = new RabbitTemplate(connectionFactory);
|
||||
this.rabbitTemplate = rabbitTempalte;
|
||||
rabbitTempalte.setMessageConverter(messageConverter());
|
||||
rabbitTempalte();
|
||||
|
||||
return rabbitTempalte;
|
||||
}
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/29 21:27
|
||||
* @Description: 配置RabbitTemplate的回调函数。
|
||||
* @Param: []
|
||||
* @Return: void
|
||||
**/
|
||||
public void rabbitTempalte() {
|
||||
rabbitTemplate.setConfirmCallback(this);
|
||||
rabbitTemplate.setReturnsCallback(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/29 21:27
|
||||
* @Description: 创建并返回一个绑定,将队列与交换机绑定,并指定路由键
|
||||
* @Param: []
|
||||
* @Return: 返回一个配置好的Binding实例
|
||||
**/
|
||||
@Bean
|
||||
public Binding binding() {
|
||||
return BindingBuilder.bind(queue()).to(directExchange()).with(routingKey);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/29 21:28
|
||||
* @Description: 消息确认回调函数。
|
||||
* 当消息被交换机成功处理后调用,或当消息未能被正确处理时调用。
|
||||
* @Param: correlationData 关联数据,用于追踪消息
|
||||
* @Param: ack 消息是否被成功处理
|
||||
* @Param: s 附加信息
|
||||
**/
|
||||
@Override
|
||||
public void confirm(CorrelationData correlationData, boolean ack, String s) {
|
||||
if (ack) {
|
||||
log.info("{}消息到达交换机", correlationData.getId());
|
||||
} else {
|
||||
log.error("{}消息丢失", correlationData.getId());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/29 21:29
|
||||
* @Description: 消息返回回调函数。
|
||||
* 当消息未能被正确路由到队列时调用
|
||||
* @Param: returnedMessage 被返回的消息
|
||||
* @Return: void
|
||||
**/
|
||||
@Override
|
||||
public void returnedMessage(ReturnedMessage returnedMessage) {
|
||||
log.error("{}消息未到达队列", returnedMessage.getMessage().getMessageProperties().getMessageId());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.couplet.mq.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.couplet.common.core.utils.uuid.IdUtils;
|
||||
import com.couplet.mq.config.RabbitMQConfig;
|
||||
import com.couplet.mq.domain.Test;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/29
|
||||
* @Description: MQController类
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mq")
|
||||
@Slf4j
|
||||
public class MqController {
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@PostMapping("/receive")
|
||||
public void receive(@RequestBody Test data) {
|
||||
//创建配置类对象,用于获取配置值
|
||||
RabbitMQConfig config = new RabbitMQConfig();
|
||||
|
||||
rabbitTemplate.convertAndSend(config.exchangeName, config.routingKey, JSON.toJSONString(data) , message -> {
|
||||
message.getMessageProperties().setMessageId(IdUtils.randomUUID());
|
||||
return message;
|
||||
}, new CorrelationData(IdUtils.randomUUID()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.couplet.mq.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/29
|
||||
* @Description: 测试 参数类
|
||||
*/
|
||||
|
||||
public class Test implements Serializable {
|
||||
public String data;
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.couplet.mq.service;
|
||||
|
||||
import com.couplet.mq.config.RabbitMQConfig;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description: MQ消费者类
|
||||
*/
|
||||
@RabbitListener(queues = "${mq.queueName}")
|
||||
@Component
|
||||
@Slf4j
|
||||
public class Consumer {
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@RabbitHandler
|
||||
public void receive(String data, Channel channel, Message message) throws IOException {
|
||||
log.info("消费者接受到数据:{}", data);
|
||||
|
||||
//获取信息的标记
|
||||
long deliveryTag = message.getMessageProperties().getDeliveryTag();
|
||||
|
||||
//获取到消息的id
|
||||
String messageId = message.getMessageProperties().getMessageId();
|
||||
|
||||
Long add = redisTemplate.opsForSet().add("set:" + messageId, "set:" + messageId);
|
||||
|
||||
if (!redisTemplate.hasKey("value:" + messageId)) {
|
||||
redisTemplate.opsForValue().set("value:" + messageId, String.valueOf(deliveryTag), 10, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
try {
|
||||
if (add == 1) {
|
||||
log.info("---------------消费者开始消费---------------");
|
||||
|
||||
System.out.println(data);
|
||||
|
||||
log.info("---------------消费者结束消费---------------");
|
||||
}else {
|
||||
log.error("重复消费!");
|
||||
channel.basicReject(deliveryTag, false);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
String s = redisTemplate.opsForValue().get("value:" + messageId);
|
||||
long oldTag = Long.parseLong(s);
|
||||
|
||||
if ((oldTag + 2) != deliveryTag) {
|
||||
log.info("重新入队!");
|
||||
channel.basicNack(deliveryTag, false, true);
|
||||
}else {
|
||||
log.error("三次无法消费,不再入队!");
|
||||
channel.basicNack(deliveryTag, false, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.couplet.mqtt.service.impl;
|
||||
package com.couplet.mq.service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
|
@ -6,7 +6,7 @@ server:
|
|||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: couplet-mqtt
|
||||
name: couplet-mq
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
@ -40,3 +40,9 @@ mqtt:
|
|||
clientid: mqttx
|
||||
qos: 0
|
||||
topic: test
|
||||
|
||||
# RabbitMQ配置
|
||||
mq:
|
||||
queueName: queue
|
||||
exchangeName: exchange
|
||||
routingKey: routingKey
|
|
@ -1,15 +0,0 @@
|
|||
package com.couplet.mqtt.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description:
|
||||
*/
|
||||
@Component
|
||||
@Mapper
|
||||
public interface MqttMapper {
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package com.couplet.mqtt.service;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description: MQTT服务接口
|
||||
*/
|
||||
|
||||
public interface MqttService {
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.couplet.mqtt.service.impl;
|
||||
|
||||
import com.couplet.mqtt.service.MqttService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description: MQTT服务实现类
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MqttServiceImpl implements MqttService {
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
<?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.couplet.mqtt.mapper.MqttMapper">
|
||||
|
||||
|
||||
</mapper>
|
|
@ -5,6 +5,9 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
|
@ -20,11 +23,13 @@ public class VehicleEditParams {
|
|||
/*
|
||||
*车辆id
|
||||
* */
|
||||
@NotNull(message = "车辆id不能为空")
|
||||
private Long vehicleId;
|
||||
|
||||
/*
|
||||
*车辆类型
|
||||
* */
|
||||
@NotNull(message="车辆类型不能为空")
|
||||
private Integer vehicleType;
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.couplet.vehicle.exception;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/29
|
||||
* @Description: 车辆异常响应
|
||||
*/
|
||||
|
||||
public class VehicleException extends RuntimeException {
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
public VehicleException(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public VehicleException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public VehicleException() {
|
||||
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import com.couplet.vehicle.domain.LyhVehicle;
|
|||
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleListParams;
|
||||
import com.couplet.vehicle.exception.VehicleException;
|
||||
import com.couplet.vehicle.mapper.VehicleMapper;
|
||||
import com.couplet.vehicle.service.VehicleService;
|
||||
import com.couplet.vehicle.utils.SnowflakeIdGenerator;
|
||||
|
@ -79,7 +80,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
|||
|
||||
if (!update) {
|
||||
result = "删除失败";
|
||||
throw new RuntimeException(result);
|
||||
throw new VehicleException(result);
|
||||
}
|
||||
|
||||
result = "删除成功!";
|
||||
|
@ -124,7 +125,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
|||
|
||||
if (!update) {
|
||||
result = "编辑失败";
|
||||
throw new RuntimeException(result);
|
||||
throw new VehicleException(result);
|
||||
}
|
||||
|
||||
result = "编辑成功!";
|
||||
|
@ -153,7 +154,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
|||
|
||||
if (insert == 0) {
|
||||
result = "新增失败";
|
||||
throw new RuntimeException(result);
|
||||
throw new VehicleException(result);
|
||||
}
|
||||
|
||||
result = "新增成功!";
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -3,11 +3,9 @@ package com.couplet.system.controller;
|
|||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.system.domain.SysFirm;
|
||||
import com.couplet.system.service.SysFirmService;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -61,4 +59,17 @@ public class SysFirmController {
|
|||
Result<Integer> result = Result.success(i);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description // 删除企业 附属的员工一并删除
|
||||
* @Date 2024/3/29
|
||||
* @param deptId
|
||||
* @return com.couplet.common.core.domain.Result
|
||||
**/
|
||||
@DeleteMapping("delFirm/{deptId}")
|
||||
public Result delFirm(@PathVariable Integer deptId){
|
||||
int i = sysFirmService.delFirm(deptId);
|
||||
Result<Integer> success = Result.success(i);
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,4 +19,6 @@ public interface SysFirmMapper {
|
|||
|
||||
int updateFirm(SysFirm sysFirm);
|
||||
|
||||
int delFirm(Integer deptId);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,4 +16,6 @@ public interface SysFirmService {
|
|||
int addFirm(SysFirm sysFirm);
|
||||
|
||||
int updateFirm(SysFirm sysFirm);
|
||||
|
||||
int delFirm(Integer deptId);
|
||||
}
|
||||
|
|
|
@ -32,4 +32,9 @@ public class SysFirmServiceImpl implements SysFirmService {
|
|||
public int updateFirm(SysFirm sysFirm) {
|
||||
return sysFirmMapper.updateFirm(sysFirm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delFirm(Integer deptId) {
|
||||
return sysFirmMapper.delFirm(deptId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -4,19 +4,27 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.couplet.system.mapper.SysFirmMapper">
|
||||
<insert id="addFirm">
|
||||
INSERT INTO `ry-cloud`.`yyh_firm` ( `firm_name`)
|
||||
VALUES ( #{firmName});
|
||||
INSERT INTO `ry-cloud`.`sys_dept`
|
||||
( `dept_name`, `leader`, `phone`, `status`, `del_flag`, `create_by` )
|
||||
VALUES ( #{deptName}, #{leader}, #{phone}, #{status}, #{delFlag}, #{createBy});
|
||||
|
||||
|
||||
</insert>
|
||||
<update id="updateFirm">
|
||||
|
||||
UPDATE `ry-cloud`.`yyh_firm`
|
||||
SET `firm_name` = #{firmName}, `approve_id` = #{approveId}
|
||||
WHERE `firm_id` = #{firmId};
|
||||
UPDATE `ry-cloud`.`sys_dept`
|
||||
SET `dept_name` = #{deptName}, `leader` = #{leader}, `phone` = #{phone}, `status` = #{status}, `del_flag` = 0, `create_by` = #{createBy}
|
||||
WHERE `dept_id` = #{deptId};
|
||||
|
||||
|
||||
</update>
|
||||
<delete id="delFirm">
|
||||
update `sys_dept`
|
||||
set del_flag = '2'
|
||||
where dept_id = #{deptId}
|
||||
</delete>
|
||||
|
||||
<select id="firmList" resultType="com.couplet.common.system.domain.SysFirm">
|
||||
select * from yyh_firm;
|
||||
select * from sys_dept where del_flag = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -19,9 +19,65 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-modules-system</artifactId>
|
||||
<artifactId>couplet-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
|||
* @description
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = "com.couplet.**")
|
||||
@EnableFeignClients(basePackages = "com.couplet.**")
|
||||
public class CoupletTroubleApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CoupletTroubleApplication.class);
|
||||
|
|
|
@ -6,13 +6,13 @@ import com.couplet.common.core.web.page.TableDataInfo;
|
|||
import com.couplet.common.log.annotation.Log;
|
||||
import com.couplet.common.log.enums.BusinessType;
|
||||
import com.couplet.trouble.domain.coupletTroubleCode;
|
||||
import com.couplet.trouble.domain.req.TroubleAddReq;
|
||||
import com.couplet.trouble.domain.req.TroubleUpdReq;
|
||||
import com.couplet.trouble.service.SysTroubleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -42,8 +42,8 @@ public class SysTroubleController extends BaseController {
|
|||
*/
|
||||
@Log(title = "新增故障码数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping("insertTrouble")
|
||||
public Result<?> insert(@Validated @RequestBody TroubleAddReq troubleAddReq) {
|
||||
return toAjax(troubleService.addTrouble(troubleAddReq));
|
||||
public Result<?> insert(@Validated @RequestBody coupletTroubleCode troubleAddReq) {
|
||||
return toAjax(troubleService.save(troubleAddReq));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,8 +51,8 @@ public class SysTroubleController extends BaseController {
|
|||
*/
|
||||
@Log(title = "修改故障码数据",businessType = BusinessType.UPDATE)
|
||||
@PostMapping("updateTrouble")
|
||||
public Result<?> edit(@Validated @RequestBody TroubleUpdReq troubleUpdReq) {
|
||||
return toAjax(troubleService.updateTrouble(troubleUpdReq));
|
||||
public Result<?> edit(@Validated @RequestBody coupletTroubleCode troubleUpdReq) {
|
||||
return toAjax(troubleService.updateById(troubleUpdReq));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,8 +18,7 @@ import lombok.experimental.SuperBuilder;
|
|||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class coupletTroubleCode extends BaseEntity {
|
||||
public class coupletTroubleCode {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ import lombok.Data;
|
|||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class TroubleGrade {
|
||||
public class coupletTroubleGrade {
|
||||
private Integer gradeId;
|
||||
private String gradeName;
|
||||
}
|
|
@ -9,7 +9,7 @@ import lombok.Data;
|
|||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class TroubleType {
|
||||
public class coupletTroubleType {
|
||||
private Integer typeId;
|
||||
private String typeName;
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.couplet.trouble.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.couplet.common.core.annotation.Excel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
@ -19,6 +21,7 @@ public class TroubleUpdReq {
|
|||
* 主键id
|
||||
*/
|
||||
@Excel(name = "故障码主键", cellType = Excel.ColumnType.NUMERIC)
|
||||
@TableId(value = "trouble_id",type = IdType.AUTO)
|
||||
private Integer troubleId;
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||
public interface SysTroubleMapper extends BaseMapper<coupletTroubleCode> {
|
||||
List<coupletTroubleCode> selectTroubleList(coupletTroubleCode trouble);
|
||||
|
||||
int addTrouble(TroubleAddReq troubleAddReq);
|
||||
// int addTrouble(TroubleAddReq troubleAddReq);
|
||||
|
||||
int updateTrouble(TroubleUpdReq troubleUpdReq);
|
||||
// int updateTrouble(TroubleUpdReq troubleUpdReq);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
public interface SysTroubleService extends IService<coupletTroubleCode> {
|
||||
List<coupletTroubleCode> selectTroubleList(coupletTroubleCode trouble);
|
||||
|
||||
int addTrouble (TroubleAddReq troubleAddReq);
|
||||
// int addTrouble (TroubleAddReq troubleAddReq);
|
||||
|
||||
int updateTrouble(TroubleUpdReq troubleUpdReq);
|
||||
// int updateTrouble(TroubleUpdReq troubleUpdReq);
|
||||
}
|
||||
|
|
|
@ -35,23 +35,23 @@ public class SysTroubleServiceImpl extends ServiceImpl<SysTroubleMapper, couplet
|
|||
|
||||
/**
|
||||
* 新增故障码数据
|
||||
* @param troubleAddReq
|
||||
// * @param troubleAddReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int addTrouble(TroubleAddReq troubleAddReq) {
|
||||
return sysTroubleMapper.addTrouble(troubleAddReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改故障码数据
|
||||
* @param troubleUpdReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int updateTrouble(TroubleUpdReq troubleUpdReq) {
|
||||
return sysTroubleMapper.updateTrouble(troubleUpdReq);
|
||||
}
|
||||
// @Override
|
||||
// public int addTrouble(TroubleAddReq troubleAddReq) {
|
||||
// return sysTroubleMapper.addTrouble(troubleAddReq);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 修改故障码数据
|
||||
// * @param troubleUpdReq
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public int updateTrouble(TroubleUpdReq troubleUpdReq) {
|
||||
// return sysTroubleMapper.updateTrouble(troubleUpdReq);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
@ -30,3 +30,6 @@ spring:
|
|||
logging:
|
||||
level:
|
||||
com.couplet.trouble.mapper: DEBUG
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
|
|
@ -12,10 +12,6 @@
|
|||
<result property="troubleTag" column="trouble_tag"/>
|
||||
<result property="troubleTypeId" column="trouble_typeId"/>
|
||||
<result property="troubleValue" column="trouble_value"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTroubleVo">
|
||||
|
@ -23,20 +19,20 @@
|
|||
LEFT JOIN couplet_trouble_grade g on t.trouble_grade_id = g.grade_id
|
||||
LEFT JOIN couplet_trouble_type y on t.trouble_type_id= y.type_id
|
||||
</sql>
|
||||
<insert id="addTrouble">
|
||||
insert into couplet_trouble_code (trouble_code,trouble_position,trouble_value,trouble_tag,trouble_type_id,trouble_grade_id)
|
||||
values (#{troubleCode},#{troublePosition},#{troubleValue},#{troubleTag},#{troubleTypeId},#{troubleGradeId})
|
||||
</insert>
|
||||
<update id="updateTrouble">
|
||||
update couplet_trouble_code set
|
||||
trouble_code = #{troubleCode},
|
||||
trouble_position = #{troublePosition},
|
||||
trouble_value = #{troubleValue},
|
||||
trouble_tag = #{troubleTag},
|
||||
trouble_type_id = #{troubleTypeId},
|
||||
trouble_grade_id = #{troubleGradeId}
|
||||
where trouble_id = #{troubleId}
|
||||
</update>
|
||||
<!-- <insert id="addTrouble">-->
|
||||
<!-- insert into couplet_trouble_code (trouble_code,trouble_position,trouble_value,trouble_tag,trouble_type_id,trouble_grade_id)-->
|
||||
<!-- values (#{troubleCode},#{troublePosition},#{troubleValue},#{troubleTag},#{troubleTypeId},#{troubleGradeId})-->
|
||||
<!-- </insert>-->
|
||||
<!-- <update id="updateTrouble">-->
|
||||
<!-- update couplet_trouble_code set-->
|
||||
<!-- trouble_code = #{troubleCode},-->
|
||||
<!-- trouble_position = #{troublePosition},-->
|
||||
<!-- trouble_value = #{troubleValue},-->
|
||||
<!-- trouble_tag = #{troubleTag},-->
|
||||
<!-- trouble_type_id = #{troubleTypeId},-->
|
||||
<!-- trouble_grade_id = #{troubleGradeId}-->
|
||||
<!-- where trouble_id = #{troubleId}-->
|
||||
<!-- </update>-->
|
||||
<!-- <update id="updateTrouble" parameterType="com.couplet.trouble.domain.req.TroubleUpdReq">-->
|
||||
<!-- update dxd_trouble_code-->
|
||||
<!-- <set>-->
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<module>couplet-trouble</module>
|
||||
<module>couplet-electronic-fence</module>
|
||||
<module>couplet-modules-vehicle</module>
|
||||
<module>couplet-modules-mqtt</module>
|
||||
<module>couplet-modules-mq</module>
|
||||
<module>couplet-enterprisemanagement</module>
|
||||
</modules>
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
15
pom.xml
15
pom.xml
|
@ -245,6 +245,21 @@
|
|||
<artifactId>couplet-enterprisemanagement-remote</artifactId>
|
||||
<version>${couplet.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 车辆管理模块 -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-modules-vehicle</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RabbitMq模块 -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-modules-mq</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
Loading…
Reference in New Issue