Skip to content

Commit

Permalink
Merge pull request #129 from TaetaetaE01/main
Browse files Browse the repository at this point in the history
[refactor] : 패키징 구조 변경(email, dto, entity 등)
  • Loading branch information
TaetaetaE01 authored Oct 3, 2024
2 parents 4feb41f + 41b2326 commit 1aee565
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.bigbrotherbe.domain.event.entity;

import com.example.bigbrotherbe.domain.BaseTimeEntity;
import com.example.bigbrotherbe.global.entity.BaseTimeEntity;
import com.example.bigbrotherbe.global.file.entity.File;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.bigbrotherbe.domain.faq.entity;

import com.example.bigbrotherbe.domain.BaseTimeEntity;
import com.example.bigbrotherbe.global.entity.BaseTimeEntity;
import com.example.bigbrotherbe.global.file.entity.File;
import jakarta.persistence.*;
import lombok.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.bigbrotherbe.domain.meetings.entity;

import com.example.bigbrotherbe.domain.BaseTimeEntity;
import com.example.bigbrotherbe.global.entity.BaseTimeEntity;
import com.example.bigbrotherbe.global.file.entity.File;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import com.example.bigbrotherbe.domain.member.dto.response.MemberInfoResponse;
import com.example.bigbrotherbe.domain.member.dto.response.MemberResponse;
import com.example.bigbrotherbe.domain.member.dto.AffiliationListDto;
import com.example.bigbrotherbe.global.email.entity.EmailRequest;
import com.example.bigbrotherbe.global.email.entity.EmailVerificationResult;
import com.example.bigbrotherbe.global.email.dto.EmailRequest;
import com.example.bigbrotherbe.global.email.dto.EmailVerificationResult;
import com.example.bigbrotherbe.global.auth.jwt.dto.response.JwtToken;
import com.example.bigbrotherbe.global.auth.jwt.dto.TokenDto;
import com.example.bigbrotherbe.global.common.config.SecurityConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.example.bigbrotherbe.domain.member.dto.response.MemberInfoResponse;
import com.example.bigbrotherbe.domain.member.dto.response.MemberResponse;
import com.example.bigbrotherbe.domain.member.dto.AffiliationListDto;
import com.example.bigbrotherbe.global.email.entity.EmailRequest;
import com.example.bigbrotherbe.global.email.entity.EmailVerificationResult;
import com.example.bigbrotherbe.global.email.dto.EmailRequest;
import com.example.bigbrotherbe.global.email.dto.EmailVerificationResult;
import com.example.bigbrotherbe.global.email.component.MailService;
import com.example.bigbrotherbe.global.common.exception.response.ApiResponse;
import com.example.bigbrotherbe.global.auth.jwt.dto.response.JwtToken;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.bigbrotherbe.domain.notice.entity;

import com.example.bigbrotherbe.domain.BaseTimeEntity;
import com.example.bigbrotherbe.global.entity.BaseTimeEntity;
import com.example.bigbrotherbe.global.file.entity.File;
import jakarta.persistence.*;
import lombok.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.bigbrotherbe.domain.rule.entity;

import com.example.bigbrotherbe.domain.BaseTimeEntity;
import com.example.bigbrotherbe.global.entity.BaseTimeEntity;
import com.example.bigbrotherbe.global.file.entity.File;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.bigbrotherbe.domain.transactions.entity;

import com.example.bigbrotherbe.domain.BaseTimeEntity;
import com.example.bigbrotherbe.global.entity.BaseTimeEntity;

import com.example.bigbrotherbe.global.file.entity.File;
import jakarta.persistence.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.example.bigbrotherbe.global.file.enums.FileType;
import com.example.bigbrotherbe.global.file.service.FileService;
import com.example.bigbrotherbe.global.auth.util.AuthUtil;
import com.example.bigbrotherbe.global.ocr.dto.OcrDTO;
import com.example.bigbrotherbe.global.ocr.dto.OcrDto;
import com.example.bigbrotherbe.global.ocr.service.OcrService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -54,7 +54,7 @@ public void register(MultipartFile multipartFile, Long affiliationId) {
throw new BusinessException(NOT_COUNCIL_MEMBER);
}

