Compare commits

...

8 Commits

Author SHA1 Message Date
lijiayao 313fd4aa54 Merge remote-tracking branch 'origin/server_five_yuanyonghao' into server_five_xiaoyao
# Conflicts:
#	couplet-auth/src/main/resources/bootstrap.yml
2024-04-01 19:49:39 +08:00
lijiayao 9c9dfb7090 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.yml
2024-04-01 19:49:11 +08:00
lijiayao 1094fe0136 Merge remote-tracking branch 'origin/server_five_dongxiaodong' into server_five_xiaoyao 2024-04-01 19:48:16 +08:00
dongxiaodong a20dc82049 解析报文 2024-03-31 22:28:46 +08:00
liuyunhu f597b6cbfc 虎,车辆模块完善,前台完善,功能已完成 2024-03-31 22:10:30 +08:00
dongxiaodong b17a7104e0 Merge branch 'server_five' of https://gitea.qinmian.online/five-groups/five-groups-couplet into server_five_dongxiaodong
# Conflicts:
#	couplet-common/couplet-common-system/src/main/java/com/couplet/common/system/domain/SysDept.java
2024-03-31 15:03:41 +08:00
dongxiaodong 77045a3977 3/28Dxd提交2 2024-03-31 15:01:17 +08:00
YuanYh 9b683e6129 管理企业更新 2024-03-31 10:12:18 +08:00
42 changed files with 933 additions and 73 deletions

View File

@ -4,6 +4,8 @@ server:
# Spring
spring:
main:
allow-bean-definition-overriding: true
application:
# 应用名称
name: couplet-auth
@ -23,5 +25,3 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
main:
allow-bean-definition-overriding: true

View File

@ -0,0 +1,34 @@
package com.couplet.common.core.domain;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author DongZl
* @description:
*/
@Data
public class PageResult<T> implements Serializable {
/**
*
*/
private long total;
/**
*
*/
private List<T> list;
public PageResult() {
}
public PageResult(long total, List<T> list) {
this.total = total;
this.list = list;
}
public static <T> PageResult<T> toPageResult(long total, List<T> list){
return new PageResult(total , list);
}
public static <T> Result<PageResult<T>> toResult(long total, List<T> list){
return Result.success(PageResult.toPageResult(total,list));
}
}

View File

