Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
|
8e24a11fb1 |
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 106.54.193.225:8848
|
||||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: one
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 106.54.193.225:8848
|
||||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: one
|
||||
|
|
|
@ -21,6 +21,16 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||
<version>1.4.11</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
package com.muyu.breakdown.DTO;
|
||||
|
||||
|
||||
import com.muyu.breakdown.domain.Messages;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-18-15:00
|
||||
* @ Version:1.0
|
||||
* @ Description:数据库连接层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Component
|
||||
public class MessageDTO {
|
||||
private static final String DB_URL = "jdbc:mysql://106.54.193.225:3306/one";
|
||||
private static final String USER = "root";
|
||||
private static final String PASSWORD = "bawei2112A";
|
||||
|
||||
// 2. 建立数据库连接
|
||||
Connection connection;
|
||||
// 构造函数,初始化数据库连接
|
||||
// 保存消息到数据库
|
||||
public void saveMessage(Messages message) {
|
||||
String sql = "INSERT INTO sys_messages (sender_id, receiver_id, content) VALUES (?, ?, ?)";
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
connection = DriverManager.getConnection(DB_URL, USER, PASSWORD);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
|
||||
preparedStatement.setInt(1, message.getSenderId());
|
||||
preparedStatement.setInt(2, message.getReceiverId());
|
||||
preparedStatement.setString(3, message.getContent());
|
||||
// 执行添加操作
|
||||
preparedStatement.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
connection.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取所有消息
|
||||
public List<Messages> getAllMessages(int receiverId){
|
||||
String sql = "SELECT * FROM sys_messages WHERE receiver_id = ?";
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
List<Messages> messages = new ArrayList<>();
|
||||
try {
|
||||
connection = DriverManager.getConnection(DB_URL, USER, PASSWORD);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
|
||||
preparedStatement.setInt(1, receiverId);
|
||||
// 执行查询操作
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
while (rs.next()) {
|
||||
Messages message = new Messages(rs.getInt("sender_id"), receiverId, rs.getString("content"));
|
||||
|
||||
// 添加到消息列表
|
||||
messages.add(message);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
connection.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 返回消息列表
|
||||
return messages;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,11 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @author Lenovo
|
||||
|
@ -21,9 +18,6 @@ import lombok.experimental.SuperBuilder;
|
|||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("sys_car_fault")
|
||||
public class BreakDown extends BaseEntity {
|
||||
|
||||
|
@ -46,6 +40,11 @@ public class BreakDown extends BaseEntity {
|
|||
*/
|
||||
@Excel(name = "故障类型")
|
||||
private String faultType;
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
@Excel(name = "车辆VIN")
|
||||
private String carVin;
|
||||
/**
|
||||
* 故障标签
|
||||
*/
|
||||
|
@ -71,4 +70,14 @@ public class BreakDown extends BaseEntity {
|
|||
*/
|
||||
@Excel(name = "报警状态")
|
||||
private String faultStatus;
|
||||
/**
|
||||
* 故障描述信息
|
||||
*/
|
||||
@Excel(name = "故障描述信息")
|
||||
private String faultDesc;
|
||||
/**
|
||||
* 启用状态(1.待处理 2.处理中 3.已处理 4.忽略)
|
||||
*/
|
||||
@Excel(name = "启用状态")
|
||||
private String state;
|
||||
}
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
package com.muyu.breakdown.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
||||
/**
|
||||
* 故障日志对象 fault_log
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-09-20
|
||||
*/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Setter
|
||||
@Getter
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("fault_log")
|
||||
public class FaultLog extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
@TableId( type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 故障码 */
|
||||
@Excel(name = "故障码")
|
||||
private String faultCode;
|
||||
|
||||
/** 车辆VIN */
|
||||
@Excel(name = "车辆VIN")
|
||||
private String carVin;
|
||||
|
||||
/** 开始报警时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开始报警时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date startTime;
|
||||
|
||||
/** 结束报警时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "结束报警时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("faultCode", getFaultCode())
|
||||
.append("carVin", getCarVin())
|
||||
.append("startTime", getStartTime())
|
||||
.append("endTime", getEndTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package com.muyu.breakdown.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-18-14:51
|
||||
* @ Version:1.0
|
||||
* @ Description:站内信实体类
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("sys_messages")
|
||||
public class Messages {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Excel(name = "消息ID")
|
||||
private Long id;
|
||||
@Excel(name = "发送者ID")
|
||||
private Integer senderId;
|
||||
@Excel(name = "接收者ID")
|
||||
private Integer receiverId;
|
||||
@Excel(name = "消息内容")
|
||||
private String content;
|
||||
@Excel(name = "发送时间")
|
||||
private Date createTime;
|
||||
@Excel(name = "消息状态")
|
||||
private String status;
|
||||
|
||||
public Messages(int senderId, int receiverId, String content) {
|
||||
this.senderId = senderId;
|
||||
this.receiverId = receiverId;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Messages(Integer senderId, Integer receiverId, String content, Date createTime) {
|
||||
this.senderId = senderId;
|
||||
this.receiverId = receiverId;
|
||||
this.content = content;
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
|
@ -15,23 +15,23 @@ import org.springframework.context.annotation.Configuration;
|
|||
* @ Description:mybatisplus配置类
|
||||
* @author Lenovo
|
||||
*/
|
||||
//@Configuration
|
||||
//public class MybatisPlusConfig {
|
||||
// /**
|
||||
// * 添加分页插件
|
||||
// */
|
||||
// @Bean
|
||||
// public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
// MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
// // 如果配置多个插件, 切记分页最后添加
|
||||
// interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
// // 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
|
||||
// return interceptor;
|
||||
// }
|
||||
// @Bean
|
||||
// public MybatisConfiguration mybatisConfiguration(){
|
||||
// MybatisConfiguration configuration = new MybatisConfiguration();
|
||||
// return configuration;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
/**
|
||||
* 添加分页插件
|
||||
*/
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
// 如果配置多个插件, 切记分页最后添加
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
// 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
|
||||
return interceptor;
|
||||
}
|
||||
@Bean
|
||||
public MybatisConfiguration mybatisConfiguration(){
|
||||
MybatisConfiguration configuration = new MybatisConfiguration();
|
||||
return configuration;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
package com.muyu.breakdown.controller;
|
||||
|
||||
import com.muyu.breakdown.domain.BreakDown;
|
||||
import com.muyu.breakdown.service.BreakDownService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
|
@ -30,80 +20,6 @@ public class BreakDownController extends BaseController {
|
|||
|
||||
@Autowired
|
||||
private BreakDownService breakDownService;
|
||||
/**
|
||||
* 查询车辆故障列表
|
||||
*/
|
||||
@RequiresPermissions("breakdown:breakdown:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<BreakDown>> list(BreakDown breakDown)
|
||||
{
|
||||
startPage();
|
||||
List<BreakDown> list = breakDownService.selectBreakDownList(breakDown);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出车辆故障列表
|
||||
*/
|
||||
@RequiresPermissions("breakdown:breakdown:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BreakDown breakDown)
|
||||
{
|
||||
List<BreakDown> list = breakDownService.selectBreakDownList(breakDown);
|
||||
ExcelUtil<BreakDown> util = new ExcelUtil<BreakDown>(BreakDown.class);
|
||||
util.exportExcel(response, list, "车辆故障数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车辆故障详细信息
|
||||
*/
|
||||
@RequiresPermissions("breakdown:breakdown:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<List<BreakDown>> getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(breakDownService.selectBreakDownById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车辆故障
|
||||
*/
|
||||
@RequiresPermissions("breakdown:breakdown:add")
|
||||
@PostMapping
|
||||
public Result<Integer> add(
|
||||
@Validated @RequestBody BreakDown breakDown)
|
||||
{
|
||||
if (breakDownService.checkIdUnique(breakDown)) {
|
||||
return error("新增 车辆故障 '" + breakDown + "'失败,车辆故障已存在");
|
||||
}
|
||||
breakDown.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(breakDownService.save(breakDown));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆故障
|
||||
*/
|
||||
@RequiresPermissions("breakdown:breakdown:edit")
|
||||
@PutMapping
|
||||
public Result<Integer> edit(
|
||||
@Validated @RequestBody BreakDown breakDown)
|
||||
{
|
||||
if (!breakDownService.checkIdUnique(breakDown)) {
|
||||
return error("修改 车辆故障 '" + breakDown + "'失败,车辆故障不存在");
|
||||
}
|
||||
breakDown.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(breakDownService.updateById(breakDown));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆故障
|
||||
*/
|
||||
@RequiresPermissions("breakdown:breakdown:remove")
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||
{
|
||||
breakDownService.removeBatchByIds(Arrays.asList(ids));
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
package com.muyu.breakdown.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.breakdown.domain.FaultLog;
|
||||
import com.muyu.breakdown.service.IFaultLogService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 故障日志Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-09-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/log")
|
||||
public class FaultLogController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IFaultLogService faultLogService;
|
||||
|
||||
/**
|
||||
* 查询故障日志列表
|
||||
*/
|
||||
@RequiresPermissions("platform:log:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<FaultLog>> list(FaultLog faultLog)
|
||||
{
|
||||
startPage();
|
||||
List<FaultLog> list = faultLogService.selectFaultLogList(faultLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出故障日志列表
|
||||
*/
|
||||
@RequiresPermissions("platform:log:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, FaultLog faultLog)
|
||||
{
|
||||
List<FaultLog> list = faultLogService.selectFaultLogList(faultLog);
|
||||
ExcelUtil<FaultLog> util = new ExcelUtil<FaultLog>(FaultLog.class);
|
||||
util.exportExcel(response, list, "故障日志数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取故障日志详细信息
|
||||
*/
|
||||
@RequiresPermissions("platform:log:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<List<FaultLog>> getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(faultLogService.selectFaultLogById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增故障日志
|
||||
*/
|
||||
@RequiresPermissions("platform:log:add")
|
||||
@PostMapping
|
||||
public Result<Integer> add(
|
||||
@Validated @RequestBody FaultLog faultLog)
|
||||
{
|
||||
if (faultLogService.checkIdUnique(faultLog)) {
|
||||
return error("新增 故障日志 '" + faultLog + "'失败,故障日志已存在");
|
||||
}
|
||||
faultLog.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(faultLogService.save(faultLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改故障日志
|
||||
*/
|
||||
@RequiresPermissions("platform:log:edit")
|
||||
@PutMapping
|
||||
public Result<Integer> edit(
|
||||
@Validated @RequestBody FaultLog faultLog)
|
||||
{
|
||||
if (!faultLogService.checkIdUnique(faultLog)) {
|
||||
return error("修改 故障日志 '" + faultLog + "'失败,故障日志不存在");
|
||||
}
|
||||
faultLog.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(faultLogService.updateById(faultLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除故障日志
|
||||
*/
|
||||
@RequiresPermissions("platform:log:remove")
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||
{
|
||||
faultLogService.removeBatchByIds(Arrays.asList(ids));
|
||||
return success();
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package com.muyu.breakdown.controller;
|
||||
|
||||
import com.muyu.breakdown.domain.Messages;
|
||||
import com.muyu.breakdown.service.BreakDownService;
|
||||
import com.muyu.breakdown.service.StationMessageService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-18-12:01
|
||||
* @ Version:1.0
|
||||
* @ Description:站内信控制层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/stationMessage")
|
||||
public class StationMessageController extends BaseController {
|
||||
@Autowired
|
||||
private StationMessageService stationMessageService;
|
||||
@PostMapping("/send")
|
||||
public void sendMessage(@RequestBody Messages messages) {
|
||||
stationMessageService.sendMessage(messages.getSenderId(), messages.getReceiverId(), messages.getContent());
|
||||
}
|
||||
|
||||
@GetMapping("/{userId}")
|
||||
public List<Messages> getMessages(@PathVariable("userId") int userId) {
|
||||
return stationMessageService.getUserMessages(userId);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.muyu.breakdown.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.breakdown.domain.FaultLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 故障日志Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-09-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface FaultLogMapper extends BaseMapper<FaultLog>{
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package com.muyu.breakdown.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.muyu.breakdown.domain.Messages;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-18-14:57
|
||||
* @ Version:1.0
|
||||
* @ Description:站内信持久层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Mapper
|
||||
public interface StationMessageMapper extends MPJBaseMapper<Messages> {
|
||||
}
|
|
@ -3,8 +3,6 @@ package com.muyu.breakdown.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.breakdown.domain.BreakDown;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
|
@ -14,27 +12,4 @@ import java.util.List;
|
|||
* @author Lenovo
|
||||
*/
|
||||
public interface BreakDownService extends IService<BreakDown> {
|
||||
/**
|
||||
* 精确查询车辆故障
|
||||
*
|
||||
* @param id 车辆故障主键
|
||||
* @return 车辆故障
|
||||
*/
|
||||
public BreakDown selectBreakDownById(Long id);
|
||||
|
||||
/**
|
||||
* 查询车辆故障列表
|
||||
*
|
||||
* @param breakDown 车辆故障
|
||||
* @return 车辆故障集合
|
||||
*/
|
||||
public List<BreakDown> selectBreakDownList(BreakDown breakDown);
|
||||
|
||||
/**
|
||||
* 判断 车辆故障 id是否唯一
|
||||
* @param breakDown 车辆故障
|
||||
* @return 结果
|
||||
*/
|
||||
Boolean checkIdUnique(BreakDown breakDown);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
package com.muyu.breakdown.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.breakdown.domain.FaultLog;
|
||||
|
||||
/**
|
||||
* 故障日志Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-09-20
|
||||
*/
|
||||
public interface IFaultLogService extends IService<FaultLog> {
|
||||
/**
|
||||
* 精确查询故障日志
|
||||
*
|
||||
* @param id 故障日志主键
|
||||
* @return 故障日志
|
||||
*/
|
||||
public FaultLog selectFaultLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询故障日志列表
|
||||
*
|
||||
* @param faultLog 故障日志
|
||||
* @return 故障日志集合
|
||||
*/
|
||||
public List<FaultLog> selectFaultLogList(FaultLog faultLog);
|
||||
|
||||
/**
|
||||
* 判断 故障日志 id是否唯一
|
||||
* @param faultLog 故障日志
|
||||
* @return 结果
|
||||
*/
|
||||
Boolean checkIdUnique(FaultLog faultLog);
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package com.muyu.breakdown.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.breakdown.domain.Messages;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-18-14:56
|
||||
* @ Version:1.0
|
||||
* @ Description:
|
||||
* @author Lenovo
|
||||
*/
|
||||
public interface StationMessageService extends IService<Messages> {
|
||||
void sendMessage(Integer senderId, Integer receiverId, String content);
|
||||
|
||||
List<Messages> getUserMessages(int userId);
|
||||
}
|
|
@ -1,16 +1,11 @@
|
|||
package com.muyu.breakdown.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.breakdown.domain.BreakDown;
|
||||
import com.muyu.breakdown.mapper.BreakDownMapper;
|
||||
import com.muyu.breakdown.service.BreakDownService;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
|
@ -21,52 +16,4 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
public class BreakDownServiceImpl extends ServiceImpl<BreakDownMapper, BreakDown> implements BreakDownService {
|
||||
/**
|
||||
* 精确查询车辆故障
|
||||
*
|
||||
* @param id 车辆故障主键
|
||||
* @return 车辆故障
|
||||
*/
|
||||
@Override
|
||||
public BreakDown selectBreakDownById(Long id)
|
||||
{
|
||||
LambdaQueryWrapper<BreakDown> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Assert.notNull(id, "id不可为空");
|
||||
queryWrapper.eq(BreakDown::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆故障列表
|
||||
*
|
||||
* @param breakDown 车辆故障
|
||||
* @return 车辆故障
|
||||
*/
|
||||
@Override
|
||||
public List<BreakDown> selectBreakDownList(BreakDown breakDown)
|
||||
{
|
||||
LambdaQueryWrapper<BreakDown> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(breakDown.getFaultCode())){
|
||||
queryWrapper.eq(BreakDown::getFaultCode, breakDown.getFaultCode());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(breakDown.getFaultType())){
|
||||
queryWrapper.eq(BreakDown::getFaultType, breakDown.getFaultType());
|
||||
}
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 唯一 判断
|
||||
* @param breakDown 车辆故障
|
||||
* @return 车辆故障
|
||||
*/
|
||||
@Override
|
||||
public Boolean checkIdUnique(BreakDown breakDown) {
|
||||
LambdaQueryWrapper<BreakDown> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BreakDown::getId, breakDown.getId());
|
||||
return this.count(queryWrapper) > 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
package com.muyu.breakdown.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.breakdown.domain.FaultLog;
|
||||
import com.muyu.breakdown.mapper.FaultLogMapper;
|
||||
import com.muyu.breakdown.service.IFaultLogService;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 故障日志Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-09-20
|
||||
*/
|
||||
@Service
|
||||
public class FaultLogServiceImpl
|
||||
extends ServiceImpl<FaultLogMapper, FaultLog>
|
||||
implements IFaultLogService {
|
||||
|
||||
/**
|
||||
* 精确查询故障日志
|
||||
*
|
||||
* @param id 故障日志主键
|
||||
* @return 故障日志
|
||||
*/
|
||||
@Override
|
||||
public FaultLog selectFaultLogById(Long id)
|
||||
{
|
||||
LambdaQueryWrapper<FaultLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Assert.notNull(id, "id不可为空");
|
||||
queryWrapper.eq(FaultLog::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询故障日志列表
|
||||
*
|
||||
* @param faultLog 故障日志
|
||||
* @return 故障日志
|
||||
*/
|
||||
@Override
|
||||
public List<FaultLog> selectFaultLogList(FaultLog faultLog)
|
||||
{
|
||||
LambdaQueryWrapper<FaultLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(faultLog.getFaultCode())){
|
||||
queryWrapper.eq(FaultLog::getFaultCode, faultLog.getFaultCode());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(faultLog.getCarVin())){
|
||||
queryWrapper.eq(FaultLog::getCarVin, faultLog.getCarVin());
|
||||
}
|
||||
if (faultLog.getStartTime()!=null){
|
||||
queryWrapper.eq(FaultLog::getStartTime, faultLog.getStartTime());
|
||||
}
|
||||
if (faultLog.getEndTime()!=null){
|
||||
queryWrapper.eq(FaultLog::getEndTime, faultLog.getEndTime());
|
||||
}
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 唯一 判断
|
||||
* @param faultLog 故障日志
|
||||
* @return 故障日志
|
||||
*/
|
||||
@Override
|
||||
public Boolean checkIdUnique(FaultLog faultLog) {
|
||||
LambdaQueryWrapper<FaultLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(FaultLog::getId, faultLog.getId());
|
||||
return this.count(queryWrapper) > 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package com.muyu.breakdown.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.breakdown.DTO.MessageDTO;
|
||||
import com.muyu.breakdown.domain.Messages;
|
||||
import com.muyu.breakdown.mapper.StationMessageMapper;
|
||||
import com.muyu.breakdown.service.StationMessageService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-18-14:56
|
||||
* @ Version:1.0
|
||||
* @ Description:站内信业务实现层
|
||||
* @author Lenovo
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class StationMessageServiceImpl
|
||||
extends ServiceImpl<StationMessageMapper, Messages>
|
||||
implements StationMessageService {
|
||||
@Autowired
|
||||
private MessageDTO messageDTO;
|
||||
|
||||
@Override
|
||||
public void sendMessage(Integer senderId, Integer receiverId, String content) {
|
||||
Messages message = new Messages(senderId, receiverId, content);
|
||||
// 保存消息到数据库
|
||||
messageDTO.saveMessage(message);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Messages> getUserMessages(int userId) {
|
||||
// 获取用户收到的消息
|
||||
return messageDTO.getAllMessages(userId);
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9702
|
||||
port: 9701
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 106.54.193.225:8848
|
||||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: one
|
||||
|
@ -57,4 +57,4 @@ spring:
|
|||
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.breakdown.mapper: DEBUG
|
||||
com.muyu.system.mapper: DEBUG
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 106.54.193.225:8848
|
||||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: one
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 106.54.193.225:8848
|
||||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: one
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 106.54.193.225:8848
|
||||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: one
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 106.54.193.225:8848
|
||||
addr: 47.116.173.119:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: one
|
||||
|
|
Loading…
Reference in New Issue