OcrDTO ocrDTO = ocrService.extractText(multipartFile);
OcrDto ocrDTO = ocrService.extractText(multipartFile);

List<String[]> parseTransactions = ocrDTO.getParseTransactions();
String parseAccountNumber = ocrDTO.getParseAccountNumber();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.bigbrotherbe.global.email;
package com.example.bigbrotherbe.global.common.config;

import java.util.Properties;
import org.springframework.beans.factory.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import com.example.bigbrotherbe.domain.member.component.MemberLoader;
import com.example.bigbrotherbe.global.email.entity.EmailVerificationResult;
import com.example.bigbrotherbe.global.email.dto.EmailVerificationResult;
import com.example.bigbrotherbe.global.common.exception.BusinessException;
import com.example.bigbrotherbe.global.common.exception.enums.ErrorCode;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.example.bigbrotherbe.domain.member.entity.EMailVerification;
import com.example.bigbrotherbe.domain.member.repository.MailRepository;
import com.example.bigbrotherbe.global.email.entity.Email;
import com.example.bigbrotherbe.global.email.entity.EmailVerificationResult;
import com.example.bigbrotherbe.global.email.dto.EmailVerificationResult;
import com.example.bigbrotherbe.global.common.exception.BusinessException;
import com.example.bigbrotherbe.global.common.exception.enums.ErrorCode;
import java.time.Duration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.bigbrotherbe.global.email.entity;
package com.example.bigbrotherbe.global.email.dto;

import lombok.Getter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.bigbrotherbe.global.email.entity;
package com.example.bigbrotherbe.global.email.dto;


import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.bigbrotherbe.domain;
package com.example.bigbrotherbe.global.entity;

import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.bigbrotherbe.global.file.entity;

import com.example.bigbrotherbe.domain.BaseTimeEntity;
import com.example.bigbrotherbe.global.entity.BaseTimeEntity;
import com.example.bigbrotherbe.domain.campusNotice.entity.CampusNotice;
import com.example.bigbrotherbe.domain.event.entity.Event;
import com.example.bigbrotherbe.domain.faq.entity.FAQ;
Expand All @@ -10,7 +10,6 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.*;
import org.checkerframework.checker.units.qual.A;

@Entity
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
@Getter
@Builder
@AllArgsConstructor
public class OcrDTO {
public class OcrDto {
private List<String[]> parseTransactions;
private String parseAccountNumber;

public static OcrDTO fromOcrResponse(List<String[]> parseTransactions, String parseAccountNumber) {
return OcrDTO.builder()
public static OcrDto fromOcrResponse(List<String[]> parseTransactions, String parseAccountNumber) {
return OcrDto.builder()
.parseTransactions(parseTransactions)
.parseAccountNumber(parseAccountNumber)
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.example.bigbrotherbe.global.ocr.service;

import com.example.bigbrotherbe.global.ocr.dto.OcrDTO;
import com.example.bigbrotherbe.global.ocr.dto.OcrDto;
import org.springframework.web.multipart.MultipartFile;

public interface OcrService {
OcrDTO extractText(MultipartFile multipartFile);
OcrDto extractText(MultipartFile multipartFile);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.bigbrotherbe.global.ocr.service;

import com.example.bigbrotherbe.global.ocr.dto.OcrDTO;
import com.example.bigbrotherbe.global.ocr.dto.OcrDto;
import com.example.bigbrotherbe.global.ocr.util.OcrUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand All @@ -15,14 +15,14 @@ public class OcrServiceImpl implements OcrService {
private final OcrUtil ocrUtil;

@Override
public OcrDTO extractText(MultipartFile multipartFile) {
public OcrDto extractText(MultipartFile multipartFile) {
// ocr로 모든 text 추출한 거
String extractedText = ocrUtil.extractTextFromPDF(multipartFile);

List<String[]> parseTransactions = ocrUtil.parseTransactions(extractedText);
String parseAccountNumber = ocrUtil.parseAccountNumber(extractedText);

// parsing 가공해서 응답
return OcrDTO.fromOcrResponse(parseTransactions, parseAccountNumber);
return OcrDto.fromOcrResponse(parseTransactions, parseAccountNumber);
}
}

0 comments on commit 1aee565

Please sign in to comment.