Compare commits

...

11 Commits

Author SHA1 Message Date
lijiayao 09c28eb1fb Merge remote-tracking branch 'origin/server_five_dongxiaodong' into server_five_xiaoyao
# Conflicts:
#	couplet-auth/src/main/resources/bootstrap.yml
#	couplet-gateway/src/main/resources/bootstrap.yml
#	couplet-modules/couplet-electronic-fence/couplet-electronic-fence-server/src/main/resources/bootstrap.yml
#	couplet-modules/couplet-enterprisemanagement/couplet-enterprisemanagement-server/src/main/resources/bootstrap.yml
#	couplet-modules/couplet-file/src/main/resources/bootstrap.yml
#	couplet-modules/couplet-gen/src/main/resources/bootstrap.yml
#	couplet-modules/couplet-job/src/main/resources/bootstrap.yml
#	couplet-modules/couplet-system/src/main/resources/bootstrap.yml
#	couplet-visual/couplet-monitor/src/main/resources/bootstrap.yml
2024-03-30 00:42:31 +08:00
lijiayao 089068a745 Merge remote-tracking branch 'origin/server_five_yuanyonghao' into server_five_xiaoyao
# Conflicts:
#	couplet-auth/src/main/resources/bootstrap.yml
#	couplet-gateway/src/main/resources/bootstrap.yml
#	couplet-modules/couplet-file/src/main/resources/bootstrap.yml
#	couplet-modules/couplet-gen/src/main/resources/bootstrap.yml
#	couplet-modules/couplet-job/src/main/resources/bootstrap.yml
#	couplet-modules/couplet-system/src/main/resources/bootstrap.yml
#	couplet-modules/pom.xml
#	couplet-visual/couplet-monitor/src/main/resources/bootstrap.yml
2024-03-30 00:42:05 +08:00
lijiayao 3303cfd0b3 Merge remote-tracking branch 'origin/server_five_liuyunhu' into server_five_xiaoyao
# Conflicts:
#	couplet-common/couplet-common-system/src/main/java/com/couplet/common/system/domain/SysDept.java
#	pom.xml
2024-03-30 00:40:16 +08:00
liuyunhu 3a4ddc8f2e 虎,车辆模块优化、mq模块测试,无法传输参数,数据到达交换机就停了 2024-03-29 22:32:16 +08:00
YuanYh 2f74b536d9 管理企业更新 2024-03-29 21:52:04 +08:00
dongxiaodong 21045e1d5a 3/28Dxd提交2 2024-03-29 15:26:27 +08:00
dongxiaodong 203e7b6561 3/28Dxd提交2 2024-03-29 15:24:39 +08:00
dongxiaodong e59a8b3300 Merge branch 'server_five_liuyunhu' into server_five_dongxiaodong 2024-03-29 09:16:01 +08:00
dongxiaodong 486e7a3c7a Merge branch 'server_five_liuyunhu' into server_five_dongxiaodong 2024-03-29 09:12:59 +08:00
dongxiaodong f26476a526 Merge branch 'server_five' into server_five_dongxiaodong 2024-03-29 09:05:20 +08:00
dongxiaodong 9b649d2e60 3/28Dxd提交2 2024-03-28 23:34:52 +08:00
48 changed files with 539 additions and 142 deletions

View File

@ -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
# 共享配置

View File

@ -62,6 +62,7 @@ public class BaseEntity implements Serializable {
/**
*
*/
@TableField(exist = false)
private String remark;
/**

View File

@ -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 () {

View File

@ -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;
}

View File

@ -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 {
}

View File

@ -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
# 共享配置

View File

@ -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
# 共享配置

View File

@ -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
# 共享配置

View File

@ -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
# 共享配置

View File

@ -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>

View File

@ -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模块启动成功");
}
}

View File

@ -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: Jackson2JsonMessageConverterJSON
**/
@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());
}
}

View File

@ -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()));
}
}

View File

@ -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;
}

View File

@ -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);
}
}
}
}

View File

@ -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.*;

View File

@ -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

View File

@ -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 {
}

View File

@ -1,12 +0,0 @@
package com.couplet.mqtt.service;
/**
* @ProjectName: five-groups-couplet
* @Author: LiuYunHu
* @CreateTime: 2024/3/28
* @Description: MQTT
*/
public interface MqttService {
}

View File

@ -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 {
}

View File

@ -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>

View File

@ -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;

View File

@ -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() {
}
}

View File

@ -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 = "新增成功!";

View File

@ -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
# 共享配置

View File

@ -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;
}
}

View File

@ -19,4 +19,6 @@ public interface SysFirmMapper {
int updateFirm(SysFirm sysFirm);
int delFirm(Integer deptId);
}

View File

@ -16,4 +16,6 @@ public interface SysFirmService {
int addFirm(SysFirm sysFirm);
int updateFirm(SysFirm sysFirm);
int delFirm(Integer deptId);
}

View File

@ -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);
}
}

View File

@ -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
# 共享配置

View File

@ -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>

View File

@ -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>

View File

@ -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);

View File

@ -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));
}
/**

View File

@ -18,8 +18,7 @@ import lombok.experimental.SuperBuilder;
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class coupletTroubleCode extends BaseEntity {
public class coupletTroubleCode {
/**
* id
*/

View File

@ -9,7 +9,7 @@ import lombok.Data;
* @description
*/
@Data
public class TroubleGrade {
public class coupletTroubleGrade {
private Integer gradeId;
private String gradeName;
}

View File

@ -9,7 +9,7 @@ import lombok.Data;
* @description
*/
@Data
public class TroubleType {
public class coupletTroubleType {
private Integer typeId;
private String typeName;
}

View File

@ -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;
/**

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
// }
}

View File

@ -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

View File

@ -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>-->

View File

@ -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>

View File

@ -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
View File

@ -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>