用户上报记录
This commit is contained in:
parent
815e0907bf
commit
a47d23722e
@ -5,6 +5,7 @@ import com.cdzy.common.model.response.JsonResult;
|
||||
import com.ebike.feign.component.FeignTokenInterceptor;
|
||||
import com.ebike.feign.config.ExampleFeignConfiguration;
|
||||
import com.ebike.feign.model.dto.FeignEbikeDto;
|
||||
import com.ebike.feign.model.dto.FeignEbikeReportRecordDto;
|
||||
import com.ebike.feign.model.dto.FeignEbikeUserBikeInfo;
|
||||
import com.ebike.feign.model.dto.FeignEbikeUserLockDto;
|
||||
import com.ebike.feign.model.vo.EbikeLockVo;
|
||||
@ -87,12 +88,22 @@ public interface OperationsFeignClient {
|
||||
|
||||
/**
|
||||
* 保存车辆最新位置
|
||||
*
|
||||
* @param ecuSn 中控编号
|
||||
* @param longitude 经度
|
||||
* @param latitude 纬度
|
||||
* @return 保存结果
|
||||
*/
|
||||
@GetMapping("/ebikeBikeInfo//changeLocation")
|
||||
@GetMapping("/ebikeBikeInfo/changeLocation")
|
||||
JsonResult<?> changeLocation(@RequestParam("ecuSn") String ecuSn, @RequestParam("longitude") Double longitude, @RequestParam("latitude") Double latitude);
|
||||
|
||||
|
||||
/**
|
||||
* 保存用户上报
|
||||
*
|
||||
* @param feignEbikeReportRecordDto 用户上报信息
|
||||
*/
|
||||
@PostMapping("/ebikeReportRecord/saveReportRecord")
|
||||
JsonResult<?> saveReportRecord(@RequestBody FeignEbikeReportRecordDto feignEbikeReportRecordDto);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package com.ebike.feign.model.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.postgresql.geometric.PGpoint;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户上报请求参数
|
||||
*
|
||||
* @author yanglei
|
||||
* @since 2025-12-23 16:55
|
||||
*/
|
||||
@Data
|
||||
public class FeignEbikeReportRecordDto {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 上报位置
|
||||
*/
|
||||
@NotNull(message = "上报位置")
|
||||
private PGpoint location;
|
||||
|
||||
/**
|
||||
* 上报原因
|
||||
*/
|
||||
private String reportReason;
|
||||
|
||||
/**
|
||||
* 用户上报文件
|
||||
*/
|
||||
private List<FeignEbikeReportRecordFileDto> recordFiles;
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.ebike.feign.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户上报文件请求参数
|
||||
*
|
||||
* @author yanglei
|
||||
* @since 2025-11-18 11:26
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class FeignEbikeReportRecordFileDto {
|
||||
|
||||
/**
|
||||
* 用户上报文件主键id
|
||||
*/
|
||||
private Long recordFileId;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
private String fileUrl;
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.cdzy.operations.controller;
|
||||
|
||||
import com.cdzy.common.model.request.PageParam;
|
||||
import com.cdzy.common.model.response.JsonResult;
|
||||
import com.cdzy.operations.model.dto.EbikeDealReportDto;
|
||||
import com.cdzy.operations.model.dto.EbikeReportRecordDto;
|
||||
import com.cdzy.operations.model.entity.EbikeReportRecord;
|
||||
import com.cdzy.operations.service.EbikeReportRecordService;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cdzy.operations.model.entity.table.EbikeReportRecordTableDef.EBIKE_REPORT_RECORD;
|
||||
|
||||
/**
|
||||
* 用户上报记录 控制层
|
||||
*
|
||||
* @author yanglei
|
||||
* @since 2025-12-23 16:51
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/ebikeReportRecord")
|
||||
public class EbikeReportRecordController {
|
||||
|
||||
@Resource
|
||||
private EbikeReportRecordService reportRecordService;
|
||||
|
||||
/**
|
||||
* 保存用户上报记录【远程调用使用】
|
||||
*
|
||||
* @param reportRecordDto 用户上报记录参数
|
||||
*/
|
||||
@PostMapping("/saveReportRecord")
|
||||
public JsonResult<?> saveReportRecord(@RequestBody EbikeReportRecordDto reportRecordDto) {
|
||||
reportRecordService.saveReportRecord(reportRecordDto);
|
||||
return JsonResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理用户上报记录
|
||||
*
|
||||
* @param dealReportDto 处理用户上报记录请求参数
|
||||
*/
|
||||
@PostMapping("/dealReportRecord")
|
||||
public JsonResult<?> dealReportRecord(@RequestBody EbikeDealReportDto dealReportDto) {
|
||||
reportRecordService.dealReportRecord(dealReportDto);
|
||||
return JsonResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询用户上报记录
|
||||
*
|
||||
* @param pageParam 分页参数
|
||||
* @param recordStatus 处理状态
|
||||
*/
|
||||
@GetMapping("page")
|
||||
public JsonResult<?> page(PageParam pageParam, Integer recordStatus) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_REPORT_RECORD.RECORD_STATUS.like(recordStatus, Objects.nonNull(recordStatus)));
|
||||
Page<EbikeReportRecord> page = reportRecordService.page(pageParam.getPage(), queryWrapper);
|
||||
return JsonResult.success(page);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.cdzy.user.mapper;
|
||||
package com.cdzy.operations.mapper;
|
||||
|
||||
import com.cdzy.user.model.entity.EbikeReportRecordFile;
|
||||
import com.cdzy.operations.model.entity.EbikeReportRecordFile;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
|
||||
/**
|
||||
@ -1,6 +1,6 @@
|
||||
package com.cdzy.user.mapper;
|
||||
package com.cdzy.operations.mapper;
|
||||
|
||||
import com.cdzy.user.model.entity.EbikeReportRecord;
|
||||
import com.cdzy.operations.model.entity.EbikeReportRecord;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
|
||||
/**
|
||||
@ -0,0 +1,38 @@
|
||||
package com.cdzy.operations.model.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户上报处理请求参数
|
||||
*
|
||||
* @author yanglei
|
||||
* @since 2025-12-24 10:46
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class EbikeDealReportDto {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空")
|
||||
private Long recordId;
|
||||
|
||||
/**
|
||||
* 处理人id
|
||||
*/
|
||||
@NotNull(message = "员工id不能为空")
|
||||
private Long staffId;
|
||||
|
||||
/**
|
||||
* 处理人意见
|
||||
*/
|
||||
private String recordReason;
|
||||
|
||||
/**
|
||||
* 处理状态 1-同意申请 2-拒绝申请
|
||||
*/
|
||||
@NotNull(message = "处理状态不能为空")
|
||||
private Integer recordStatus;
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
package com.cdzy.user.model.dto;
|
||||
package com.cdzy.operations.model.dto;
|
||||
|
||||
import com.cdzy.user.handler.PGpointDeserializer;
|
||||
import com.cdzy.user.handler.PGpointSerializer;
|
||||
import com.cdzy.user.handler.PGpointTypeHandler;
|
||||
import com.cdzy.operations.handler.PGpointDeserializer;
|
||||
import com.cdzy.operations.handler.PGpointSerializer;
|
||||
import com.cdzy.operations.handler.PGpointTypeHandler;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
@ -36,6 +36,11 @@ public class EbikeReportRecordDto {
|
||||
@NotNull(message = "上报位置")
|
||||
private PGpoint location;
|
||||
|
||||
/**
|
||||
* 上报原因
|
||||
*/
|
||||
private String reportReason;
|
||||
|
||||
/**
|
||||
* 用户上报文件
|
||||
*/
|
||||
@ -1,4 +1,4 @@
|
||||
package com.cdzy.user.model.dto;
|
||||
package com.cdzy.operations.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.cdzy.user.model.entity;
|
||||
package com.cdzy.operations.model.entity;
|
||||
|
||||
import com.cdzy.user.handler.PGpointDeserializer;
|
||||
import com.cdzy.user.handler.PGpointSerializer;
|
||||
import com.cdzy.user.handler.PGpointTypeHandler;
|
||||
import com.cdzy.operations.handler.PGpointDeserializer;
|
||||
import com.cdzy.operations.handler.PGpointSerializer;
|
||||
import com.cdzy.operations.handler.PGpointTypeHandler;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
@ -48,7 +48,27 @@ public class EbikeReportRecord implements Serializable {
|
||||
private PGpoint location;
|
||||
|
||||
/**
|
||||
* 处理状态 0-未处理 1-已处理
|
||||
* 上报原因
|
||||
*/
|
||||
private String reportReason;
|
||||
|
||||
/**
|
||||
* 处理人id
|
||||
*/
|
||||
private Long staffId;
|
||||
|
||||
/**
|
||||
* 处理人意见
|
||||
*/
|
||||
private String recordReason;
|
||||
|
||||
/**
|
||||
* 处理时间
|
||||
*/
|
||||
private LocalDateTime recordTime;
|
||||
|
||||
/**
|
||||
* 处理状态 0-待处理 1-同意申请 2-拒绝申请
|
||||
*/
|
||||
private Integer recordStatus;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.cdzy.user.model.entity;
|
||||
package com.cdzy.operations.model.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
@ -0,0 +1,28 @@
|
||||
package com.cdzy.operations.service;
|
||||
|
||||
import com.cdzy.operations.model.dto.EbikeDealReportDto;
|
||||
import com.cdzy.operations.model.dto.EbikeReportRecordDto;
|
||||
import com.cdzy.operations.model.entity.EbikeReportRecord;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
/**
|
||||
* @author yanglei
|
||||
* @since 2025-12-23 16:53
|
||||
*/
|
||||
|
||||
public interface EbikeReportRecordService extends IService<EbikeReportRecord> {
|
||||
|
||||
/**
|
||||
* 保存用户上报记录
|
||||
*
|
||||
* @param reportRecordDto 保存用户上报记录请求参数
|
||||
*/
|
||||
void saveReportRecord(EbikeReportRecordDto reportRecordDto);
|
||||
|
||||
/**
|
||||
* 处理用户上报记录
|
||||
*
|
||||
* @param dealReportDto 处理用户上报记录请求参数
|
||||
*/
|
||||
void dealReportRecord(EbikeDealReportDto dealReportDto);
|
||||
}
|
||||
@ -1,24 +1,27 @@
|
||||
package com.cdzy.user.service.impl;
|
||||
package com.cdzy.operations.service.impl;
|
||||
|
||||
import com.cdzy.common.enums.GlobalConstants;
|
||||
import com.cdzy.user.mapper.EbikeReportRecordFileMapper;
|
||||
import com.cdzy.user.mapper.EbikeReportRecordMapper;
|
||||
import com.cdzy.user.model.dto.EbikeFaultFileDto;
|
||||
import com.cdzy.user.model.dto.EbikeReportRecordDto;
|
||||
import com.cdzy.user.model.dto.EbikeReportRecordFileDto;
|
||||
import com.cdzy.user.model.entity.EbikeFaultFile;
|
||||
import com.cdzy.user.model.entity.EbikeReportRecord;
|
||||
import com.cdzy.user.model.entity.EbikeReportRecordFile;
|
||||
import com.cdzy.user.service.EbikeReportRecordService;
|
||||
import com.cdzy.operations.mapper.EbikeReportRecordFileMapper;
|
||||
import com.cdzy.operations.mapper.EbikeReportRecordMapper;
|
||||
import com.cdzy.operations.model.dto.EbikeDealReportDto;
|
||||
import com.cdzy.operations.model.dto.EbikeReportRecordDto;
|
||||
import com.cdzy.operations.model.dto.EbikeReportRecordFileDto;
|
||||
import com.cdzy.operations.model.entity.EbikeReportRecord;
|
||||
import com.cdzy.operations.model.entity.EbikeReportRecordFile;
|
||||
import com.cdzy.operations.service.EbikeReportRecordService;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cdzy.operations.model.entity.table.EbikeReportRecordTableDef.EBIKE_REPORT_RECORD;
|
||||
|
||||
/**
|
||||
* @author yanglei
|
||||
* @since 2025-12-23 16:53
|
||||
@ -35,6 +38,7 @@ public class EbikeReportRecordServiceImpl extends ServiceImpl<EbikeReportRecordM
|
||||
EbikeReportRecord ebikeReportRecord = EbikeReportRecord.builder()
|
||||
.location(reportRecordDto.getLocation())
|
||||
.recordStatus(GlobalConstants.NUMBER_ZERO)
|
||||
.reportReason(reportRecordDto.getReportReason())
|
||||
.createBy(reportRecordDto.getUserId())
|
||||
.build();
|
||||
this.save(ebikeReportRecord);
|
||||
@ -52,4 +56,18 @@ public class EbikeReportRecordServiceImpl extends ServiceImpl<EbikeReportRecordM
|
||||
reportRecordFileMapper.insertBatch(fileEntities);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void dealReportRecord(EbikeDealReportDto dealReportDto) {
|
||||
Long recordId = dealReportDto.getRecordId();
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_REPORT_RECORD.RECORD_ID.eq(recordId));
|
||||
EbikeReportRecord reportRecord = this.mapper.selectOneByQuery(queryWrapper);
|
||||
reportRecord.setStaffId(dealReportDto.getStaffId());
|
||||
reportRecord.setRecordReason(dealReportDto.getRecordReason());
|
||||
reportRecord.setRecordTime(LocalDateTime.now());
|
||||
reportRecord.setRecordStatus(dealReportDto.getRecordStatus());
|
||||
this.mapper.update(reportRecord);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.cdzy.user.controller;
|
||||
|
||||
import com.cdzy.common.enums.Code;
|
||||
import com.cdzy.common.ex.EbikeException;
|
||||
import com.cdzy.common.model.response.JsonResult;
|
||||
import com.ebike.feign.clients.OperationsFeignClient;
|
||||
import com.ebike.feign.model.dto.FeignEbikeReportRecordDto;
|
||||
import jakarta.annotation.Resource;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 用户上报 控制层
|
||||
*
|
||||
* @author yanglei
|
||||
* @since 2025-12-24 11:32
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ebikeReport")
|
||||
public class EbikeReportController {
|
||||
|
||||
@Resource
|
||||
private OperationsFeignClient operationsFeignClient;
|
||||
|
||||
/**
|
||||
* 保存用户上报信息
|
||||
*
|
||||
* @param feignEbikeReportRecordDto 用户上报信息
|
||||
*/
|
||||
@PostMapping("/saveReport")
|
||||
public JsonResult<?> saveReport(@RequestBody FeignEbikeReportRecordDto feignEbikeReportRecordDto) {
|
||||
JsonResult<?> jsonResult = operationsFeignClient.saveReportRecord(feignEbikeReportRecordDto);
|
||||
if (jsonResult.getCode() != Code.SUCCESS) {
|
||||
throw new EbikeException("保存用户上报信息失败!");
|
||||
}
|
||||
return JsonResult.success();
|
||||
}
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
package com.cdzy.user.controller;
|
||||
|
||||
import com.cdzy.common.model.response.JsonResult;
|
||||
import com.cdzy.user.model.dto.EbikeReportRecordDto;
|
||||
import com.cdzy.user.service.EbikeReportRecordService;
|
||||
import jakarta.annotation.Resource;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 用户上报记录 控制层
|
||||
*
|
||||
* @author yanglei
|
||||
* @since 2025-12-23 16:51
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/ebikeReportRecord")
|
||||
public class EbikeReportRecordController {
|
||||
|
||||
@Resource
|
||||
private EbikeReportRecordService reportRecordService;
|
||||
|
||||
/**
|
||||
* 保存用户上报记录
|
||||
*
|
||||
* @param reportRecordDto 用户上报记录参数
|
||||
*/
|
||||
@PostMapping("/saveReportRecord")
|
||||
public JsonResult<?> saveReportRecord(@RequestBody EbikeReportRecordDto reportRecordDto) {
|
||||
reportRecordService.saveReportRecord(reportRecordDto);
|
||||
return JsonResult.success();
|
||||
}
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package com.cdzy.user.service;
|
||||
|
||||
import com.cdzy.user.model.dto.EbikeReportRecordDto;
|
||||
import com.cdzy.user.model.entity.EbikeReportRecord;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
/**
|
||||
* @author yanglei
|
||||
* @since 2025-12-23 16:53
|
||||
*/
|
||||
|
||||
public interface EbikeReportRecordService extends IService<EbikeReportRecord> {
|
||||
|
||||
void saveReportRecord(EbikeReportRecordDto reportRecordDto);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user