运维模块修改审核通过→提交故障上报→用户上报状态回写(已经审核过了)

This commit is contained in:
jkcdev 2025-04-18 16:57:55 +08:00
parent ed3c0ad9ee
commit 04bf3bd199
7 changed files with 34 additions and 14 deletions

View File

@ -51,7 +51,7 @@ public class EbikeOrderAttachmentFileDto implements Serializable {
/** /**
* 附件下载地址 * 附件下载地址
*/ */
private String fileUrl; private String url;
/** /**
* 数据桶名 * 数据桶名

View File

@ -79,4 +79,9 @@ public class EbikeBikeFaultHandleFile implements Serializable {
* 删除时间 * 删除时间
*/ */
private LocalDateTime deletedAt; private LocalDateTime deletedAt;
/**
* 数据桶名
*/
private String fileBucket;
} }

View File

@ -432,15 +432,16 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
query.clear(); query.clear();
query.eq(EBIKE_BIKE_FAULT_REPORT_FILE.REPORT_ID.getName(), ebikeBikeFaultReport.getFaultReportId()); query.eq(EBIKE_BIKE_FAULT_REPORT_FILE.REPORT_ID.getName(), ebikeBikeFaultReport.getFaultReportId());
List<EbikeBikeFaultReportFile> ebikeBikeFaultReportFiles = ebikeBikeFaultReportFileMapper.selectListByQuery(query); List<EbikeBikeFaultReportFile> ebikeBikeFaultReportFiles = ebikeBikeFaultReportFileMapper.selectListByQuery(query);
ResEbikeFaultReportFileDto resEbikeFaultReportFileDto = new ResEbikeFaultReportFileDto();
for (EbikeBikeFaultReportFile ebikeBikeFaultReportFile : ebikeBikeFaultReportFiles) { for (EbikeBikeFaultReportFile ebikeBikeFaultReportFile : ebikeBikeFaultReportFiles) {
ResEbikeFaultReportFileDto resEbikeFaultReportFileDto = new ResEbikeFaultReportFileDto();
BeanUtils.copyProperties(ebikeBikeFaultReportFile, resEbikeFaultReportFileDto); BeanUtils.copyProperties(ebikeBikeFaultReportFile, resEbikeFaultReportFileDto);
try { //try {
String faultReportBucket = minioUtil.getFileUrl("fault-report-bucket", ebikeBikeFaultReportFile.getFileUniqueKey()); String bucket = ebikeBikeFaultReportFile.getFileBucket();
String faultReportBucket = minioUtil.getFileUrl2(bucket==null||bucket.isEmpty()? "fault-report-bucket": bucket, ebikeBikeFaultReportFile.getFileUniqueKey());
resEbikeFaultReportFileDto.setUrl(faultReportBucket); resEbikeFaultReportFileDto.setUrl(faultReportBucket);
} catch (Exception e) { //} catch (Exception e) {
throw new RuntimeException(e); // throw new RuntimeException(e);
} //}
fileList.add(resEbikeFaultReportFileDto); fileList.add(resEbikeFaultReportFileDto);
} }
} }
@ -1013,7 +1014,8 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
ResEbikeFaultReportFileDto resEbikeFaultReportFileDto = new ResEbikeFaultReportFileDto(); ResEbikeFaultReportFileDto resEbikeFaultReportFileDto = new ResEbikeFaultReportFileDto();
BeanUtils.copyProperties(ebikeBikeFaultReport, resEbikeFaultReportFileDto); BeanUtils.copyProperties(ebikeBikeFaultReport, resEbikeFaultReportFileDto);
try { try {
String faultReportBucket = minioUtil.getFileUrl("fault-report-bucket", ebikeBikeFaultReportFile.getFileUniqueKey()); String bucket = ebikeBikeFaultReportFile.getFileBucket();
String faultReportBucket = minioUtil.getFileUrl(bucket==null||bucket.isEmpty()?"fault-report-bucket" : bucket, ebikeBikeFaultReportFile.getFileUniqueKey());
resEbikeFaultReportFileDto.setUrl(faultReportBucket); resEbikeFaultReportFileDto.setUrl(faultReportBucket);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -1028,7 +1030,8 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
ResEbikeFaultHandleFileDto resEbikeFaultHandleFileDto = new ResEbikeFaultHandleFileDto(); ResEbikeFaultHandleFileDto resEbikeFaultHandleFileDto = new ResEbikeFaultHandleFileDto();
BeanUtils.copyProperties(ebikeBikeFaultHandleFile, resEbikeFaultHandleFileDto); BeanUtils.copyProperties(ebikeBikeFaultHandleFile, resEbikeFaultHandleFileDto);
try { try {
String faultReportBucket = minioUtil.getFileUrl("fault-report-bucket", ebikeBikeFaultHandleFile.getFileUniqueKey()); String bucket = ebikeBikeFaultHandleFile.getFileBucket();
String faultReportBucket = minioUtil.getFileUrl(bucket==null||bucket.isEmpty()?"fault-report-bucket": bucket, ebikeBikeFaultHandleFile.getFileUniqueKey());
resEbikeFaultHandleFileDto.setUrl(faultReportBucket); resEbikeFaultHandleFileDto.setUrl(faultReportBucket);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@ -27,7 +27,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Optional;
import static com.cdzy.ebikemaintenance.model.pojo.table.EbikeBikeFaultReportFileTableDef.EBIKE_BIKE_FAULT_REPORT_FILE; import static com.cdzy.ebikemaintenance.model.pojo.table.EbikeBikeFaultReportFileTableDef.EBIKE_BIKE_FAULT_REPORT_FILE;
import static com.cdzy.ebikemaintenance.model.pojo.table.EbikeFaultreportReviewTableDef.EBIKE_FAULTREPORT_REVIEW; import static com.cdzy.ebikemaintenance.model.pojo.table.EbikeFaultreportReviewTableDef.EBIKE_FAULTREPORT_REVIEW;
@ -62,6 +64,7 @@ public class EbikeFaultreportReviewServiceImpl extends ServiceImpl<EbikeFaultrep
entity.setIsDelete("1"); entity.setIsDelete("1");
entity.setDeleteTime(LocalDateTime.now()); entity.setDeleteTime(LocalDateTime.now());
} }
save(entity);
// 保存选择故障图片附件信息 // 保存选择故障图片附件信息
List<EbikeBikeFaultReportFile> attachmentFiles = ebikeFaultreportReview.getAttachmentFiles().stream().map(file -> { List<EbikeBikeFaultReportFile> attachmentFiles = ebikeFaultreportReview.getAttachmentFiles().stream().map(file -> {
EbikeBikeFaultReportFile attachmentFile = new EbikeBikeFaultReportFile(); EbikeBikeFaultReportFile attachmentFile = new EbikeBikeFaultReportFile();
@ -85,15 +88,24 @@ public class EbikeFaultreportReviewServiceImpl extends ServiceImpl<EbikeFaultrep
if (!userFaultreports.isEmpty()) { if (!userFaultreports.isEmpty()) {
ebikeUserFaultreportService.updateUserFaultreports(userFaultreports); ebikeUserFaultreportService.updateUserFaultreports(userFaultreports);
} }
save(entity);
// 如果审查属实直接上报 // 如果审查属实直接上报
if ("1".equals(entity.getResult())){ if ("1".equals(entity.getResult())){
// 使用最后一次上报的故障信息上报的经纬度
Optional<ResEbikeUserFaultreportDto> last = ebikeFaultreportReview.getFaultReports().stream().max(
Comparator.comparing(
ResEbikeUserFaultreportDto::getReportAt,
Comparator.nullsLast(Comparator.naturalOrder())
));
ReqEbikeBikeFaultReportDto faultReportDto = new ReqEbikeBikeFaultReportDto(); ReqEbikeBikeFaultReportDto faultReportDto = new ReqEbikeBikeFaultReportDto();
faultReportDto.setFaultPart(entity.getFaultParts()); faultReportDto.setFaultPart(entity.getFaultParts());
faultReportDto.setFaultDescription(entity.getRemark()); faultReportDto.setFaultDescription(entity.getRemark());
faultReportDto.setBikeCode(entity.getBikeCode()); faultReportDto.setBikeCode(entity.getBikeCode());
faultReportDto.setReportUser(entity.getReviewer()); faultReportDto.setReportUser(entity.getReviewer());
faultReportDto.setReportSource("用户上报审查"); faultReportDto.setReportSource("用户上报审查");
if(last.isPresent()){
faultReportDto.setLongitude(last.get().getLongitude());
faultReportDto.setLatitude(last.get().getLatitude());
}
// 附件选择图片) // 附件选择图片)
List<ReqEbikeFaultReportFileDto> attachmentFileDtos = attachmentFiles.stream().map(file -> { List<ReqEbikeFaultReportFileDto> attachmentFileDtos = attachmentFiles.stream().map(file -> {
ReqEbikeFaultReportFileDto dto = new ReqEbikeFaultReportFileDto(); ReqEbikeFaultReportFileDto dto = new ReqEbikeFaultReportFileDto();
@ -181,7 +193,7 @@ public class EbikeFaultreportReviewServiceImpl extends ServiceImpl<EbikeFaultrep
attachmentFile.setFileSize(fileDto.getFileSize()); attachmentFile.setFileSize(fileDto.getFileSize());
attachmentFile.setFileType(fileDto.getFileType()); attachmentFile.setFileType(fileDto.getFileType());
attachmentFile.setFileName(fileDto.getFileName()); attachmentFile.setFileName(fileDto.getFileName());
attachmentFile.setUrl(fileDto.getFileUrl()); attachmentFile.setUrl(fileDto.getUrl());
return attachmentFile; return attachmentFile;
}).toList(); }).toList();
faultReportDto.setReportAttachments(attachmentFiles); faultReportDto.setReportAttachments(attachmentFiles);

View File

@ -70,7 +70,7 @@ public class EbikeOrdersSystemInfoController {
ebikeOrderAttachmentFileService.save(ebikeAttachmentFile); ebikeOrderAttachmentFileService.save(ebikeAttachmentFile);
EbikeOrderAttachmentFileDto ebikeAttachmentFileDto = new EbikeOrderAttachmentFileDto(); EbikeOrderAttachmentFileDto ebikeAttachmentFileDto = new EbikeOrderAttachmentFileDto();
BeanUtils.copyProperties(ebikeAttachmentFile, ebikeAttachmentFileDto); BeanUtils.copyProperties(ebikeAttachmentFile, ebikeAttachmentFileDto);
ebikeAttachmentFileDto.setFileUrl(minioFileUrl); ebikeAttachmentFileDto.setUrl(minioFileUrl);
return JsonResult.success(ebikeAttachmentFileDto); return JsonResult.success(ebikeAttachmentFileDto);
} catch (Exception e) { } catch (Exception e) {
log.error("fileUpload===>{}", e.getMessage() + Arrays.toString(e.getStackTrace())); log.error("fileUpload===>{}", e.getMessage() + Arrays.toString(e.getStackTrace()));

View File

@ -104,7 +104,7 @@ public class EbikeUserFaultreportController {
.stream().map(attachmentFile ->{ .stream().map(attachmentFile ->{
EbikeOrderAttachmentFileDto attachmentFileDto = new EbikeOrderAttachmentFileDto(); EbikeOrderAttachmentFileDto attachmentFileDto = new EbikeOrderAttachmentFileDto();
BeanUtils.copyProperties(attachmentFile, attachmentFileDto); BeanUtils.copyProperties(attachmentFile, attachmentFileDto);
attachmentFileDto.setFileUrl(minioUtil.getBucketFileUrl(attachmentFile.getFileKey())); attachmentFileDto.setUrl(minioUtil.getBucketFileUrl(attachmentFile.getFileKey()));
return attachmentFileDto; return attachmentFileDto;
}).toList(); }).toList();
dto.setAttachmentFiles(attachmentFiles); dto.setAttachmentFiles(attachmentFiles);

View File

@ -118,7 +118,7 @@ public class EbikeUserFaultreportServiceImpl extends ServiceImpl<EbikeUserFaultr
EbikeOrderAttachmentFileDto attachmentFileDto = new EbikeOrderAttachmentFileDto(); EbikeOrderAttachmentFileDto attachmentFileDto = new EbikeOrderAttachmentFileDto();
BeanUtils.copyProperties(attachmentFile, attachmentFileDto); BeanUtils.copyProperties(attachmentFile, attachmentFileDto);
attachmentFileDto.setFileBucket(MinioUtil.BUCKET_ORDERS); attachmentFileDto.setFileBucket(MinioUtil.BUCKET_ORDERS);
attachmentFileDto.setFileUrl(minioUtil.getBucketFileUrl(attachmentFile.getFileKey())); attachmentFileDto.setUrl(minioUtil.getBucketFileUrl(attachmentFile.getFileKey()));
return attachmentFileDto; return attachmentFileDto;
}).toList(); }).toList();
dto.setAttachmentFiles(attachmentFiles); dto.setAttachmentFiles(attachmentFiles);