You've already forked FrameTour-BE
feat(printer): 修改用户照片上传接口返回照片ID
- 将 addUserPhoto 接口的返回值从布尔值改为照片ID - 更新 AppPrinterController 中上传接口的返回值为照片ID - 调整 PrinterServiceImpl 实现类中 addUserPhoto 方法返回实体ID- 修改 PrinterService 接口定义,统一返回类型为 Integer
This commit is contained in:
@@ -62,8 +62,8 @@ public class AppPrinterController {
|
|||||||
String[] split = file.getOriginalFilename().split("\\.");
|
String[] split = file.getOriginalFilename().split("\\.");
|
||||||
String ext = split[split.length - 1];
|
String ext = split[split.length - 1];
|
||||||
String url = StorageFactory.use().uploadFile(file, "printer", UUID.randomUUID() + "." + ext);
|
String url = StorageFactory.use().uploadFile(file, "printer", UUID.randomUUID() + "." + ext);
|
||||||
printerService.addUserPhoto(JwtTokenUtil.getWorker().getUserId(), scenicId, url);
|
Integer id = printerService.addUserPhoto(JwtTokenUtil.getWorker().getUserId(), scenicId, url);
|
||||||
return ApiResponse.success(url);
|
return ApiResponse.success(id);
|
||||||
}
|
}
|
||||||
@PostMapping("/uploadTo/{scenicId}/cropped/{id}")
|
@PostMapping("/uploadTo/{scenicId}/cropped/{id}")
|
||||||
public ApiResponse<?> uploadReplace(@PathVariable("scenicId") Long scenicId, @PathVariable("id") Long id, @RequestParam(value = "file") MultipartFile file) throws IOException {
|
public ApiResponse<?> uploadReplace(@PathVariable("scenicId") Long scenicId, @PathVariable("id") Long id, @RequestParam(value = "file") MultipartFile file) throws IOException {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public interface PrinterService {
|
|||||||
|
|
||||||
boolean deleteUserPhoto(Long memberId, Long scenicId, Long relationId);
|
boolean deleteUserPhoto(Long memberId, Long scenicId, Long relationId);
|
||||||
|
|
||||||
boolean addUserPhoto(Long memberId, Long scenicId, String url);
|
Integer addUserPhoto(Long memberId, Long scenicId, String url);
|
||||||
|
|
||||||
MemberPrintResp getUserPhoto(Long memberId, Long scenicId, Long id);
|
MemberPrintResp getUserPhoto(Long memberId, Long scenicId, Long id);
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public class PrinterServiceImpl implements PrinterService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addUserPhoto(Long memberId, Long scenicId, String url) {
|
public Integer addUserPhoto(Long memberId, Long scenicId, String url) {
|
||||||
MemberPrintEntity entity = new MemberPrintEntity();
|
MemberPrintEntity entity = new MemberPrintEntity();
|
||||||
entity.setMemberId(memberId);
|
entity.setMemberId(memberId);
|
||||||
entity.setScenicId(scenicId);
|
entity.setScenicId(scenicId);
|
||||||
@@ -234,7 +234,7 @@ public class PrinterServiceImpl implements PrinterService {
|
|||||||
entity.setCropUrl(url);
|
entity.setCropUrl(url);
|
||||||
entity.setStatus(0);
|
entity.setStatus(0);
|
||||||
printerMapper.addUserPhoto(entity);
|
printerMapper.addUserPhoto(entity);
|
||||||
return true;
|
return entity.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user