mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 12:52:07 +08:00
贴皮文件上传接口支持只传文件不更新贴皮
This commit is contained in:
+1
-1
@@ -117,7 +117,7 @@ public class VeneerController {
|
||||
@PostMapping("/pic")
|
||||
@Operation(summary = "上传贴皮照片")
|
||||
@OperateLog(logArgs = false, type = CREATE)
|
||||
public CommonResult<Long> uploadVeneerPic(@RequestParam("id") Long id,
|
||||
public CommonResult<Long> uploadVeneerPic(@RequestParam(value = "id", required = false) Long id,
|
||||
@RequestPart(value = "file") MultipartFile file) throws IOException {
|
||||
return success(veneerService.uploadPic(id, file));
|
||||
}
|
||||
|
||||
+6
-4
@@ -128,7 +128,7 @@ public class VeneerServiceImpl implements VeneerService {
|
||||
|
||||
@Override
|
||||
public Long uploadPic(Long id, MultipartFile file) throws IOException {
|
||||
if (ObjectUtil.isNull(validateExist(id))) {
|
||||
if (ObjectUtil.isNotNull(id) && ObjectUtil.isNull(validateExist(id))) {
|
||||
throw new ServiceException(VENEER_NOT_EXIST);
|
||||
}
|
||||
|
||||
@@ -143,9 +143,11 @@ public class VeneerServiceImpl implements VeneerService {
|
||||
organizationDTO = details.getData();
|
||||
}
|
||||
Long fileId = fileApi.createFileAndReturnId(file.getBytes(), String.format("%s-veneer-pic-file-%s.%s", organizationDTO.getName(), LocalDateTimeUtil.format(LocalDateTime.now(), PURE_DATETIME_PATTERN), getFileExtension(file.getOriginalFilename())));
|
||||
veneerMapper.update(new LambdaUpdateWrapper<VeneerDO>()
|
||||
.eq(VeneerDO::getId, id)
|
||||
.set(VeneerDO::getFileId, fileId));
|
||||
if (ObjectUtil.isNotNull(id)) {
|
||||
veneerMapper.update(new LambdaUpdateWrapper<VeneerDO>()
|
||||
.eq(VeneerDO::getId, id)
|
||||
.set(VeneerDO::getFileId, fileId));
|
||||
}
|
||||
return fileId;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user