feat(printer): 修改用户照片上传接口返回照片ID

- 将 addUserPhoto 接口的返回值从布尔值改为照片ID
- 更新 AppPrinterController 中上传接口的返回值为照片ID
- 调整 PrinterServiceImpl 实现类中 addUserPhoto 方法返回实体ID- 修改 PrinterService 接口定义,统一返回类型为 Integer
This commit is contained in:
2025-10-27 09:24:59 +08:00
parent 0f0601e5eb
commit d9049b8a29
3 changed files with 5 additions and 5 deletions

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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