Merge remote-tracking branch 'origin/server_five_liuyunhu' 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-visual/couplet-monitor/src/main/resources/bootstrap.ymlserver_five_liuyunhu
commit
9c9dfb7090
|
@ -15,7 +15,6 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
|
@ -24,6 +23,5 @@ spring:
|
|||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
|
|
@ -15,7 +15,6 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
|
@ -24,7 +23,6 @@ spring:
|
|||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
sentinel:
|
||||
# 取消控制台懒加载
|
||||
eager: true
|
||||
|
|
|
@ -16,9 +16,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
namespace: 172469
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
namespace: 172469
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -84,6 +84,13 @@
|
|||
<artifactId>couplet-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -10,6 +10,8 @@ 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.service.VehicleService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -39,10 +41,13 @@ public class VehicleController extends BaseController {
|
|||
@PostMapping("/list")
|
||||
@Log(title = "车辆列表")
|
||||
public Result list(@RequestBody VehicleListParams listParams) {
|
||||
PageHelper.startPage(listParams.getPageNum(), listParams.getPageSize());
|
||||
|
||||
List<Vehicle> List = vehicleService.list(listParams);
|
||||
List<Vehicle> list = vehicleService.list(listParams);
|
||||
|
||||
return Result.success(List);
|
||||
PageInfo<Vehicle> vehiclePageInfo = new PageInfo<>(list);
|
||||
|
||||
return Result.success(vehiclePageInfo);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -90,9 +95,27 @@ public class VehicleController extends BaseController {
|
|||
@PostMapping("/insert")
|
||||
@Log(title = "新增车辆", businessType = BusinessType.INSERT)
|
||||
public Result insert(@RequestBody @Validated VehicleInsertParams insertParams) {
|
||||
|
||||
System.out.println(insertParams);
|
||||
String result = vehicleService.insert(insertParams);
|
||||
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/31 21:34
|
||||
* @Description: 获取绑定当前车辆的标识
|
||||
* @Param: [vehicleId]
|
||||
* @Return: com.couplet.common.core.domain.Result
|
||||
**/
|
||||
@RequiresPermissions("couplet:vehicle:list")
|
||||
@GetMapping("/getBindLogoById/{vehicleId}")
|
||||
public Result getBindLogoById(@PathVariable("vehicleId") Long vehicleId) {
|
||||
|
||||
List<Long> bindLogoById = vehicleService.getBindLogoById(vehicleId);
|
||||
|
||||
|
||||
return Result.success(bindLogoById);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
|
|||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -53,4 +54,7 @@ public class VehicleEditParams {
|
|||
* */
|
||||
private String batteryNumber;
|
||||
|
||||
//标识id集合
|
||||
private List<Long> logoIds;
|
||||
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ public class VehicleInsertParams {
|
|||
/*
|
||||
* 一辆车可以绑定多个标识
|
||||
* */
|
||||
@Size(min = 1, message = "车辆至少绑定一个标识")
|
||||
private List<Long> logoIds;
|
||||
|
||||
}
|
||||
|
|
|
@ -26,4 +26,10 @@ public class VehicleListParams {
|
|||
* */
|
||||
private Integer vehicleState;
|
||||
|
||||
/*
|
||||
* 分页参数
|
||||
* */
|
||||
private Integer pageNum = 1;
|
||||
private Integer pageSize = 5;
|
||||
|
||||
}
|
||||
|
|
|
@ -18,4 +18,8 @@ import java.util.List;
|
|||
@Component
|
||||
public interface VehicleAndLogoMapper extends BaseMapper<VehicleAndLogo> {
|
||||
int vehicleBindLogo(@Param("vehicleId") Long vehicleId, @Param("logoIds") List<Long> logoIds);
|
||||
|
||||
int deleteByVehicleId(@Param("vehicleId") Long vehicleId);
|
||||
|
||||
List<Long> getBindLogoById(@Param("vehicleId") Long vehicleId);
|
||||
}
|
||||
|
|
|
@ -14,4 +14,8 @@ import java.util.List;
|
|||
|
||||
public interface VehicleAndLogoService extends IService<VehicleAndLogo> {
|
||||
int vehicleBindLogo(Long vehicleId, List<Long> logoIds);
|
||||
|
||||
int deleteByVehicleId(Long vehicleId);
|
||||
|
||||
List<Long> getBindLogoById(Long vehicleId);
|
||||
}
|
||||
|
|
|
@ -23,4 +23,6 @@ public interface VehicleService extends IService<Vehicle> {
|
|||
String editById(VehicleEditParams editParams);
|
||||
|
||||
String insert(VehicleInsertParams insertParams);
|
||||
|
||||
List<Long> getBindLogoById(Long vehicleId);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +35,43 @@ public class VehicleAndLogoServiceImpl extends ServiceImpl<VehicleAndLogoMapper,
|
|||
**/
|
||||
@Override
|
||||
public int vehicleBindLogo(Long vehicleId, List<Long> logoIds) {
|
||||
//将ids转为list
|
||||
// ArrayList<Long> logoIdList = new ArrayList<>();
|
||||
// String[] split = logoIds.split(",");
|
||||
// for (String s : split) {
|
||||
// logoIdList.add(Long.parseLong(s));
|
||||
// }
|
||||
|
||||
//执行绑定
|
||||
return mapper.vehicleBindLogo(vehicleId, logoIds);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/31 21:21
|
||||
* @Description: 删除掉车辆绑定
|
||||
* @Param: [vehicleId]
|
||||
* @Return: int
|
||||
**/
|
||||
@Override
|
||||
public int deleteByVehicleId(Long vehicleId) {
|
||||
|
||||
|
||||
return mapper.deleteByVehicleId(vehicleId);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/31 21:35
|
||||
* @Description: 获取绑定当前车辆的标识
|
||||
* @Param: [vehicleId]
|
||||
* @Return: java.util.List<java.lang.Long>
|
||||
**/
|
||||
@Override
|
||||
public List<Long> getBindLogoById(Long vehicleId) {
|
||||
|
||||
|
||||
return mapper.getBindLogoById(vehicleId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,13 +3,13 @@ package com.couplet.vehicle.service.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.core.utils.StringUtils;
|
||||
import com.couplet.vehicle.domain.Vehicle;
|
||||
import com.couplet.vehicle.domain.VehicleType;
|
||||
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.VehicleAndLogoService;
|
||||
import com.couplet.vehicle.service.VehicleService;
|
||||
|
@ -107,7 +107,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
|
|||
|
||||
if (!update) {
|
||||
result = "删除失败";
|
||||
throw new VehicleException(result);
|
||||
Result.error(result);
|
||||
}
|
||||
|
||||
result = "删除成功!";
|
||||
|
@ -126,10 +126,14 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
|
|||
public String editById(VehicleEditParams editParams) {
|
||||
String result = "";
|
||||
|
||||
if ((editParams.getLogoIds() == null || editParams.getLogoIds().isEmpty())) {
|
||||
result = "未选择电子围栏";
|
||||
Result.error(result);
|
||||
}
|
||||
|
||||
UpdateWrapper<Vehicle> updateWrapper = new UpdateWrapper<>();
|
||||
|
||||
//编辑车辆类型
|
||||
|
||||
updateWrapper.set("vehicle_type", editParams.getVehicleType())
|
||||
|
||||
//编辑电机厂商
|
||||
|
@ -152,9 +156,15 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
|
|||
|
||||
if (!update) {
|
||||
result = "编辑失败";
|
||||
throw new VehicleException(result);
|
||||
Result.error(result);
|
||||
}
|
||||
|
||||
//删除掉车辆id为入参的车辆、标识的中间表数据
|
||||
int delete = vehicleAndLogoService.deleteByVehicleId(editParams.getVehicleId());
|
||||
|
||||
//删除绑定之后,再添加新的绑定
|
||||
vehicleAndLogoService.vehicleBindLogo(editParams.getVehicleId(), editParams.getLogoIds());
|
||||
|
||||
result = "编辑成功!";
|
||||
|
||||
return result;
|
||||
|
@ -171,6 +181,12 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
|
|||
public String insert(VehicleInsertParams insertParams) {
|
||||
String result = "";
|
||||
|
||||
if ((insertParams.getLogoIds() == null || insertParams.getLogoIds().isEmpty())) {
|
||||
result = "未选择电子围栏";
|
||||
Result.error(result);
|
||||
}
|
||||
|
||||
|
||||
//雪花算法生成随机数
|
||||
SnowflakeIdGenerator idGenerator = new SnowflakeIdGenerator(1, 1);
|
||||
long randomId = idGenerator.nextId();
|
||||
|
@ -195,7 +211,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
|
|||
|
||||
if (insert == 0) {
|
||||
result = "新增失败";
|
||||
throw new VehicleException(result);
|
||||
Result.error(result);
|
||||
}
|
||||
|
||||
//获取新增的车辆id值
|
||||
|
@ -208,4 +224,19 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
* @Date: 2024/3/31 21:34
|
||||
* @Description: 获取绑定当前车辆的标识
|
||||
* @Param: [vehicleId]
|
||||
* @Return: java.util.List<java.lang.Long>
|
||||
**/
|
||||
@Override
|
||||
public List<Long> getBindLogoById(Long vehicleId) {
|
||||
List<Long> logoIds = vehicleAndLogoService.getBindLogoById(vehicleId);
|
||||
|
||||
return logoIds;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
namespace: 172469
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
namespace: 172469
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -12,4 +12,16 @@
|
|||
(#{vehicleId},#{logoId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByVehicleId">
|
||||
DELETE
|
||||
FROM `couplet_vehicle_and_logo`
|
||||
WHERE `vehicle_id` = #{vehicleId}
|
||||
</delete>
|
||||
|
||||
<select id="getBindLogoById" resultType="java.lang.Long">
|
||||
SELECT val.logo_id
|
||||
FROM `couplet_vehicle_and_logo` val
|
||||
WHERE val.vehicle_id = #{vehicleId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -15,7 +15,6 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
|
@ -24,7 +23,6 @@ spring:
|
|||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
logging:
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
namespace: 172469
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
namespace: 172469
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -250,14 +250,14 @@
|
|||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-modules-vehicle</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>${couplet.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RabbitMq模块 -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-modules-mq</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>${couplet.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
Loading…
Reference in New Issue