Skip to content
Merged

Pjh #160

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 232 additions & 0 deletions API_CHANGES_INDUSTRY_REMOVAL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# API ๋ณ€๊ฒฝ ์‚ฌํ•ญ - industry ํ•„๋“œ ์ œ๊ฑฐ

## ๊ฐœ์š”
`SolutionEntity`์—์„œ `industry` ํ•„๋“œ๋ฅผ ์ œ๊ฑฐํ•จ์— ๋”ฐ๋ผ ๊ด€๋ จ๋œ ๋ชจ๋“  API์˜ Request/Response ๊ตฌ์กฐ๊ฐ€ ๋ณ€๊ฒฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

## ๋ณ€๊ฒฝ๋œ API ๋ชฉ๋ก

### 1. ์†”๋ฃจ์…˜ ์ƒ์„ฑ API
**์—”๋“œํฌ์ธํŠธ**: `POST /api/solution-service/solution`

#### Request ๋ณ€๊ฒฝ ์‚ฌํ•ญ
**SaveSolutionEntityRequest**์—์„œ `industry` ํ•„๋“œ ์ œ๊ฑฐ

**๋ณ€๊ฒฝ ์ „:**
```json
{
"vendorSeq": 1,
"solutionName": "์†”๋ฃจ์…˜๋ช…",
"solutionDetail": "์ƒ์„ธ์„ค๋ช…",
"category": "CATEGORY_NAME",
"industry": "์‚ฐ์—…๋ถ„์•ผ",
"recommendedCompanySize": "ํšŒ์‚ฌ๊ทœ๋ชจ",
"solutionImplementationType": "๊ตฌํ˜„๋ฐฉ์‹",
"amount": 1000000,
"duration": 30,
"solutionEffect": [...],
"keyword": [...]
}
```

**๋ณ€๊ฒฝ ํ›„:**
```json
{
"vendorSeq": 1,
"solutionName": "์†”๋ฃจ์…˜๋ช…",
"solutionDetail": "์ƒ์„ธ์„ค๋ช…",
"category": "CATEGORY_NAME",
"recommendedCompanySize": "ํšŒ์‚ฌ๊ทœ๋ชจ",
"solutionImplementationType": "๊ตฌํ˜„๋ฐฉ์‹",
"amount": 1000000,
"duration": 30,
"solutionEffect": [...],
"keyword": [...]
}
```

**์ œ๊ฑฐ๋œ ํ•„๋“œ:**
- `industry` (String) - ํ•„์ˆ˜ ํ•„๋“œ์˜€์œผ๋‚˜ ์ œ๊ฑฐ๋จ

---

### 2. ์†”๋ฃจ์…˜ ์ˆ˜์ • API
**์—”๋“œํฌ์ธํŠธ**: `PUT /api/solution-service/solution`

#### Request ๋ณ€๊ฒฝ ์‚ฌํ•ญ
**ModifySolutionEntityRequest**์—์„œ `industry` ํ•„๋“œ ์ œ๊ฑฐ

**๋ณ€๊ฒฝ ์ „:**
```json
{
"vendorSeq": 1,
"solutionName": "์†”๋ฃจ์…˜๋ช…",
"solutionDetail": "์ƒ์„ธ์„ค๋ช…",
"prevCategory": "์ด์ „์นดํ…Œ๊ณ ๋ฆฌ",
"nextCategory": "๋ณ€๊ฒฝ์นดํ…Œ๊ณ ๋ฆฌ",
"industry": "์‚ฐ์—…๋ถ„์•ผ",
"recommendedCompanySize": "ํšŒ์‚ฌ๊ทœ๋ชจ",
"solutionImplementationType": "๊ตฌํ˜„๋ฐฉ์‹",
"amount": 1000000,
"duration": 30,
"solutionEffect": [...],
"keyword": [...]
}
```

