Merge branch 'susu' into dev

This commit is contained in:
주수현
2025-06-26 15:55:38 +09:00
53 changed files with 466 additions and 213 deletions

View File

@@ -1,8 +1,8 @@
package app.module.admin.config.application.security;
import app.module.admin.usecase.loggedinuser.save.ports.LoggedInUserSavePortIn;
import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserIdSaveCmd;
import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd;
import app.module.core.usecase.loggedinuser.save.ports.LoggedInUserSavePortIn;
import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserIdSaveCmd;
import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd;
import app.module.core.config.application.enums.AppType;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.config.application.util.MessageUtil;

View File

@@ -27,10 +27,7 @@ import java.util.stream.Collectors;
class AdminUpdatePostController {
private final AdminUpdateValidator adminUpdateValidator;
private final RoleListPortIn roleListPortIn;
private final UICodeListPortIn uiCodeListPortIn;
private final SaveAdminPortIn saveAdminPortIn;
private final MessageUtil messageUtil;
@PostMapping(path = "/api/settings/admin/update")
ResponseEntity<?> operate( @RequestBody AdminUpdateBindingVO bindingVO, BindingResult bindingResult) {

View File

@@ -40,7 +40,7 @@ class CreateNoticeDao implements CreateNoticePortOut {
mapper.createNotice(dto);
if (dto.getFileMappingId() != null && !dto.getFileMappingId().isEmpty()) {
mapper.createNoticeHasUploadFile(new CreateNoticeHasUploadFilesParam(
mapper.createNoticeUploadFile(new CreateNoticeHasUploadFilesParam(
dto.getId(),
dto.getFileMappingId().stream()
.map(Long::parseLong)

View File

@@ -7,5 +7,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CreateNoticeMapper {
void createNotice(CreateNoticeDto dto);
void createNoticeHasUploadFile(CreateNoticeHasUploadFilesParam param);
void createNoticeUploadFile(CreateNoticeHasUploadFilesParam param);
}

View File

@@ -4,8 +4,10 @@ import app.module.admin.usecase.communication.notice.getNotice.ports.GetNoticePo
import app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNotice;
import app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNoticeCmd;
import app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNoticeUploadFile;
import app.module.core.config.application.enums.FileStorageType;
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@@ -19,6 +21,8 @@ class GetNoticeDao implements GetNoticePortOut {
private final GetNoticeMapper mapper;
private final FileUrlPortIn fileUrlPortIn;
@Value("${path.upload.storage}")
private String uploadStorageType;
@Override
@Transactional
@@ -35,13 +39,13 @@ class GetNoticeDao implements GetNoticePortOut {
// 참조 URL 전달
uploadFile.setReferURL(
fileUrlPortIn.getInline(
uploadFile.getType().getFileStorageType(),
FileStorageType.valueOf(uploadStorageType),
uploadFile.getPath(),
uploadFile.getName()));
// attachment URL 전달
uploadFile.setAttachmentURL(
fileUrlPortIn.getAttachment(
uploadFile.getType().getFileStorageType(), uploadFile.getId()));
FileStorageType.valueOf(uploadStorageType), uploadFile.getId()));
return uploadFile;
})

View File

@@ -20,7 +20,7 @@ class RemoveNoticesDao implements RemoveNoticesPortOut {
String loginUser = CommonUtil.getLoginUsername();;
LocalDateTime now = LocalDateTime.now();
mapper.deleteNoticeHasFiles(
mapper.deleteNoticeUploadFiles(
new RemoveNoticesParam(command.getRemoveIds(), now, loginUser, now, loginUser));
mapper.deleteNotices(
new RemoveNoticesParam(command.getRemoveIds(), now, loginUser, now, loginUser));

View File

@@ -6,5 +6,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface RemoveNoticesMapper {
void deleteNotices(RemoveNoticesParam param);
void deleteNoticeHasFiles(RemoveNoticesParam param);
void deleteNoticeUploadFiles(RemoveNoticesParam param);
}

View File

@@ -1,27 +1,27 @@
package app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence;
import app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence.model.CreateUploadFileParam;
import app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence.model.UpdateNoticeDto;
import app.module.admin.usecase.communication.notice.updateNotice.ports.UpdateNoticePortOut;
import app.module.admin.usecase.communication.notice.updateNotice.ports.application.domain.UpdateNoticeCmd;
import app.module.core.config.adapters.persistence.entity.NoticeHasUploadFile;
import app.module.core.config.application.annotation.UpdateCommand;
import app.module.core.config.application.util.CommonUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
@Slf4j
@Repository
@RequiredArgsConstructor
class UpdateNoticeDao implements UpdateNoticePortOut {
private final UpdateNoticeMapper mapper;
@Override
@UpdateCommand
public void operate(UpdateNoticeCmd command) {
mapper.updateNotice(
new UpdateNoticeDto(
command.getId(),
command.getTitle(),
@@ -34,21 +34,5 @@ class UpdateNoticeDao implements UpdateNoticePortOut {
CommonUtil.getLoginUsername()
));
// 첨부파일 초기화
mapper.deleteFileUploads(new NoticeHasUploadFile(command.getId()));
// 첨부파일 있을 시, 등록
if (command.getFileMappingId() != null && !command.getFileMappingId().isEmpty()) {
mapper.createFileUploads(new CreateUploadFileParam(
command.getId(),
command.getFileMappingId().stream()
.map(Long::parseLong)
.toList(),
LocalDateTime.now(),
CommonUtil.getLoginUsername(),
LocalDateTime.now(),
CommonUtil.getLoginUsername()
));
}
}
}

View File

@@ -1,14 +1,9 @@
package app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence;
import app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence.model.CreateUploadFileParam;
import app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence.model.UpdateNoticeDto;
import app.module.core.config.adapters.persistence.entity.ArticleHasUploadFile;
import app.module.core.config.adapters.persistence.entity.NoticeHasUploadFile;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UpdateNoticeMapper {
void updateNotice(UpdateNoticeDto dto);
void deleteFileUploads(NoticeHasUploadFile noticeHasUploadFile);
void createFileUploads(CreateUploadFileParam param);
}

View File

@@ -1,18 +0,0 @@
package app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@AllArgsConstructor
public class CreateUploadFileParam {
private Long id;
private List<Long> fileMappingId;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
}

View File

@@ -3,6 +3,9 @@ package app.module.admin.usecase.communication.notice.updateNotice.adapters.web;
import app.module.admin.usecase.communication.notice.updateNotice.adapters.web.model.UpdateNoticeReqVO;
import app.module.admin.usecase.communication.notice.updateNotice.ports.UpdateNoticePortIn;
import app.module.admin.usecase.communication.notice.updateNotice.ports.application.domain.UpdateNoticeCmd;
import app.module.core.config.application.enums.FileUploadType;
import app.module.core.usecase.file.updateFile.ports.UpdateFilePortIn;
import app.module.core.usecase.file.updateFile.ports.application.domain.UpdateFileCmd;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
@@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequiredArgsConstructor
class UpdateNoticeController {
private final UpdateNoticePortIn updateNoticePortIn;
private final UpdateFilePortIn updateFilePortIn;
@PutMapping(path = "/api/communication/notices/update")
ResponseEntity<?> operate(@RequestBody @Valid UpdateNoticeReqVO reqVO, BindingResult bindingResult) {
@@ -26,6 +30,13 @@ class UpdateNoticeController {
.body(bindingResult.getFieldErrors());
}
updateFilePortIn.operate(
new UpdateFileCmd(
reqVO.getId(),
reqVO.getFileMappingId().stream().map(Long::parseLong).toList(),
FileUploadType.NOTICE)
);
updateNoticePortIn.operate(
new UpdateNoticeCmd(
reqVO.getId(),
@@ -34,8 +45,8 @@ class UpdateNoticeController {
reqVO.getVisible(),
reqVO.getStartDate(),
reqVO.getEndDate(),
reqVO.getFileMappingId()
));
reqVO.getFileMappingId())
);
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
}

View File

@@ -1,11 +1,13 @@
package app.module.admin.usecase.editor.adapters.web;
import app.module.core.config.application.enums.FileStorageType;
import app.module.core.config.application.enums.FileUploadType;
import app.module.core.usecase.file.saveToStorage.ports.SaveToStoragePortIn;
import app.module.core.usecase.file.saveToStorage.ports.application.domain.SaveToStorage;
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
import java.io.IOException;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
@@ -18,6 +20,8 @@ public class EditorImageUploadController {
private final SaveToStoragePortIn saveToStoragePortIn;
private final FileUrlPortIn fileUrlPortIn;
@Value("${path.upload.storage}")
private String uploadStorageType;
@PostMapping(path = "/api/editorImage/upload")
ResponseEntity<?> editorImageUpload(MultipartFile editorImage) throws IOException {
@@ -27,7 +31,7 @@ public class EditorImageUploadController {
return ResponseEntity.status(HttpStatus.OK)
.body(
fileUrlPortIn.getInline(
saveToStorage.getType().getFileStorageType(),
FileStorageType.valueOf(uploadStorageType),
saveToStorage.getPath(),
saveToStorage.getName()));
}

View File

@@ -1,27 +0,0 @@
package app.module.admin.usecase.loggedinuser.save.adapter.persistence;
import app.module.admin.usecase.loggedinuser.save.ports.LoggedInUserSavePortOut;
import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd;
import app.module.core.config.adapters.persistence.entity.LoggedInUser;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
@Repository
@RequiredArgsConstructor
public class LoggedInUserSaveDao implements LoggedInUserSavePortOut {
private final LoggedInUserSaveMapper mapper;
@Override
public void connect(LoggedInUserSaveCmd saveCommand) {
LoggedInUser loggedInUser = new LoggedInUser(
saveCommand.getLoggedInUserId().getAppType(),
saveCommand.getLoggedInUserId().getId(),
saveCommand.getClientIP(),
saveCommand.getLastLoggedInAt()
);
mapper.insert(loggedInUser);
}
}

View File

@@ -1,10 +0,0 @@
package app.module.admin.usecase.loggedinuser.save.adapter.persistence;
import app.module.core.config.adapters.persistence.entity.LoggedInUser;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface LoggedInUserSaveMapper {
void insert(LoggedInUser loggedInUser);
void update(LoggedInUser loggedInUser);
}

View File

@@ -1,8 +0,0 @@
package app.module.admin.usecase.loggedinuser.save.ports;
import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd;
public interface LoggedInUserSavePortIn {
void connect(LoggedInUserSaveCmd loggedInUserSaveCmd);
}

View File

@@ -1,8 +0,0 @@
package app.module.admin.usecase.loggedinuser.save.ports;
import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd;
public interface LoggedInUserSavePortOut {
void connect(LoggedInUserSaveCmd loggedInUser);
}

View File

@@ -1,19 +0,0 @@
package app.module.admin.usecase.loggedinuser.save.ports.application;
import app.module.admin.usecase.loggedinuser.save.ports.LoggedInUserSavePortIn;
import app.module.admin.usecase.loggedinuser.save.ports.LoggedInUserSavePortOut;
import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class LoggedInUserSaveService implements LoggedInUserSavePortIn {
private final LoggedInUserSavePortOut portOut;
@Override
public void connect(LoggedInUserSaveCmd loggedInUserSaveCmd) {
portOut.connect(loggedInUserSaveCmd);
}
}

View File

@@ -1,19 +0,0 @@
package app.module.admin.usecase.loggedinuser.save.ports.application.domain;
import app.module.core.config.application.enums.AppType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class LoggedInUserIdSaveCmd {
private AppType appType;
private String id;
}

View File

@@ -1,19 +0,0 @@
package app.module.admin.usecase.loggedinuser.save.ports.application.domain;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Builder
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class LoggedInUserSaveCmd {
private LoggedInUserIdSaveCmd loggedInUserId;
private String clientIP;
private LocalDateTime lastLoggedInAt;
}

View File

@@ -5,13 +5,14 @@ import app.module.core.config.adapters.persistence.component.AuditCommand;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Getter
@Setter
public class ResearchersVisitDetailReqVO {
private String id;
private String visitDate;
public class ResearchersVisitDetailReqVO extends AuditCommand {
private Integer id;
private LocalDate visitDate;
private ManagementType managementType;
private String content;
private String isGiftSent;