@ -40,6 +40,10 @@ public class SysDept extends BaseEntity {
*/
private Long parentId;
@TableField(exist = false)
private String remark;
/**
*
*/

View File

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

View File

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

View File

@ -15,11 +15,9 @@ 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,6 +4,8 @@ server:
# Spring
spring:
main:
allow-bean-definition-overriding: true
application:
# 应用名称
name: couplet-gen
@ -15,11 +17,9 @@ 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,6 +4,8 @@ server:
# Spring
spring:
main:
allow-bean-definition-overriding: true
application:
# 应用名称
name: couplet-job
@ -15,11 +17,9 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
# 配置文件格式
file-extension: yml
# 共享配置

View File

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

View File

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

View File

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

View File

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

View File

@ -57,7 +57,6 @@ public class VehicleInsertParams {
/*
*
* */
@Size(min = 1, message = "车辆至少绑定一个标识")
private List<Long> logoIds;
}

View File

@ -26,4 +26,10 @@ public class VehicleListParams {
* */
private Integer vehicleState;
/*
*
* */
private Integer pageNum = 1;
private Integer pageSize = 5;
}

View File

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

View File

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

View File

@ -23,4 +23,6 @@ public interface VehicleService extends IService<Vehicle> {
String editById(VehicleEditParams editParams);
String insert(VehicleInsertParams insertParams);
List<Long> getBindLogoById(Long vehicleId);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,84 @@
<?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.couplet</groupId>
<artifactId>couplet-modules</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>couplet-msg</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>
<!-- 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-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>
</project>

View File

@ -0,0 +1,382 @@
package com.couplet.msg.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/31 16:01
* @description
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MsgData {
/**
* VIN
*/
private String vin;
/**
* 线
*/
private String drivingRoute;
/**
*
*/
private String longitude;
/**
*
*/
private String latitude;
/**
*
*/
private String speed;
/**
*
*/
private BigDecimal mileage;
/**
*
*/
private String voltage;
/**
*
*/
private String current;
/**
*
*/
private String resistance;
/**
*
*/
private String gear = "P";
/**
*
*/
private String accelerationPedal;
/**
*
*/
private String brakePedal;
/**
*
*/
private String fuelConsumptionRate;
/**
*
*/
private String motorControllerTemperature;
/**
*
*/
private String motorSpeed;
/**
*
*/
private String motorTorque;
/**
*
*/
private String motorTemperature;
/**
*
*/
private String motorVoltage;
/**
*
*/
private String motorCurrent;
/**
* SOC
*/
private BigDecimal remainingBattery;
/**
*
*/
private BigDecimal batteryLevel;
/**
*
*/
private String maximumFeedbackPower;
/**
*
*/
private String maximumDischargePower;
/**
* BMS
*/
private String selfCheckCounter;
/**
*
*/
private String totalBatteryCurrent;
/**
* V3
*/
private String totalBatteryVoltage;
/**
*
*/
private String singleBatteryMaxVoltage;
/**
*
*/
private String singleBatteryMinVoltage;
/**
*
*/
private String singleBatteryMaxTemperature;
/**
*
*/
private String singleBatteryMinTemperature;
/**
*
*/
private String availableBatteryCapacity;
/**
*
*/
private int vehicleStatus = 1;
/**
*
*/
private int chargingStatus = 1;
/**
*
*/
private int operatingStatus = 1;
/**
* SOC
*/
private int socStatus = 1;
/**
*
*/
private int chargingEnergyStorageStatus = 1;
/**
*
*/
private int driveMotorStatus = 1;
/**
*
*/
private int positionStatus = 1;
/**
* EAS()
*/
private int easStatus = 1;
/**
* PTC()
*/
private int ptcStatus = 1;
/**
* EPS()
*/
private int epsStatus = 1;
/**
* ABS()
*/
private int absStatus = 1;
/**
* MCU(/)
*/
private int mcuStatus = 1;
/**
*
*/
private int heatingStatus = 1;
/**
*
*/
private int batteryStatus = 1;
/**
*
*/
private int batteryInsulationStatus = 1;
/**
* DCDC()
*/
private int dcdcStatus = 1;
/**
* CHG()
*/
private int chgStatus = 1;
/**
*
*/
private String vehicleStatusMsg;
/**
*
*/
private String smartHardwareMsg;
/**
*
*/
private String batteryMsg;
public String getMsg(){
//第一位VIN
return vin +
// 当前时间戳
System.currentTimeMillis() +
//第二位经度 longitude latitude
getValue(longitude, 11) +
//第三位维度 longitude latitude
getValue(latitude, 10) +
//车速
getValue(speed, 6) +
//总里程
getValue(mileage == null ? "" : mileage.toString(), 11) +
// 总电压
getValue(voltage, 6) +
//总电流
getValue(current, 5) +
//绝缘电阻 79 - 87
getValue(resistance, 9) +
//档位
(gear == null ? "D" : gear) +
// 加速踏板行程值
getValue(accelerationPedal, 2) +
// 制动踏板行程值
getValue(brakePedal, 2) +
// 燃料消耗率
getValue(fuelConsumptionRate, 5) +
//电机控制器温度
getValue(motorControllerTemperature, 6) +
//电机转速
getValue(motorSpeed, 5) +
//点击转矩
getValue(motorTorque, 4) +
//电机温度
getValue(motorTemperature, 6) +
//电机电压
getValue(motorVoltage, 5) +
//电机电流
getValue(motorCurrent, 8) +
//动力电池剩余电量SOC
getValue(remainingBattery == null ? "" : remainingBattery.toString(), 6) +
//当前状态允许的最大反馈功率
getValue(maximumFeedbackPower, 6) +
//当前状态允许最大放电功率
getValue(maximumDischargePower, 6) +
//BMS自检计数器
getValue(selfCheckCounter, 2) +
//动力电池充放电电流
getValue(totalBatteryCurrent, 5) +
//动力电池负载端总电压V3
getValue(totalBatteryVoltage, 6) +
//单次最大电压
getValue(singleBatteryMaxVoltage, 4) +
//单体电池最低电压
getValue(singleBatteryMinVoltage, 4) +
//单体电池最高温度
getValue(singleBatteryMaxTemperature, 6) +
//单体电池最低温度
getValue(singleBatteryMinTemperature, 6) +
//动力电池可用容量
getValue(availableBatteryCapacity, 6) +
//车辆状态
vehicleStatus +
//充电状态
chargingStatus +
//运行状态
operatingStatus +
//SOC
socStatus +
//可充电储能装置工作状态
chargingEnergyStorageStatus +
//驱动电机状态
driveMotorStatus +
//定位是否有效
positionStatus +
//EAS
easStatus +
//PTC
ptcStatus +
//EPS
epsStatus +
//ABS
absStatus +
//MCU
mcuStatus +
//动力电池加热状态
heatingStatus +
//动力电池当前状态
batteryStatus +
//动力电池保温状态
batteryInsulationStatus +
//DCDC
dcdcStatus +
//CHG
chgStatus;
}
public String getValue(String val , int valLength){
if(val == null){
val = "";
}
int length = val.length();
if (length > valLength){
return val.substring( 0 , valLength);
}
val = val + "0".repeat(valLength - length);
return val;
}
}

View File

@ -0,0 +1,51 @@
package com.couplet.msg.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/31 21:18
* @description
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TroubleLog {
/**
* Id
*/
private Integer troubleLogId;
/**
*
*/
private String troubleLogCode;
/**
* VIN
*/
private String troubleLogVin;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date troubleLogStartTime;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date troubleLogEndTime;
}

View File

@ -0,0 +1,28 @@
package com.couplet.msg;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/31 16:57
* @description
*/
public class Main {
public static void main(String[] args) {
String msgString = "VIN123456789DIJE41711764104506116.664380039.531990072.00031.3760000022000022000852000000D00809.600940000589066790930000203002030000044282.55000014000080700007440003000400095000058000054000011111111111111111";
//使用正则表达式匹配需要的部分
String pattern = "(.{17})(.{10})(.{4})(.{2})(.{2})";
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(msgString);
if (matcher.find()) {
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group "+ i + ":" + matcher.group(i));
}
}
}
}

View File

@ -0,0 +1,69 @@
package com.couplet.msg;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/30 11:39
* @description
*/
public class ParsingMsg {
private static final List<String> msgList = new ArrayList<>(){{
add("7E 56 49 4e 31 32 33 34 35 36 37 38 39 44 49 4a 45 34 31 37 31 31 37 36 34 31 30 34 35 30 36 31 31 36 2e 36 36 34 33 38 30 30 33 39 2e 35 33 31 39 39 30 30 37 32 2e 30 30 30 33 31 2e 33 37 36 30 30 30 30 30 32 32 30 30 30 30 32 32 30 30 30 38 35 32 30 30 30 30 30 30 44 30 30 38 30 39 2e 36 30 30 39 34 30 30 30 30 35 38 39 30 36 36 37 39 30 39 33 30 30 30 30 32 30 33 30 30 32 30 33 30 30 30 30 30 34 34 32 38 32 2e 35 35 30 30 30 30 31 34 30 30 30 30 38 30 37 30 30 30 30 37 34 34 30 30 30 33 30 30 30 34 30 30 30 39 35 30 30 30 30 35 38 30 30 30 30 35 34 30 30 30 30 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 24 7E");
}};
public static void main(String[] args) {
// 去头去尾
for (String string : msgList) {
String substring = string.substring(2, string.length() - 2);
System.out.println("去头去尾字符串:"+ substring);
String hexStringWithoutSpaces = substring.replaceAll("\\s+", "");
String asciiString = hexToString(hexStringWithoutSpaces);
System.out.println("16进制解析后的数据"+asciiString);
// //截取前17位
// String substring1 = asciiString.substring(0, 17);
// System.out.println("VIN"+substring1);
// String substring2 = asciiString.substring(17, 30);
// System.out.println("时间戳:"+substring2);
// String substring3 = asciiString.substring(30, 40);
// System.out.println("经度:" +substring3);
// String substring4 = asciiString.substring(41, 50);
// System.out.println("纬度:"+ substring4);
// String substring5 = asciiString.substring(51, 56);
// System.out.println("车速:"+ substring5);
// String substring6 = asciiString.substring(57, 67);
// System.out.println("总里程:"+ substring6);
// String substring7 = asciiString.substring(68, 73);
// System.out.println("总电压:"+ substring7);
String pattern = "(.{17})(.{10})(.{9})(.{8})(.{2})";
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(asciiString);
if (matcher.find()) {
for (int i = 1; i < matcher.groupCount(); i++) {
System.out.println("Group "+ i + ":" + matcher.group(i));
}
}
}
}
/**
* 16ASCII
* @param hexString 16
* @return ASCII
*/
public static String hexToString(String hexString) {
StringBuilder asciiString = new StringBuilder();
for (int i = 0; i < hexString.length(); i += 2) {
String hex = hexString.substring(i, i + 2);
int decimal = Integer.parseInt(hex, 16);
asciiString.append((char) decimal);
}
return asciiString.toString();
}
}

View File

@ -66,7 +66,7 @@ public class SysFirmController {
* @param deptId
* @return com.couplet.common.core.domain.Result
**/
@DeleteMapping("delFirm/{deptId}")
@PostMapping("delFirm/{deptId}")
public Result delFirm(@PathVariable Integer deptId){
int i = sysFirmService.delFirm(deptId);
Result<Integer> success = Result.success(i);

View File

@ -223,7 +223,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
* @return
*/
@Override
public int updateDept (SysDept dept) {
public int updateDept (SysDept dept) {
SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {

View File

@ -4,6 +4,8 @@ server:
# Spring
spring:
main:
allow-bean-definition-overriding: true
application:
# 应用名称
name: couplet-system

View File

@ -1,18 +1,19 @@
package com.couplet.trouble.controller;
import com.couplet.common.core.domain.PageResult;
import com.couplet.common.core.domain.Result;
import com.couplet.common.core.web.controller.BaseController;
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.TroubleUpdReq;
import com.couplet.trouble.domain.CoupletTroubleCode;
import com.couplet.trouble.domain.CoupletTroubleGrade;
import com.couplet.trouble.domain.CoupletTroubleType;
import com.couplet.trouble.domain.resp.TroubleResp;
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;
/**
@ -28,13 +29,28 @@ public class SysTroubleController extends BaseController {
private SysTroubleService troubleService;
/**
*
*
*/
@GetMapping("/troubleList")
public Result<TableDataInfo<coupletTroubleCode>> list(@RequestBody coupletTroubleCode trouble) {
startPage();
List<coupletTroubleCode> list = troubleService.selectTroubleList(trouble);
return getDataTable(list);
@PostMapping("/troubleList")
public Result<PageResult<CoupletTroubleCode>> list(@RequestBody TroubleResp troubleReq) {
PageResult<CoupletTroubleCode> result = troubleService.selectTroubleList(troubleReq);
return Result.success(result);
}
/**
*
*/
@GetMapping("/troubleTypeList")
public List<CoupletTroubleType> listType() {
return troubleService.selectTroubleListByType();
}
/**
*
*/
@GetMapping("/troubleGradeList")
public List<CoupletTroubleGrade> listGrade() {
return troubleService.selectTroubleListByGrade();
}
/**
@ -42,16 +58,16 @@ public class SysTroubleController extends BaseController {
*/
@Log(title = "新增故障码数据", businessType = BusinessType.INSERT)
@PostMapping("insertTrouble")
public Result<?> insert(@Validated @RequestBody coupletTroubleCode troubleAddReq) {
public Result<?> insert(@Validated @RequestBody CoupletTroubleCode troubleAddReq) {
return toAjax(troubleService.save(troubleAddReq));
}
/**
*
*
*/
@Log(title = "修改故障码数据",businessType = BusinessType.UPDATE)
@PostMapping("updateTrouble")
public Result<?> edit(@Validated @RequestBody coupletTroubleCode troubleUpdReq) {
public Result<?> edit(@Validated @RequestBody CoupletTroubleCode troubleUpdReq) {
return toAjax(troubleService.updateById(troubleUpdReq));
}
@ -60,7 +76,7 @@ public class SysTroubleController extends BaseController {
*/
@Log(title = "删除故障码",businessType = BusinessType.DELETE)
@GetMapping("/remove/{troubleId}")
public Result<?> remove(@PathVariable Long troubleId) {
public Result<?> remove(@PathVariable Integer troubleId) {
troubleService.removeById(troubleId);
return success();
}

View File

@ -3,7 +3,6 @@ package com.couplet.trouble.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.couplet.common.core.annotation.Excel;
import com.couplet.common.core.web.domain.BaseEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
@ -18,7 +17,7 @@ import lombok.experimental.SuperBuilder;
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class coupletTroubleCode {
public class CoupletTroubleCode {
/**
* id
*/
@ -53,10 +52,12 @@ public class coupletTroubleCode {
/**
* Id
*/
private Integer troubleTypeId;
@Excel(name = "故障类型Id")
private Integer typeId;
/**
* Id
*/
private Integer troubleGradeId;
@Excel(name = "故障等级Id")
private Integer gradeId;
}

View File

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

View File

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

View File

@ -0,0 +1,26 @@
package com.couplet.trouble.domain.resp;
import com.couplet.trouble.domain.CoupletTroubleCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/30 19:22
* @description
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class TroubleResp extends CoupletTroubleCode implements Serializable {
private Integer pageNum=1;
private Integer pageSize=5;
private String troubleCode;
private String troublePosition;
}

View File

@ -1,9 +1,10 @@
package com.couplet.trouble.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.couplet.trouble.domain.coupletTroubleCode;
import com.couplet.trouble.domain.req.TroubleAddReq;
import com.couplet.trouble.domain.req.TroubleUpdReq;
import com.couplet.trouble.domain.CoupletTroubleCode;
import com.couplet.trouble.domain.CoupletTroubleGrade;
import com.couplet.trouble.domain.CoupletTroubleType;
import com.couplet.trouble.domain.resp.TroubleResp;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -15,8 +16,12 @@ import java.util.List;
* @description
*/
@Mapper
public interface SysTroubleMapper extends BaseMapper<coupletTroubleCode> {
List<coupletTroubleCode> selectTroubleList(coupletTroubleCode trouble);
public interface SysTroubleMapper extends BaseMapper<CoupletTroubleCode> {
List<CoupletTroubleCode> selectTroubleList(TroubleResp troubleReq);
List<CoupletTroubleType> selectTroubleListByType();
List<CoupletTroubleGrade> selectTroubleListByGrade();
// int addTrouble(TroubleAddReq troubleAddReq);

View File

@ -1,9 +1,11 @@
package com.couplet.trouble.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.couplet.trouble.domain.coupletTroubleCode;
import com.couplet.trouble.domain.req.TroubleAddReq;
import com.couplet.trouble.domain.req.TroubleUpdReq;
import com.couplet.common.core.domain.PageResult;
import com.couplet.trouble.domain.CoupletTroubleCode;
import com.couplet.trouble.domain.CoupletTroubleGrade;
import com.couplet.trouble.domain.CoupletTroubleType;
import com.couplet.trouble.domain.resp.TroubleResp;
import java.util.List;
@ -13,8 +15,12 @@ import java.util.List;
* @date 2024/3/26 22:38
* @description
*/
public interface SysTroubleService extends IService<coupletTroubleCode> {
List<coupletTroubleCode> selectTroubleList(coupletTroubleCode trouble);
public interface SysTroubleService extends IService<CoupletTroubleCode> {
PageResult<CoupletTroubleCode> selectTroubleList(TroubleResp troubleReq);
List<CoupletTroubleType> selectTroubleListByType();
List<CoupletTroubleGrade> selectTroubleListByGrade();
// int addTrouble (TroubleAddReq troubleAddReq);

View File

@ -1,11 +1,15 @@
package com.couplet.trouble.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.couplet.trouble.domain.coupletTroubleCode;
import com.couplet.trouble.domain.req.TroubleAddReq;
import com.couplet.trouble.domain.req.TroubleUpdReq;
import com.couplet.common.core.domain.PageResult;
import com.couplet.trouble.domain.CoupletTroubleCode;
import com.couplet.trouble.domain.CoupletTroubleGrade;
import com.couplet.trouble.domain.CoupletTroubleType;
import com.couplet.trouble.domain.resp.TroubleResp;
import com.couplet.trouble.mapper.SysTroubleMapper;
import com.couplet.trouble.service.SysTroubleService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -18,19 +22,32 @@ import java.util.List;
* @description
*/
@Service
public class SysTroubleServiceImpl extends ServiceImpl<SysTroubleMapper, coupletTroubleCode> implements SysTroubleService{
public class SysTroubleServiceImpl extends ServiceImpl<SysTroubleMapper, CoupletTroubleCode> implements SysTroubleService{
@Autowired
private SysTroubleMapper sysTroubleMapper;
/**
*
* @param trouble
* @param troubleReq
* @return
*/
@Override
public List<coupletTroubleCode> selectTroubleList(coupletTroubleCode trouble) {
return sysTroubleMapper.selectTroubleList(trouble);
public PageResult<CoupletTroubleCode> selectTroubleList(TroubleResp troubleReq) {
PageHelper.startPage(troubleReq.getPageNum(), troubleReq.getPageSize());
List<CoupletTroubleCode> troubleList = sysTroubleMapper.selectTroubleList(troubleReq);
PageInfo<CoupletTroubleCode> info = new PageInfo<>(troubleList);
return PageResult.toPageResult(info.getTotal(),troubleList);
}
@Override
public List<CoupletTroubleType> selectTroubleListByType() {
return sysTroubleMapper.selectTroubleListByType();
}
@Override
public List<CoupletTroubleGrade> selectTroubleListByGrade() {
return sysTroubleMapper.selectTroubleListByGrade();
}
/**

View File

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

View File

@ -4,20 +4,20 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.couplet.trouble.mapper.SysTroubleMapper">
<resultMap type="com.couplet.trouble.domain.coupletTroubleCode" id="SysTroubleResult">
<resultMap type="com.couplet.trouble.domain.CoupletTroubleCode" id="SysTroubleResult">
<id property="troubleId" column="trouble_id"/>
<result property="troubleCode" column="trouble_code"/>
<result property="troubleGradeId" column="trouble_gradeId"/>
<result property="troubleValue" column="trouble_value"/>
<result property="troublePosition" column="trouble_position"/>
<result property="troubleTag" column="trouble_tag"/>
<result property="troubleTypeId" column="trouble_typeId"/>
<result property="troubleValue" column="trouble_value"/>
<result property="typeId" column="type_id"/>
<result property="gradeId" column="grade_id"/>
</resultMap>
<sql id="selectTroubleVo">
select t.*,g.grade_name,y.type_name from couplet_trouble_code t
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
LEFT JOIN couplet_trouble_grade g on t.grade_id = g.grade_id
LEFT JOIN couplet_trouble_type y on t.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)-->
@ -56,7 +56,12 @@
AND trouble_position like concat('%', #{troublePosition}, '%')
</if>
</where>
order by trouble_position desc
</select>
<select id="selectTroubleListByType" resultType="com.couplet.trouble.domain.CoupletTroubleType">
select * from couplet_trouble_type
</select>
<select id="selectTroubleListByGrade" resultType="com.couplet.trouble.domain.CoupletTroubleGrade">
select * from couplet_trouble_grade
</select>

View File

@ -18,6 +18,7 @@
<module>couplet-modules-vehicle</module>
<module>couplet-modules-mq</module>
<module>couplet-enterprisemanagement</module>
<module>couplet-msg</module>
</modules>
<artifactId>couplet-modules</artifactId>

View File

@ -15,11 +15,9 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
# 配置文件格式
file-extension: yml
# 共享配置

View File

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