**๋ณ€๊ฒฝ ํ›„:**
```json
{
"vendorSeq": 1,
"solutionName": "์†”๋ฃจ์…˜๋ช…",
"solutionDetail": "์ƒ์„ธ์„ค๋ช…",
"prevCategory": "์ด์ „์นดํ…Œ๊ณ ๋ฆฌ",
"nextCategory": "๋ณ€๊ฒฝ์นดํ…Œ๊ณ ๋ฆฌ",
"recommendedCompanySize": "ํšŒ์‚ฌ๊ทœ๋ชจ",
"solutionImplementationType": "๊ตฌํ˜„๋ฐฉ์‹",
"amount": 1000000,
"duration": 30,
"solutionEffect": [...],
"keyword": [...]
}
```

**์ œ๊ฑฐ๋œ ํ•„๋“œ:**
- `industry` (String) - ํ•„์ˆ˜ ํ•„๋“œ์˜€์œผ๋‚˜ ์ œ๊ฑฐ๋จ

---

### 3. ์ „์ฒด ์†”๋ฃจ์…˜ ์กฐํšŒ API (ํ•„ํ„ฐ๋ง, ํ‚ค์›Œ๋“œ ๊ฒ€์ƒ‰)
**์—”๋“œํฌ์ธํŠธ**: `GET /api/solution-service/solution/list`

#### Query Parameter ๋ณ€๊ฒฝ ์‚ฌํ•ญ
`industry` ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ ์ œ๊ฑฐ

**๋ณ€๊ฒฝ ์ „:**
```
GET /api/solution-service/solution/list?category=CATEGORY_NAME&industry=์‚ฐ์—…๋ถ„์•ผ&budget=์ „์ฒด&keyword=ํ‚ค์›Œ๋“œ&start=0&end=15
```

**๋ณ€๊ฒฝ ํ›„:**
```
GET /api/solution-service/solution/list?category=CATEGORY_NAME&budget=์ „์ฒด&keyword=ํ‚ค์›Œ๋“œ&start=0&end=15
```

**์ œ๊ฑฐ๋œ ํŒŒ๋ผ๋ฏธํ„ฐ:**
- `industry` (String, optional) - ์‚ฐ์—…๋ถ„์•ผ ํ•„ํ„ฐ๋ง ํŒŒ๋ผ๋ฏธํ„ฐ ์ œ๊ฑฐ

**๋‚จ์•„์žˆ๋Š” ํŒŒ๋ผ๋ฏธํ„ฐ:**
- `category` (String, optional) - ์นดํ…Œ๊ณ ๋ฆฌ ํ•„ํ„ฐ
- `budget` (String, optional, default: "์ „์ฒด") - ์˜ˆ์‚ฐ ํ•„ํ„ฐ
- `keyword` (String, optional) - ํ‚ค์›Œ๋“œ ๊ฒ€์ƒ‰
- `start` (int, default: 0) - ์‹œ์ž‘ ์ธ๋ฑ์Šค
- `end` (int, default: 15) - ์ข…๋ฃŒ ์ธ๋ฑ์Šค

---

### 4. ์†”๋ฃจ์…˜ ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„ ์กฐํšŒ API
**์—”๋“œํฌ์ธํŠธ**: `GET /api/solution-service/solution/category`

#### Response ๋ณ€๊ฒฝ ์‚ฌํ•ญ
**GetSolutionEntityResponse**์—์„œ `industry` ํ•„๋“œ ์ œ๊ฑฐ

**๋ณ€๊ฒฝ ์ „:**
```json
{
"solutionSeq": 1,
"representImageUrl": "์ด๋ฏธ์ง€URL",
"descriptionPdfUrl": "PDFURL",
"solutionName": "์†”๋ฃจ์…˜๋ช…",
"solutionDetail": "์ƒ์„ธ์„ค๋ช…",
"amount": 1000000,
"solutionImplementationType": ["๋ฐฉ์‹1", "๋ฐฉ์‹2"],
"duration": 30,
"industry": ["์‚ฐ์—…1", "์‚ฐ์—…2"],
"recommendedCompanySize": ["๊ทœ๋ชจ1", "๊ทœ๋ชจ2"],
"solutionEffect": [...],
"keywords": [...]
}
```

