用户故障上报文件表名更改
This commit is contained in:
parent
7b14214941
commit
b7118a50b2
@ -6,7 +6,7 @@ import com.cdzy.user.model.dto.EbikeFaultReportDto;
|
|||||||
import com.cdzy.user.model.dto.EbikeFaultReportQueryDto;
|
import com.cdzy.user.model.dto.EbikeFaultReportQueryDto;
|
||||||
import com.cdzy.user.model.dto.EbikeOrderFaultReportDto;
|
import com.cdzy.user.model.dto.EbikeOrderFaultReportDto;
|
||||||
import com.cdzy.user.model.entity.EbikeFaultReport;
|
import com.cdzy.user.model.entity.EbikeFaultReport;
|
||||||
import com.cdzy.user.model.vo.EbikeAttachmentFileVo;
|
import com.cdzy.user.model.vo.EbikeFaultFileVo;
|
||||||
import com.cdzy.user.model.vo.EbikeFaultReportVo;
|
import com.cdzy.user.model.vo.EbikeFaultReportVo;
|
||||||
import com.cdzy.user.model.vo.EbikeOrderFaultReportVo;
|
import com.cdzy.user.model.vo.EbikeOrderFaultReportVo;
|
||||||
import com.cdzy.user.service.EbikeFaultReportService;
|
import com.cdzy.user.service.EbikeFaultReportService;
|
||||||
@ -42,7 +42,7 @@ public class EbikeFaultReportController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("uploadFile")
|
@PostMapping("uploadFile")
|
||||||
public JsonResult<?> uploadFile(@RequestParam("multipartFile") MultipartFile multipartFile) {
|
public JsonResult<?> uploadFile(@RequestParam("multipartFile") MultipartFile multipartFile) {
|
||||||
EbikeAttachmentFileVo ebikeAttachmentFileVo = ebikeFaultReportService.uploadFile(multipartFile);
|
EbikeFaultFileVo ebikeAttachmentFileVo = ebikeFaultReportService.uploadFile(multipartFile);
|
||||||
return JsonResult.success(ebikeAttachmentFileVo);
|
return JsonResult.success(ebikeAttachmentFileVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -129,7 +129,7 @@ public class EbikeRefundController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("uploadFile")
|
@PostMapping("uploadFile")
|
||||||
public JsonResult<?> uploadFile(@RequestParam("multipartFile") MultipartFile multipartFile) {
|
public JsonResult<?> uploadFile(@RequestParam("multipartFile") MultipartFile multipartFile) {
|
||||||
EbikeAttachmentFileVo ebikeAttachmentFileVo = ebikeRefundService.uploadFile(multipartFile);
|
EbikeFaultFileVo ebikeAttachmentFileVo = ebikeRefundService.uploadFile(multipartFile);
|
||||||
return JsonResult.success(ebikeAttachmentFileVo);
|
return JsonResult.success(ebikeAttachmentFileVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.cdzy.user.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户故障上报处理状态
|
||||||
|
*
|
||||||
|
* @author yanglei
|
||||||
|
* @since 2025-11-26 10:23
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface EbikeFaultReportStatus {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待处理
|
||||||
|
*/
|
||||||
|
int PENDING = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理中
|
||||||
|
*/
|
||||||
|
int PROCESSING = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理完成
|
||||||
|
*/
|
||||||
|
int PROCESS_COMPLETED = 2;
|
||||||
|
}
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package com.cdzy.user.enums;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author yanglei
|
|
||||||
* @since 2025-10-27 17:03
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface EbikeRegionInOperation {
|
|
||||||
|
|
||||||
String IN = "1";
|
|
||||||
|
|
||||||
String OUT = "0";
|
|
||||||
}
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
package com.cdzy.user.mapper;
|
package com.cdzy.user.mapper;
|
||||||
|
|
||||||
import com.cdzy.user.model.entity.EbikeAttachmentFile;
|
import com.cdzy.user.model.entity.EbikeFaultFile;
|
||||||
import com.mybatisflex.core.BaseMapper;
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10,5 +10,5 @@ import com.mybatisflex.core.BaseMapper;
|
|||||||
* @since 2025-11-03 15:04
|
* @since 2025-11-03 15:04
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface EbikeAttachmentFileMapper extends BaseMapper<EbikeAttachmentFile> {
|
public interface EbikeFaultFileMapper extends BaseMapper<EbikeFaultFile> {
|
||||||
}
|
}
|
||||||
@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class EbikeAttachmentFileDto {
|
public class EbikeFaultFileDto {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件主键id
|
* 文件主键id
|
||||||
@ -86,5 +86,5 @@ public class EbikeFaultReportDto {
|
|||||||
/**
|
/**
|
||||||
* 附件文件列表
|
* 附件文件列表
|
||||||
*/
|
*/
|
||||||
List<EbikeAttachmentFileDto> attachmentFiles;
|
List<EbikeFaultFileDto> attachmentFiles;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,8 +23,8 @@ import java.time.LocalDateTime;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Table("ebike_attachment_file")
|
@Table("ebike_fault_file")
|
||||||
public class EbikeAttachmentFile implements Serializable {
|
public class EbikeFaultFile implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -18,7 +18,7 @@ import java.io.Serializable;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class EbikeAttachmentFileVo implements Serializable {
|
public class EbikeFaultFileVo implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件名称
|
* 文件名称
|
||||||
@ -3,7 +3,7 @@ package com.cdzy.user.model.vo;
|
|||||||
import com.cdzy.user.handler.PGpointDeserializer;
|
import com.cdzy.user.handler.PGpointDeserializer;
|
||||||
import com.cdzy.user.handler.PGpointSerializer;
|
import com.cdzy.user.handler.PGpointSerializer;
|
||||||
import com.cdzy.user.handler.PGpointTypeHandler;
|
import com.cdzy.user.handler.PGpointTypeHandler;
|
||||||
import com.cdzy.user.model.dto.EbikeAttachmentFileDto;
|
import com.cdzy.user.model.dto.EbikeFaultFileDto;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.mybatisflex.annotation.Column;
|
import com.mybatisflex.annotation.Column;
|
||||||
@ -83,5 +83,5 @@ public class EbikeFaultReportVo {
|
|||||||
/**
|
/**
|
||||||
* 文件
|
* 文件
|
||||||
*/
|
*/
|
||||||
private List<EbikeAttachmentFileDto> attachmentFiles;
|
private List<EbikeFaultFileDto> attachmentFiles;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package com.cdzy.user.service;
|
package com.cdzy.user.service;
|
||||||
|
|
||||||
import com.cdzy.user.model.entity.EbikeAttachmentFile;
|
import com.cdzy.user.model.entity.EbikeFaultFile;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
* @since 2025-11-03 15:06
|
* @since 2025-11-03 15:06
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface EbikeAttachmentFileService extends IService<EbikeAttachmentFile> {
|
public interface EbikeFaultFileService extends IService<EbikeFaultFile> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据故障上报主键id获取所有文件
|
* 根据故障上报主键id获取所有文件
|
||||||
@ -20,7 +20,7 @@ public interface EbikeAttachmentFileService extends IService<EbikeAttachmentFile
|
|||||||
* @param reportId 故障上报主键id
|
* @param reportId 故障上报主键id
|
||||||
* @return id下所有文件信息
|
* @return id下所有文件信息
|
||||||
*/
|
*/
|
||||||
List<EbikeAttachmentFile> queryFiles(Long reportId);
|
List<EbikeFaultFile> queryFiles(Long reportId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据故障上报主键id删除所有文件
|
* 根据故障上报主键id删除所有文件
|
||||||
@ -34,5 +34,5 @@ public interface EbikeAttachmentFileService extends IService<EbikeAttachmentFile
|
|||||||
*
|
*
|
||||||
* @param reportIds 故障上报id
|
* @param reportIds 故障上报id
|
||||||
*/
|
*/
|
||||||
List<EbikeAttachmentFile> queryFilesByReportIds(List<Long> reportIds);
|
List<EbikeFaultFile> queryFilesByReportIds(List<Long> reportIds);
|
||||||
}
|
}
|
||||||
@ -4,7 +4,7 @@ import com.cdzy.user.model.dto.EbikeFaultReportDto;
|
|||||||
import com.cdzy.user.model.dto.EbikeFaultReportQueryDto;
|
import com.cdzy.user.model.dto.EbikeFaultReportQueryDto;
|
||||||
import com.cdzy.user.model.dto.EbikeOrderFaultReportDto;
|
import com.cdzy.user.model.dto.EbikeOrderFaultReportDto;
|
||||||
import com.cdzy.user.model.entity.EbikeFaultReport;
|
import com.cdzy.user.model.entity.EbikeFaultReport;
|
||||||
import com.cdzy.user.model.vo.EbikeAttachmentFileVo;
|
import com.cdzy.user.model.vo.EbikeFaultFileVo;
|
||||||
import com.cdzy.user.model.vo.EbikeFaultReportVo;
|
import com.cdzy.user.model.vo.EbikeFaultReportVo;
|
||||||
import com.cdzy.user.model.vo.EbikeOrderFaultReportVo;
|
import com.cdzy.user.model.vo.EbikeOrderFaultReportVo;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
@ -35,7 +35,7 @@ public interface EbikeFaultReportService extends IService<EbikeFaultReport> {
|
|||||||
* @param multipartFile 文件
|
* @param multipartFile 文件
|
||||||
* @return 上传文件信息
|
* @return 上传文件信息
|
||||||
*/
|
*/
|
||||||
EbikeAttachmentFileVo uploadFile(MultipartFile multipartFile);
|
EbikeFaultFileVo uploadFile(MultipartFile multipartFile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据文件名称删除minio中的文件
|
* 根据文件名称删除minio中的文件
|
||||||
|
|||||||
@ -11,8 +11,6 @@ import com.mybatisflex.core.paginate.Page;
|
|||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户退款 服务层
|
* 用户退款 服务层
|
||||||
*
|
*
|
||||||
@ -93,7 +91,7 @@ public interface EbikeRefundService extends IService<EbikeRefund> {
|
|||||||
* @param multipartFile 文件
|
* @param multipartFile 文件
|
||||||
* @return 文件信息
|
* @return 文件信息
|
||||||
*/
|
*/
|
||||||
EbikeAttachmentFileVo uploadFile(MultipartFile multipartFile);
|
EbikeFaultFileVo uploadFile(MultipartFile multipartFile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据文件名称删除minio中的文件
|
* 根据文件名称删除minio中的文件
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
package com.cdzy.user.service.impl;
|
package com.cdzy.user.service.impl;
|
||||||
|
|
||||||
import com.cdzy.user.mapper.EbikeAttachmentFileMapper;
|
import com.cdzy.user.mapper.EbikeFaultFileMapper;
|
||||||
import com.cdzy.user.model.entity.EbikeAttachmentFile;
|
import com.cdzy.user.model.entity.EbikeFaultFile;
|
||||||
import com.cdzy.user.service.EbikeAttachmentFileService;
|
import com.cdzy.user.service.EbikeFaultFileService;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -19,10 +19,10 @@ import static com.cdzy.user.model.entity.table.EbikeAttachmentFileTableDef.EBIKE
|
|||||||
* @since 2025-11-03 15:06
|
* @since 2025-11-03 15:06
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class EbikeAttachmentFileServiceImpl extends ServiceImpl<EbikeAttachmentFileMapper, EbikeAttachmentFile> implements EbikeAttachmentFileService {
|
public class EbikeFaultFileServiceImpl extends ServiceImpl<EbikeFaultFileMapper, EbikeFaultFile> implements EbikeFaultFileService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EbikeAttachmentFile> queryFiles(Long reportId) {
|
public List<EbikeFaultFile> queryFiles(Long reportId) {
|
||||||
QueryWrapper query = QueryWrapper.create()
|
QueryWrapper query = QueryWrapper.create()
|
||||||
.select(EBIKE_ATTACHMENT_FILE.ALL_COLUMNS)
|
.select(EBIKE_ATTACHMENT_FILE.ALL_COLUMNS)
|
||||||
.where(EBIKE_ATTACHMENT_FILE.REPORT_ID.eq(reportId));
|
.where(EBIKE_ATTACHMENT_FILE.REPORT_ID.eq(reportId));
|
||||||
@ -38,7 +38,7 @@ public class EbikeAttachmentFileServiceImpl extends ServiceImpl<EbikeAttachmentF
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EbikeAttachmentFile> queryFilesByReportIds(List<Long> reportIds) {
|
public List<EbikeFaultFile> queryFilesByReportIds(List<Long> reportIds) {
|
||||||
if (reportIds == null || reportIds.isEmpty()) {
|
if (reportIds == null || reportIds.isEmpty()) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@ -3,19 +3,20 @@ package com.cdzy.user.service.impl;
|
|||||||
import com.cdzy.common.enums.Code;
|
import com.cdzy.common.enums.Code;
|
||||||
import com.cdzy.common.ex.EbikeException;
|
import com.cdzy.common.ex.EbikeException;
|
||||||
import com.cdzy.common.model.response.JsonResult;
|
import com.cdzy.common.model.response.JsonResult;
|
||||||
|
import com.cdzy.user.enums.EbikeFaultReportStatus;
|
||||||
import com.cdzy.user.enums.EbikeFileTypeEnum;
|
import com.cdzy.user.enums.EbikeFileTypeEnum;
|
||||||
import com.cdzy.user.mapper.EbikeFaultReportMapper;
|
import com.cdzy.user.mapper.EbikeFaultReportMapper;
|
||||||
import com.cdzy.user.model.dto.EbikeAttachmentFileDto;
|
import com.cdzy.user.model.dto.EbikeFaultFileDto;
|
||||||
import com.cdzy.user.model.dto.EbikeFaultReportDto;
|
import com.cdzy.user.model.dto.EbikeFaultReportDto;
|
||||||
import com.cdzy.user.model.dto.EbikeFaultReportQueryDto;
|
import com.cdzy.user.model.dto.EbikeFaultReportQueryDto;
|
||||||
import com.cdzy.user.model.dto.EbikeOrderFaultReportDto;
|
import com.cdzy.user.model.dto.EbikeOrderFaultReportDto;
|
||||||
import com.cdzy.user.model.entity.EbikeAttachmentFile;
|
import com.cdzy.user.model.entity.EbikeFaultFile;
|
||||||
import com.cdzy.user.model.entity.EbikeFaultPart;
|
import com.cdzy.user.model.entity.EbikeFaultPart;
|
||||||
import com.cdzy.user.model.entity.EbikeFaultReport;
|
import com.cdzy.user.model.entity.EbikeFaultReport;
|
||||||
import com.cdzy.user.model.vo.EbikeAttachmentFileVo;
|
import com.cdzy.user.model.vo.EbikeFaultFileVo;
|
||||||
import com.cdzy.user.model.vo.EbikeFaultReportVo;
|
import com.cdzy.user.model.vo.EbikeFaultReportVo;
|
||||||
import com.cdzy.user.model.vo.EbikeOrderFaultReportVo;
|
import com.cdzy.user.model.vo.EbikeOrderFaultReportVo;
|
||||||
import com.cdzy.user.service.EbikeAttachmentFileService;
|
import com.cdzy.user.service.EbikeFaultFileService;
|
||||||
import com.cdzy.user.service.EbikeFaultPartService;
|
import com.cdzy.user.service.EbikeFaultPartService;
|
||||||
import com.cdzy.user.service.EbikeFaultReportService;
|
import com.cdzy.user.service.EbikeFaultReportService;
|
||||||
import com.cdzy.user.utils.MinioUtil;
|
import com.cdzy.user.utils.MinioUtil;
|
||||||
@ -51,7 +52,7 @@ import static com.cdzy.user.model.entity.table.EbikeUserTableDef.EBIKE_USER;
|
|||||||
public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMapper, EbikeFaultReport> implements EbikeFaultReportService {
|
public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMapper, EbikeFaultReport> implements EbikeFaultReportService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private EbikeAttachmentFileService ebikeAttachmentFileService;
|
private EbikeFaultFileService ebikeAttachmentFileService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OperationsFeignClient operationsFeignClient;
|
private OperationsFeignClient operationsFeignClient;
|
||||||
@ -74,6 +75,7 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
|
|||||||
.userMobile(ebikeFaultReportDto.getUserMobile())
|
.userMobile(ebikeFaultReportDto.getUserMobile())
|
||||||
.reportSource(ebikeFaultReportDto.getReportSource())
|
.reportSource(ebikeFaultReportDto.getReportSource())
|
||||||
.location(ebikeFaultReportDto.getLocation())
|
.location(ebikeFaultReportDto.getLocation())
|
||||||
|
.handleStatus(EbikeFaultReportStatus.PENDING)
|
||||||
.orderId(ebikeFaultReportDto.getOrderId())
|
.orderId(ebikeFaultReportDto.getOrderId())
|
||||||
.reviewId(ebikeFaultReportDto.getReviewId())
|
.reviewId(ebikeFaultReportDto.getReviewId())
|
||||||
.createBy(ebikeFaultReportDto.getUserId())
|
.createBy(ebikeFaultReportDto.getUserId())
|
||||||
@ -81,10 +83,10 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
|
|||||||
this.save(userFaultReport);
|
this.save(userFaultReport);
|
||||||
// 保存附件信息
|
// 保存附件信息
|
||||||
Long reportId = userFaultReport.getReportId();
|
Long reportId = userFaultReport.getReportId();
|
||||||
List<EbikeAttachmentFileDto> attachmentFiles = ebikeFaultReportDto.getAttachmentFiles();
|
List<EbikeFaultFileDto> attachmentFiles = ebikeFaultReportDto.getAttachmentFiles();
|
||||||
if (attachmentFiles != null && !attachmentFiles.isEmpty()) {
|
if (attachmentFiles != null && !attachmentFiles.isEmpty()) {
|
||||||
List<EbikeAttachmentFile> fileEntities = attachmentFiles.stream()
|
List<EbikeFaultFile> fileEntities = attachmentFiles.stream()
|
||||||
.map(dto -> EbikeAttachmentFile.builder()
|
.map(dto -> EbikeFaultFile.builder()
|
||||||
.reportId(reportId)
|
.reportId(reportId)
|
||||||
.fileName(dto.getFileName())
|
.fileName(dto.getFileName())
|
||||||
.fileType(dto.getFileType())
|
.fileType(dto.getFileType())
|
||||||
@ -108,7 +110,7 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EbikeAttachmentFileVo uploadFile(MultipartFile multipartFile) {
|
public EbikeFaultFileVo uploadFile(MultipartFile multipartFile) {
|
||||||
String fileName = multipartFile.getOriginalFilename();
|
String fileName = multipartFile.getOriginalFilename();
|
||||||
if (!StringUtils.hasText(fileName)) {
|
if (!StringUtils.hasText(fileName)) {
|
||||||
throw new EbikeException("文件名不能为空");
|
throw new EbikeException("文件名不能为空");
|
||||||
@ -120,7 +122,7 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
|
|||||||
// 文件上传
|
// 文件上传
|
||||||
minioUtil.uploadFile(EbikeFileTypeEnum.FAULT_ATTACHMENT, inputStream, saveFileName);
|
minioUtil.uploadFile(EbikeFileTypeEnum.FAULT_ATTACHMENT, inputStream, saveFileName);
|
||||||
String fileUrl = minioUtil.getFileUrl(EbikeFileTypeEnum.FAULT_ATTACHMENT, saveFileName);
|
String fileUrl = minioUtil.getFileUrl(EbikeFileTypeEnum.FAULT_ATTACHMENT, saveFileName);
|
||||||
return EbikeAttachmentFileVo.builder()
|
return EbikeFaultFileVo.builder()
|
||||||
.fileName(saveFileName)
|
.fileName(saveFileName)
|
||||||
.fileUrl(fileUrl)
|
.fileUrl(fileUrl)
|
||||||
.fileSize(multipartFile.getSize())
|
.fileSize(multipartFile.getSize())
|
||||||
@ -146,9 +148,9 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
|
|||||||
@Override
|
@Override
|
||||||
public void removeFaultReport(Long reportId) {
|
public void removeFaultReport(Long reportId) {
|
||||||
try {
|
try {
|
||||||
List<EbikeAttachmentFile> files = ebikeAttachmentFileService.queryFiles(reportId);
|
List<EbikeFaultFile> files = ebikeAttachmentFileService.queryFiles(reportId);
|
||||||
if (!CollectionUtils.isEmpty(files)) {
|
if (!CollectionUtils.isEmpty(files)) {
|
||||||
for (EbikeAttachmentFile file : files) {
|
for (EbikeFaultFile file : files) {
|
||||||
minioUtil.deleteObject(file.getFileName());
|
minioUtil.deleteObject(file.getFileName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,26 +184,26 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
|
|||||||
.updateBy(ebikeFaultReportDto.getUserId())
|
.updateBy(ebikeFaultReportDto.getUserId())
|
||||||
.build();
|
.build();
|
||||||
this.updateById(userFaultReport);
|
this.updateById(userFaultReport);
|
||||||
List<EbikeAttachmentFileDto> attachmentFiles = ebikeFaultReportDto.getAttachmentFiles();
|
List<EbikeFaultFileDto> attachmentFiles = ebikeFaultReportDto.getAttachmentFiles();
|
||||||
// 更新文件信息
|
// 更新文件信息
|
||||||
if (!CollectionUtils.isEmpty(attachmentFiles)) {
|
if (!CollectionUtils.isEmpty(attachmentFiles)) {
|
||||||
List<EbikeAttachmentFile> existingFiles = ebikeAttachmentFileService.queryFiles(ebikeFaultReportDto.getReportId());
|
List<EbikeFaultFile> existingFiles = ebikeAttachmentFileService.queryFiles(ebikeFaultReportDto.getReportId());
|
||||||
|
|
||||||
Set<Long> existingFileIds = existingFiles.stream()
|
Set<Long> existingFileIds = existingFiles.stream()
|
||||||
.map(EbikeAttachmentFile::getFileId)
|
.map(EbikeFaultFile::getFileId)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
// 分离前端数据,无id的新增,有id的对比
|
// 分离前端数据,无id的新增,有id的对比
|
||||||
Set<Long> incomingFileIds = new HashSet<>();
|
Set<Long> incomingFileIds = new HashSet<>();
|
||||||
List<EbikeAttachmentFile> filesToInsert = new ArrayList<>();
|
List<EbikeFaultFile> filesToInsert = new ArrayList<>();
|
||||||
|
|
||||||
for (EbikeAttachmentFileDto dto : attachmentFiles) {
|
for (EbikeFaultFileDto dto : attachmentFiles) {
|
||||||
if (dto.getFileId() != null) {
|
if (dto.getFileId() != null) {
|
||||||
incomingFileIds.add(dto.getFileId());
|
incomingFileIds.add(dto.getFileId());
|
||||||
} else {
|
} else {
|
||||||
// fileId 为空,则是新文件,插入数据
|
// fileId 为空,则是新文件,插入数据
|
||||||
EbikeAttachmentFile newFile = EbikeAttachmentFile.builder()
|
EbikeFaultFile newFile = EbikeFaultFile.builder()
|
||||||
.reportId(ebikeFaultReportDto.getReportId())
|
.reportId(ebikeFaultReportDto.getReportId())
|
||||||
.fileName(dto.getFileName())
|
.fileName(dto.getFileName())
|
||||||
.fileType(dto.getFileType())
|
.fileType(dto.getFileType())
|
||||||
@ -262,10 +264,10 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
|
|||||||
if (report == null) {
|
if (report == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<EbikeAttachmentFile> attachmentFiles = ebikeAttachmentFileService.queryFiles(reportId);
|
List<EbikeFaultFile> attachmentFiles = ebikeAttachmentFileService.queryFiles(reportId);
|
||||||
|
|
||||||
List<EbikeAttachmentFileDto> fileInfo = attachmentFiles.stream()
|
List<EbikeFaultFileDto> fileInfo = attachmentFiles.stream()
|
||||||
.map(file -> EbikeAttachmentFileDto.builder()
|
.map(file -> EbikeFaultFileDto.builder()
|
||||||
.fileId(file.getFileId())
|
.fileId(file.getFileId())
|
||||||
.fileName(file.getFileName())
|
.fileName(file.getFileName())
|
||||||
.fileType(file.getFileType())
|
.fileType(file.getFileType())
|
||||||
@ -308,10 +310,10 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// 查询附件文件
|
// 查询附件文件
|
||||||
Map<Long, List<EbikeAttachmentFile>> fileMap = ebikeAttachmentFileService
|
Map<Long, List<EbikeFaultFile>> fileMap = ebikeAttachmentFileService
|
||||||
.queryFilesByReportIds(reportIds)
|
.queryFilesByReportIds(reportIds)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.groupingBy(EbikeAttachmentFile::getReportId));
|
.collect(Collectors.groupingBy(EbikeFaultFile::getReportId));
|
||||||
|
|
||||||
// 查询故障部件
|
// 查询故障部件
|
||||||
List<EbikeFaultPart> faultParts = ebikeFaultPartService.list(
|
List<EbikeFaultPart> faultParts = ebikeFaultPartService.list(
|
||||||
@ -325,10 +327,10 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
|
|||||||
));
|
));
|
||||||
|
|
||||||
return reports.stream().map(report -> {
|
return reports.stream().map(report -> {
|
||||||
List<EbikeAttachmentFileDto> fileDtos = Optional.ofNullable(fileMap.get(report.getReportId()))
|
List<EbikeFaultFileDto> fileDtos = Optional.ofNullable(fileMap.get(report.getReportId()))
|
||||||
.orElse(Collections.emptyList())
|
.orElse(Collections.emptyList())
|
||||||
.stream()
|
.stream()
|
||||||
.map(file -> EbikeAttachmentFileDto.builder()
|
.map(file -> EbikeFaultFileDto.builder()
|
||||||
.fileId(file.getFileId())
|
.fileId(file.getFileId())
|
||||||
.fileName(file.getFileName())
|
.fileName(file.getFileName())
|
||||||
.fileType(file.getFileType())
|
.fileType(file.getFileType())
|
||||||
@ -382,9 +384,9 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
|
|||||||
QueryWrapper attachmentQuery = QueryWrapper.create()
|
QueryWrapper attachmentQuery = QueryWrapper.create()
|
||||||
.select(EBIKE_ATTACHMENT_FILE.ALL_COLUMNS)
|
.select(EBIKE_ATTACHMENT_FILE.ALL_COLUMNS)
|
||||||
.where(EBIKE_ATTACHMENT_FILE.REPORT_ID.in(reportIds));
|
.where(EBIKE_ATTACHMENT_FILE.REPORT_ID.in(reportIds));
|
||||||
List<EbikeAttachmentFile> allAttachments = ebikeAttachmentFileService.list(attachmentQuery);
|
List<EbikeFaultFile> allAttachments = ebikeAttachmentFileService.list(attachmentQuery);
|
||||||
Map<Long, List<EbikeAttachmentFile>> attachmentsByReportId = allAttachments.stream()
|
Map<Long, List<EbikeFaultFile>> attachmentsByReportId = allAttachments.stream()
|
||||||
.collect(Collectors.groupingBy(EbikeAttachmentFile::getReportId));
|
.collect(Collectors.groupingBy(EbikeFaultFile::getReportId));
|
||||||
|
|
||||||
// 获取部件 按照reportId分组
|
// 获取部件 按照reportId分组
|
||||||
List<EbikeFaultPart> faultPart = ebikeFaultPartService.getFaultPart(reportIds);
|
List<EbikeFaultPart> faultPart = ebikeFaultPartService.getFaultPart(reportIds);
|
||||||
@ -395,10 +397,10 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
|
|||||||
));
|
));
|
||||||
|
|
||||||
for (EbikeOrderFaultReportVo record : records) {
|
for (EbikeOrderFaultReportVo record : records) {
|
||||||
List<EbikeAttachmentFile> files = attachmentsByReportId.get(record.getReportId());
|
List<EbikeFaultFile> files = attachmentsByReportId.get(record.getReportId());
|
||||||
List<String> fileUrls = new ArrayList<>();
|
List<String> fileUrls = new ArrayList<>();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (EbikeAttachmentFile file : files) {
|
for (EbikeFaultFile file : files) {
|
||||||
try {
|
try {
|
||||||
String url = minioUtil.getFileUrl(file.getFileName());
|
String url = minioUtil.getFileUrl(file.getFileName());
|
||||||
fileUrls.add(url);
|
fileUrls.add(url);
|
||||||
|
|||||||
@ -391,7 +391,7 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EbikeAttachmentFileVo uploadFile(MultipartFile multipartFile) {
|
public EbikeFaultFileVo uploadFile(MultipartFile multipartFile) {
|
||||||
String fileName = multipartFile.getOriginalFilename();
|
String fileName = multipartFile.getOriginalFilename();
|
||||||
if (!org.springframework.util.StringUtils.hasText(fileName)) {
|
if (!org.springframework.util.StringUtils.hasText(fileName)) {
|
||||||
throw new EbikeException("文件名不能为空");
|
throw new EbikeException("文件名不能为空");
|
||||||
@ -403,7 +403,7 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
|||||||
// 文件上传
|
// 文件上传
|
||||||
minioUtil.uploadFile(EbikeFileTypeEnum.USER_REFUND, inputStream, saveFileName);
|
minioUtil.uploadFile(EbikeFileTypeEnum.USER_REFUND, inputStream, saveFileName);
|
||||||
String fileUrl = minioUtil.getFileUrl(EbikeFileTypeEnum.USER_REFUND, saveFileName);
|
String fileUrl = minioUtil.getFileUrl(EbikeFileTypeEnum.USER_REFUND, saveFileName);
|
||||||
return EbikeAttachmentFileVo.builder()
|
return EbikeFaultFileVo.builder()
|
||||||
.fileName(saveFileName)
|
.fileName(saveFileName)
|
||||||
.fileUrl(fileUrl)
|
.fileUrl(fileUrl)
|
||||||
.fileSize(multipartFile.getSize())
|
.fileSize(multipartFile.getSize())
|
||||||
|
|||||||
@ -90,7 +90,7 @@ CREATE SEQUENCE IF NOT EXISTS ebike_fault_part_part_id_seq
|
|||||||
CACHE 1;
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
-- 创建 ebike_attachment_file_file_id_seq 序列
|
-- 创建 ebike_fault_file_file_id_seq 序列
|
||||||
CREATE SEQUENCE IF NOT EXISTS ebike_attachment_file_file_id_seq
|
CREATE SEQUENCE IF NOT EXISTS ebike_attachment_file_file_id_seq
|
||||||
START WITH 1
|
START WITH 1
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
@ -420,7 +420,6 @@ CREATE TABLE "public"."ebike_fault_report" (
|
|||||||
"report_id" int8 NOT NULL DEFAULT nextval('ebike_fault_report_report_id_seq'::regclass),
|
"report_id" int8 NOT NULL DEFAULT nextval('ebike_fault_report_report_id_seq'::regclass),
|
||||||
"operator_id" int8 NOT NULL,
|
"operator_id" int8 NOT NULL,
|
||||||
"bike_code" varchar(50) COLLATE "pg_catalog"."default",
|
"bike_code" varchar(50) COLLATE "pg_catalog"."default",
|
||||||
"fault_part" int2,
|
|
||||||
"fault_description" varchar(400) COLLATE "pg_catalog"."default",
|
"fault_description" varchar(400) COLLATE "pg_catalog"."default",
|
||||||
"report_user_id" int8 COLLATE "pg_catalog"."default",
|
"report_user_id" int8 COLLATE "pg_catalog"."default",
|
||||||
"user_mobile" varchar(20) COLLATE "pg_catalog"."default",
|
"user_mobile" varchar(20) COLLATE "pg_catalog"."default",
|
||||||
@ -438,7 +437,6 @@ CREATE TABLE "public"."ebike_fault_report" (
|
|||||||
COMMENT ON COLUMN "public"."ebike_fault_report"."report_id" IS '主键ID';
|
COMMENT ON COLUMN "public"."ebike_fault_report"."report_id" IS '主键ID';
|
||||||
COMMENT ON COLUMN "public"."ebike_fault_report"."operator_id" IS '运营商id';
|
COMMENT ON COLUMN "public"."ebike_fault_report"."operator_id" IS '运营商id';
|
||||||
COMMENT ON COLUMN "public"."ebike_fault_report"."bike_code" IS '车辆编号';
|
COMMENT ON COLUMN "public"."ebike_fault_report"."bike_code" IS '车辆编号';
|
||||||
COMMENT ON COLUMN "public"."ebike_fault_report"."fault_part" IS '损坏部件';
|
|
||||||
COMMENT ON COLUMN "public"."ebike_fault_report"."fault_description" IS '故障说明';
|
COMMENT ON COLUMN "public"."ebike_fault_report"."fault_description" IS '故障说明';
|
||||||
COMMENT ON COLUMN "public"."ebike_fault_report"."report_user_id" IS '上报人主键id';
|
COMMENT ON COLUMN "public"."ebike_fault_report"."report_user_id" IS '上报人主键id';
|
||||||
COMMENT ON COLUMN "public"."ebike_fault_report"."user_mobile" IS '上报人手机号';
|
COMMENT ON COLUMN "public"."ebike_fault_report"."user_mobile" IS '上报人手机号';
|
||||||
@ -477,10 +475,10 @@ COMMENT ON COLUMN "public"."ebike_fault_part"."update_time" IS '最后修改时
|
|||||||
COMMENT ON TABLE "public"."ebike_fault_part" IS '用户上报故障部位表';
|
COMMENT ON TABLE "public"."ebike_fault_part" IS '用户上报故障部位表';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for ebike_attachment_file
|
-- Table structure for ebike_fault_file
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS "public"."ebike_attachment_file";
|
DROP TABLE IF EXISTS "public"."ebike_fault_file";
|
||||||
CREATE TABLE "public"."ebike_attachment_file" (
|
CREATE TABLE "public"."ebike_fault_file" (
|
||||||
"file_id" int8 NOT NULL DEFAULT nextval('ebike_attachment_file_file_id_seq'::regclass),
|
"file_id" int8 NOT NULL DEFAULT nextval('ebike_attachment_file_file_id_seq'::regclass),
|
||||||
"report_id" int8 NOT NULL,
|
"report_id" int8 NOT NULL,
|
||||||
"file_name" varchar(100) COLLATE "pg_catalog"."default",
|
"file_name" varchar(100) COLLATE "pg_catalog"."default",
|
||||||
@ -493,17 +491,17 @@ CREATE TABLE "public"."ebike_attachment_file" (
|
|||||||
"update_time" timestamp(6),
|
"update_time" timestamp(6),
|
||||||
"is_deleted" bool NOT NULL DEFAULT false
|
"is_deleted" bool NOT NULL DEFAULT false
|
||||||
);
|
);
|
||||||
COMMENT ON COLUMN "public"."ebike_attachment_file"."file_id" IS '主键ID';
|
COMMENT ON COLUMN "public"."ebike_fault_file"."file_id" IS '主键ID';
|
||||||
COMMENT ON COLUMN "public"."ebike_attachment_file"."report_id" IS '报告id';
|
COMMENT ON COLUMN "public"."ebike_fault_file"."report_id" IS '报告id';
|
||||||
COMMENT ON COLUMN "public"."ebike_attachment_file"."file_name" IS '附件文件名';
|
COMMENT ON COLUMN "public"."ebike_fault_file"."file_name" IS '附件文件名';
|
||||||
COMMENT ON COLUMN "public"."ebike_attachment_file"."file_type" IS '附件类型';
|
COMMENT ON COLUMN "public"."ebike_fault_file"."file_type" IS '附件类型';
|
||||||
COMMENT ON COLUMN "public"."ebike_attachment_file"."file_url" IS '附件地址';
|
COMMENT ON COLUMN "public"."ebike_fault_file"."file_url" IS '附件地址';
|
||||||
COMMENT ON COLUMN "public"."ebike_attachment_file"."file_size" IS '附件大小';
|
COMMENT ON COLUMN "public"."ebike_fault_file"."file_size" IS '附件大小';
|
||||||
COMMENT ON COLUMN "public"."ebike_attachment_file"."create_by" IS '创建人ID';
|
COMMENT ON COLUMN "public"."ebike_fault_file"."create_by" IS '创建人ID';
|
||||||
COMMENT ON COLUMN "public"."ebike_attachment_file"."create_time" IS '创建时间';
|
COMMENT ON COLUMN "public"."ebike_fault_file"."create_time" IS '创建时间';
|
||||||
COMMENT ON COLUMN "public"."ebike_attachment_file"."update_by" IS '最后修改人ID';
|
COMMENT ON COLUMN "public"."ebike_fault_file"."update_by" IS '最后修改人ID';
|
||||||
COMMENT ON COLUMN "public"."ebike_attachment_file"."update_time" IS '最后修改时间';
|
COMMENT ON COLUMN "public"."ebike_fault_file"."update_time" IS '最后修改时间';
|
||||||
COMMENT ON TABLE "public"."ebike_attachment_file" IS '用车相关附件文件记录';
|
COMMENT ON TABLE "public"."ebike_fault_file" IS '用车相关附件文件记录';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -601,6 +599,6 @@ CREATE INDEX idx_ebike_refund_report_operator_id ON public.ebike_fault_report (o
|
|||||||
ALTER TABLE "public"."ebike_fault_part" ADD CONSTRAINT "ebike_refund_part_pkey" PRIMARY KEY ("part_id");
|
ALTER TABLE "public"."ebike_fault_part" ADD CONSTRAINT "ebike_refund_part_pkey" PRIMARY KEY ("part_id");
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Primary Key structure for table ebike_attachment_file
|
-- Primary Key structure for table ebike_fault_file
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
ALTER TABLE "public"."ebike_attachment_file" ADD CONSTRAINT "ebike_attachment_file_file_pkey" PRIMARY KEY ("file_id");
|
ALTER TABLE "public"."ebike_fault_file" ADD CONSTRAINT "ebike_fault_file_file_pkey" PRIMARY KEY ("file_id");
|
||||||
Loading…
x
Reference in New Issue
Block a user