Skip to content

Commit

Permalink
⚡ : 프로젝트 수정 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
imenuuu committed Mar 13, 2024
1 parent 79b3873 commit da6c400
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-01-17T19:31:30+0900",
date = "2024-03-13T17:32:00+0900",
comments = "version: 1.5.3.Final, compiler: javac, environment: Java 11.0.19 (Oracle Corporation)"
)
public class AdminNoticeMapperImpl implements AdminNoticeMapper {
Expand Down Expand Up @@ -43,6 +43,23 @@ public Notice toEntityNotice(NoticeUploadReq noticeUploadReq) {
return notice.build();
}

@Override
public NoticeContent toEntityNoticeContent(ContentsList contentsList, Long noticeId) {
if ( contentsList == null && noticeId == null ) {
return null;
}

NoticeContent.NoticeContentBuilder<?, ?> noticeContent = NoticeContent.builder();

if ( contentsList != null ) {
noticeContent.contentsType( contentsList.getContentsType() );
noticeContent.contents( contentsList.getContents() );
}
noticeContent.noticeId( noticeId );

return noticeContent.build();
}

protected NoticeContent contentsListToNoticeContent(ContentsList contentsList) {
if ( contentsList == null ) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,15 @@ public CommonResponse<String> patchActiveProject(@PathVariable Long projectId){
}

@Operation(summary = "ADMIN-03-06💻 프로젝트 글 수정.",description = "프로젝트 글 수정 API 입니다.")
@PatchMapping(value = "/{projectId}", consumes = {"multipart/form-data"}, produces = "application/json")
@RequestMapping(value = "/modify/{projectId}", consumes = {"multipart/form-data"}, method = RequestMethod.POST)
@ApiErrorCodeExample({UserAuthErrorCode.class, ProjectGetErrorCode.class})
public CommonResponse<String> patchProject(@PathVariable Long projectId,
@RequestPart ProjectReq.ModifyProject modifyProject,
@Schema(description = "대표 이미지 파일 변경될 경우") @RequestPart(value = "presentFile", required = false) MultipartFile presentFile,
@Schema(description = "이미지 리스트 추가될 경우")@RequestPart(value = "multipartFiles", required = false) List<MultipartFile> multipartFiles){
@RequestPart(value = "presentFile", required = false) MultipartFile presentFile,
@RequestPart(value = "multipartFiles", required = false) List<MultipartFile> multipartFiles){
projectService.patchProject(projectId, modifyProject, presentFile, multipartFiles);
return CommonResponse.onSuccess("수정 성공");
}

/*
@Operation(summary = "ADMIN-03-07💻 프로젝트 이미지 수정", description = "프로젝트 이미지 수정 API")
@PatchMapping(value = "/img/{projectId}/{projectImgId}", consumes = {"multipart/form-data"}, produces = "application/json")
@ApiErrorCodeExample({UserAuthErrorCode.class, PatchProjectImageErrorCode.class, FileUploadException.class})
public CommonResponse<ProjectRes.PatchProjectImg> modifyProjectImg(@PathVariable Long projectId, @PathVariable Long projectImgId,
@RequestPart("img") MultipartFile multipartFile){
if(multipartFile.isEmpty()) throw new BadRequestException(FILE_UPLOAD_NOT_EMPTY);
ProjectRes.PatchProjectImg patchProjectImg = projectService.modifyProjectImg(projectId, projectImgId, multipartFile);
return CommonResponse.onSuccess(patchProjectImg);
}
*/


}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {

@Bean
public CommonsMultipartResolver multipartResolver() {
return new CommonsMultipartResolver();
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
multipartResolver.setMaxUploadSize(524288000); // 20MB
multipartResolver.setMaxUploadSizePerFile(524288000); // 5MB
return multipartResolver;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ public static class ModifyProject {
@NotNull(message = "기부 프로젝트 종류 날자를 입력해주세요")
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime endDate;
@Enum(message = "DOG, CHILDREN,YOUTH,WOMEN, ELDER, DISABLED, SOCIAL, EARTH, NEIGHBOR, ANIMAL, ENVIRONMENT 중 입력해주세요")
private ProjectKind projectKind;
@Schema(description = "추천 검색어", required = false)
private String searchKeyword;
@Schema(description = "삭제할 이미지 리스트", required = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void patchProject(Long projectId, ProjectReq.ModifyProject modifyProject,
List<MultipartFile> multipartFiles) {
Project project = projectAdaptor.findById(projectId);

project.modifyProject(modifyProject.getProjectName(), modifyProject.getUsages(), modifyProject.getDetail(), modifyProject.getRegularStatus(), modifyProject.getStartDate(), modifyProject.getEndDate(), modifyProject.getProjectKind(), modifyProject.getSearchKeyword());
project.modifyProject(modifyProject.getProjectName(), modifyProject.getUsages(), modifyProject.getDetail(), modifyProject.getRegularStatus(), modifyProject.getStartDate(), modifyProject.getEndDate(), modifyProject.getSearchKeyword());

projectImgService.updateImageLists(project, modifyProject.getDeleteImageList(), presentFile, multipartFiles);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,13 @@ public Project(Long id, String projectName, String usages, List<ProjectImage> pr
this.projectImage = projectImage;
}

public void modifyProject(String projectName, String usages, String detail, RegularStatus regularStatus, LocalDateTime startDate, LocalDateTime endDate, ProjectKind projectKind, String searchKeyword) {
public void modifyProject(String projectName, String usages, String detail, RegularStatus regularStatus, LocalDateTime startDate, LocalDateTime endDate, String searchKeyword) {
this.projectName = projectName;
this.usages = usages;
this.projectExplanation = detail;
this.regularStatus = regularStatus;
this.startedAt = startDate;
this.finishedAt = endDate;
this.projectKind = projectKind;
this.searchKeyword = searchKeyword;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public class AopForPayment {
private final PortOneService portOneService;
private final KeyGenerator keyGenerator;


// @PaymentValidator 어노테이션이 붙은 메소드에서 예외가 발생하면 이 메소드가 호출됩니다.
@AfterThrowing(pointcut = "execution(* *(..)) && @annotation(paymentIntercept)", throwing = "exception")
public void refundOnPaymentFailure(JoinPoint joinPoint, PaymentIntercept paymentIntercept, Throwable exception) {
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Expand All @@ -32,17 +30,12 @@ public void refundOnPaymentFailure(JoinPoint joinPoint, PaymentIntercept payment

String impUid = (String) keyGenerator.getDynamicValue(methodSignature.getParameterNames(), joinPoint.getArgs(), parameter);

log.info("ERROR OCCUR : " + impUid);
log.error("ERROR OCCUR : " + impUid);

try {
if(parameter.contains(CANCEL_IMP_UID)) {
log.info(CANCEL_IMP_UID + " 값 환불");
log.error("에러 발생 환불 IMP_UID : " + impUid);
portOneService.refundPayment(impUid);
}else{
log.info(CANCEL_ORDER_ID + " 값 환불");
log.error("에러 발생 환불 ORDER_ID : " + impUid);
portOneService.refundPaymentOrderId(impUid);
}
portOneService.refundPayment(impUid);
log.error("에러 발생 환불 : " + impUid);
log.error(exception.getMessage());
} catch (Exception e) {
log.error("환불 처리 중 에러 발생 IMP_UID : " + impUid);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.example.matchinfrastructure.pay.portone.service;

import static com.example.matchcommon.constants.MatchStatic.*;

import com.example.matchcommon.properties.PortOneProperties;
import com.siot.IamportRestClient.IamportClient;
import com.siot.IamportRestClient.exception.IamportResponseException;
Expand Down

0 comments on commit da6c400

Please sign in to comment.