**๋ณ€๊ฒฝ ํ›„:**
```json
{
"solutionSeq": 1,
"representImageUrl": "์ด๋ฏธ์ง€URL",
"descriptionPdfUrl": "PDFURL",
"solutionName": "์†”๋ฃจ์…˜๋ช…",
"solutionDetail": "์ƒ์„ธ์„ค๋ช…",
"amount": 1000000,
"solutionImplementationType": ["๋ฐฉ์‹1", "๋ฐฉ์‹2"],
"duration": 30,
"recommendedCompanySize": ["๊ทœ๋ชจ1", "๊ทœ๋ชจ2"],
"solutionEffect": [...],
"keywords": [...]
}
```

**์ œ๊ฑฐ๋œ ํ•„๋“œ:**
- `industry` (List<String>) - ์‚ฐ์—…๋ถ„์•ผ ๋ฆฌ์ŠคํŠธ ์ œ๊ฑฐ

---

### 5. ์†”๋ฃจ์…˜ ์กฐํšŒ API
**์—”๋“œํฌ์ธํŠธ**: `GET /api/solution-service/solution?solutionSeq={solutionSeq}`

#### Response ๋ณ€๊ฒฝ ์‚ฌํ•ญ
**GetSolutionEntityResponse**์—์„œ `industry` ํ•„๋“œ ์ œ๊ฑฐ

**๋ณ€๊ฒฝ ์ „:**
```json
{
"solutionSeq": 1,
"representImageUrl": "์ด๋ฏธ์ง€URL",
"descriptionPdfUrl": "PDFURL",
"solutionName": "์†”๋ฃจ์…˜๋ช…",
"solutionDetail": "์ƒ์„ธ์„ค๋ช…",
"amount": 1000000,
"solutionImplementationType": ["๋ฐฉ์‹1", "๋ฐฉ์‹2"],
"duration": 30,
"industry": ["์‚ฐ์—…1", "์‚ฐ์—…2"],
"recommendedCompanySize": ["๊ทœ๋ชจ1", "๊ทœ๋ชจ2"],
"solutionEffect": [...],
"keywords": [...]
}
```

**๋ณ€๊ฒฝ ํ›„:**
```json
{
"solutionSeq": 1,
"representImageUrl": "์ด๋ฏธ์ง€URL",
"descriptionPdfUrl": "PDFURL",
"solutionName": "์†”๋ฃจ์…˜๋ช…",
"solutionDetail": "์ƒ์„ธ์„ค๋ช…",
"amount": 1000000,
"solutionImplementationType": ["๋ฐฉ์‹1", "๋ฐฉ์‹2"],
"duration": 30,
"recommendedCompanySize": ["๊ทœ๋ชจ1", "๊ทœ๋ชจ2"],
"solutionEffect": [...],
"keywords": [...]
}
```

**์ œ๊ฑฐ๋œ ํ•„๋“œ:**
- `industry` (List<String>) - ์‚ฐ์—…๋ถ„์•ผ ๋ฆฌ์ŠคํŠธ ์ œ๊ฑฐ

---

## ์š”์•ฝ

| API | ๋ณ€๊ฒฝ ์œ ํ˜• | ์ œ๊ฑฐ๋œ ํ•ญ๋ชฉ |
|-----|----------|------------|
| POST /api/solution-service/solution | Request | `industry` ํ•„๋“œ |
| PUT /api/solution-service/solution | Request | `industry` ํ•„๋“œ |
| GET /api/solution-service/solution/list | Query Parameter | `industry` ํŒŒ๋ผ๋ฏธํ„ฐ |
| GET /api/solution-service/solution/category | Response | `industry` ํ•„๋“œ |
| GET /api/solution-service/solution | Response | `industry` ํ•„๋“œ |

