Skip to content

Commit

Permalink
Merge pull request #70 from HAB-DAY/fix/fundingSuccess
Browse files Browse the repository at this point in the history
[fix] 펀딩 수정 로그 추가
  • Loading branch information
abi-hong authored Aug 8, 2023
2 parents 38729e7 + 591d113 commit 357fead
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ public ResponseEntity<CommonResponse> getParticipatedList(@RequestHeader("") Str
@PutMapping("/update/{fundingItemId}")
public ResponseEntity<UpdateFundingItemResponse> updateFundingItem(@RequestHeader("") String accessToken, @PathVariable(value = "fundingItemId") Long fundingItemId, @RequestPart(value="fundingItemImg", required = false) MultipartFile fundingItemImg, @RequestPart(value="fundingItemName", required = false) String fundingItemName, @RequestPart(value = "fundingItemDetail", required = false) String fundingItemDetail) throws IOException {
Long memberId = jwtService.getMemberIdFromJwt(accessToken);
System.out.println("updateFundingItem^^ memberId" + memberId);
fundingService.updateFundingItem(fundingItemId, fundingItemImg, fundingItemName, fundingItemDetail);
System.out.println("updateFundingItem^^ finish");
return UpdateFundingItemResponse.newResponse(UPDATE_FUNDING_ITEM_SUCCESS);
//return CommonResponse.toResponse(UPDATE_FUNDING_ITEM_SUCCESS, null);
}
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/com/habday/server/service/FundingService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.habday.server.service;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.habday.server.classes.Calculation;
import com.habday.server.classes.Common;
Expand Down Expand Up @@ -35,6 +36,7 @@
import com.siot.IamportRestClient.response.Schedule;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.json.simple.JSONObject;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand Down Expand Up @@ -221,10 +223,17 @@ public ShowConfirmationResponseDto showConfirmation(Long fundingItemId){
public void updateFundingItem(Long fundingItemId, MultipartFile fundingItemImg, String fundingItemName, String fundingItemDetail) throws IOException {
FundingItem fundingItem = fundingItemRepository.findById(fundingItemId)
.orElseThrow(() -> new CustomException(NO_FUNDING_ITEM_ID));
ObjectMapper mapper = new ObjectMapper();
System.out.println("updateFundingItem^^ fundingItem" + mapper.writeValueAsString(fundingItem));
System.out.println("updateFundingItem^^ fundingItemImg" + fundingItemImg + " fundingItemName" + fundingItemName + " fundingItemDetail" + fundingItemDetail);

String updateFundingItemImgUrl = (fundingItemImg.isEmpty()) ? fundingItem.getFundingItemImg() : s3Uploader.upload(fundingItemImg, "images");

String updateFundingItemImgUrl = (fundingItemImg == null) ? fundingItem.getFundingItemImg() : s3Uploader.upload(fundingItemImg, "images");
System.out.println("updateFundingItem^^ updateFundingItemImgUrl" + updateFundingItemImgUrl);
String updateFundingName = (fundingItemName == null) ? fundingItem.getFundingName() : fundingItemName;
System.out.println("updateFundingItem^^ updateFundingName" + updateFundingName);
String updateFundDetail = (fundingItemDetail == null) ? fundingItem.getFundDetail() : fundingItemDetail;
System.out.println("updateFundingItem^^ updateFundDetail" + updateFundDetail);

fundingItem.update(updateFundingItemImgUrl, updateFundingName, updateFundDetail);
}
Expand Down

0 comments on commit 357fead

Please sign in to comment.