**์ฃผ์˜์‚ฌํ•ญ:**
- ๋ชจ๋“  `industry` ํ•„๋“œ๋Š” **ํ•„์ˆ˜ ํ•„๋“œ**์˜€์œผ๋‚˜ ์ œ๊ฑฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
- ๊ธฐ์กด ํด๋ผ์ด์–ธํŠธ ์ฝ”๋“œ์—์„œ `industry` ํ•„๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋‹ค๋ฉด ๋ฐ˜๋“œ์‹œ ์ˆ˜์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
- ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์Šคํ‚ค๋งˆ ๋ณ€๊ฒฝ์ด ํ•„์š”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import startwithco.startwithbackend.exception.ServerException;
import startwithco.startwithbackend.payment.payment.domain.PaymentEntity;
import startwithco.startwithbackend.payment.payment.repository.PaymentEntityRepository;
import startwithco.startwithbackend.payment.payment.util.PAYMENT_STATUS;
import startwithco.startwithbackend.admin.settlement.dto.SettlementDto;
import startwithco.startwithbackend.payment.snapshot.entity.TossPaymentDailySnapshotEntity;
import startwithco.startwithbackend.payment.snapshot.repository.TossPaymentDailySnapshotEntityRepository;
Expand Down Expand Up @@ -78,7 +79,7 @@ public void approveSettlement(String orderId) {
getCode("๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", ExceptionType.SERVER)
));

paymentEntity.updateSETTLEDStatus();
paymentEntity.markAsSettled();
paymentEntityRepository.savePaymentEntity(paymentEntity);

tossPaymentDailySnapshotEntity.updateApproveSettlement();
Expand All @@ -100,7 +101,7 @@ public void cancelSettlement(String orderId) {
getCode("๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", ExceptionType.SERVER)
));

paymentEntity.updateCANCELDStatus();
paymentEntity.setPaymentStatus(PAYMENT_STATUS.CANCELED);
paymentEntityRepository.savePaymentEntity(paymentEntity);

tossPaymentDailySnapshotEntity.updateDeleteSettlement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -30,7 +29,6 @@
import startwithco.startwithbackend.exception.code.ExceptionCodeMapper;
import startwithco.startwithbackend.payment.payment.domain.PaymentEntity;
import startwithco.startwithbackend.payment.payment.repository.PaymentEntityRepository;
import startwithco.startwithbackend.payment.paymentEvent.repository.PaymentEventEntityRepository;
import startwithco.startwithbackend.payment.snapshot.entity.TossPaymentDailySnapshotEntity;
import startwithco.startwithbackend.payment.snapshot.repository.TossPaymentDailySnapshotEntityRepository;
import startwithco.startwithbackend.solution.solution.domain.SolutionEntity;
Expand Down Expand Up @@ -352,8 +350,8 @@ public List<Object> getVendorDashboardList(Long vendorSeq, String paymentStatus,
solutionEntity.getSolutionSeq(),
solutionEntity.getSolutionName(),
paymentEntity.getAmount(),
paymentEntity.getAutoConfirmScheduledAt(),
paymentEntity.getAutoConfirmScheduledAt(),
paymentEntity.getDueDate(),
paymentEntity.getPaymentCompletedAt(),
consumerEntity.getConsumerSeq(),
consumerEntity.getConsumerName()
);
Expand All @@ -366,7 +364,7 @@ public List<Object> getVendorDashboardList(Long vendorSeq, String paymentStatus,
solutionEntity.getSolutionSeq(),
solutionEntity.getSolutionName(),
paymentEntity.getAmount(),
paymentEntity.getAutoConfirmScheduledAt(),
paymentEntity.getDueDate(),
tossPaymentDailySnapshotEntity.getSettlementAmount(),
consumerEntity.getConsumerSeq(),
consumerEntity.getConsumerName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
Expand All @@ -28,12 +27,10 @@
import startwithco.startwithbackend.exception.BadRequestException;
import startwithco.startwithbackend.exception.NotFoundException;
import startwithco.startwithbackend.exception.ServerException;
import startwithco.startwithbackend.payment.payment.domain.PaymentEntity;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.TimeUnit;

Expand All @@ -56,9 +53,6 @@ public class CommonService {
@Qualifier("tossPaymentWebClient")
private final WebClient tossPaymentWebClient;

@Qualifier("frontWebClient")
private final WebClient frontWebClient;

private final TemplateEngine templateEngine;

private final JavaMailSender javaMailSender;
Expand Down Expand Up @@ -166,12 +160,17 @@ public Mono<JsonNode> executeTossPaymentApproval(String paymentKey, String order
.doOnError(WebClientResponseException.class, err -> {
String responseBody = err.getResponseBodyAsString();
String errorMessage = "TOSS ๊ฒฐ์ œ ์Šน์ธ ์‹คํŒจ";

log.error("โŒ ํ† ์ŠคํŽ˜์ด๋จผ์ธ  API ์˜ค๋ฅ˜ ์‘๋‹ต: HTTP {}, Body: {}", err.getStatusCode(), responseBody);

try {
JsonNode errorJson = objectMapper.readTree(responseBody);
if (errorJson.has("message")) {
errorMessage = errorJson.get("message").asText();
}
if (errorJson.has("code")) {
log.error("ํ† ์ŠคํŽ˜์ด๋จผ์ธ  ์—๋Ÿฌ ์ฝ”๋“œ: {}", errorJson.get("code").asText());
}
} catch (Exception parseError) {
log.warn("โš ๏ธ Toss ์˜ค๋ฅ˜ ์‘๋‹ต ํŒŒ์‹ฑ ์‹คํŒจ: {}", responseBody);
}
Expand All @@ -182,11 +181,19 @@ public Mono<JsonNode> executeTossPaymentApproval(String paymentKey, String order
getCode(errorMessage, ExceptionType.SERVER)
);
})
.doOnError(err -> {
if (!(err instanceof WebClientResponseException)) {
log.error("โŒ ํ† ์ŠคํŽ˜์ด๋จผ์ธ  API ํ˜ธ์ถœ ์‹คํŒจ: {}", err.getMessage(), err);
}
})
.onErrorResume(err -> {
if (err instanceof ServerException) {
return Mono.error(err);
}
return Mono.error(new ServerException(
HttpStatus.INTERNAL_SERVER_ERROR.value(),
err.getMessage(),
getCode(err.getMessage(), ExceptionType.SERVER)
"ํ† ์ŠคํŽ˜์ด๋จผ์ธ  API ํ˜ธ์ถœ ์‹คํŒจ: " + err.getMessage(),
getCode("ํ† ์ŠคํŽ˜์ด๋จผ์ธ  API ํ˜ธ์ถœ ์‹คํŒจ", ExceptionType.SERVER)
));
});
}
Expand Down Expand Up @@ -242,28 +249,6 @@ public Mono<JsonNode> cancelTossPaymentApproval(String paymentKey, String cancel
});
}

public void notifyFrontOfVirtualAccountStatus(PaymentEntity paymentEntity) {
Map<String, Object> payload = new HashMap<>();
payload.put("paymentSeq", paymentEntity.getPaymentSeq());
payload.put("orderId", paymentEntity.getOrderId());
payload.put("paymentKey", paymentEntity.getPaymentKey());
payload.put("amount", paymentEntity.getAmount());
payload.put("paymentStatus", paymentEntity.getPaymentStatus().name());
payload.put("method", paymentEntity.getMethod() != null ? paymentEntity.getMethod().name() : null);
payload.put("secret", paymentEntity.getSecret());
payload.put("paymentCompletedAt", paymentEntity.getPaymentCompletedAt() != null ? paymentEntity.getPaymentCompletedAt().toString() : null);
payload.put("autoConfirmScheduledAt", paymentEntity.getAutoConfirmScheduledAt() != null ? paymentEntity.getAutoConfirmScheduledAt().toString() : null);
payload.put("dueDate", paymentEntity.getDueDate() != null ? paymentEntity.getDueDate().toString() : null);

frontWebClient.post()
.uri("/api/deposit-webhook")
.bodyValue(payload)
.retrieve()
.toBodilessEntity()
.doOnError(err -> log.error("โŒ ํ”„๋ก ํŠธ ์ „๋‹ฌ ์‹คํŒจ: error={}", err.getMessage()))
.subscribe();
}

public void sendResetLink(String email, String link) {

String subject = "Solu ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ •";
Expand Down
Loading
Loading