Compare commits
99 Commits
15db53fe9d
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| ad6a302867 | |||
| 548dca52c3 | |||
| 86e4a02759 | |||
| 5f11e3184e | |||
| 3197c4e16f | |||
| ab0eed8587 | |||
| c4ef361c3d | |||
| b15035cb32 | |||
| 88e0ddc274 | |||
| cdb63683d8 | |||
| d5be6c9b8f | |||
| 774c02f258 | |||
| ab5e2f2b8e | |||
| 9b0d3ad5c2 | |||
| fe7c1b0e75 | |||
| fc62f9cb38 | |||
| 05b1aca898 | |||
| 2399b6f352 | |||
| 645cc71192 | |||
| 70ddcdd9c3 | |||
| 64d830fe67 | |||
| 8f9dda7be1 | |||
| 2dbe803972 | |||
| a1e84b2f51 | |||
| f649282d2d | |||
| dd16d8fb05 | |||
| 3d1489c5d5 | |||
| a1a9a08121 | |||
| cb60d04da2 | |||
| 27442b2fc0 | |||
| 6f963c0f5e | |||
| 5439374711 | |||
| 074ef5fdec | |||
| 3c8710f08c | |||
| a1af5e617c | |||
| 3cb37c6a6a | |||
| 372b420f2d | |||
| bdff1bf720 | |||
| a13007e314 | |||
| 2b53990a07 | |||
| 34f0f15499 | |||
| 1eda40ca7a | |||
| c48e1e6ab5 | |||
| 1ab7a65939 | |||
| 32c8761461 | |||
| 006c9d5aa7 | |||
| 64929eadbd | |||
| 02551fdc6a | |||
| 668c5db42b | |||
| 15e8bcede8 | |||
| ccfc0f1cc8 | |||
| 83b3925467 | |||
| a3da353878 | |||
| b171ffd807 | |||
| c1c7698cbb | |||
| 69e9ebf53d | |||
| 8abba997dd | |||
| 0106b641cf | |||
| b30f7604bf | |||
| 3b95701ed1 | |||
| bf448d57f4 | |||
| 9e0ab9fae6 | |||
| 5f525f6e6b | |||
| 3ca4f72cfa | |||
| de70552001 | |||
| 17f69cf0fe | |||
| 969c21b9a5 | |||
| 11c80579e5 | |||
| c9980cc50e | |||
| f5b52b9372 | |||
| fd9438d619 | |||
| 18f42133d9 | |||
| daa83ff4c9 | |||
| d975f8ad1f | |||
| d0d0410f99 | |||
| de7c09ac33 | |||
| d35c79217b | |||
| e785be94b4 | |||
| 8b0bda7a3f | |||
| d17922f137 | |||
| 7390005f75 | |||
| 0106981e7b | |||
| 62eebe8a00 | |||
| 7df341622e | |||
| d087ec79b3 | |||
| 6a72470a3c | |||
| 1fb0912010 | |||
| f7c905f9ff | |||
| 5080b79d40 | |||
| 2abd3d8531 | |||
| fd6ca277f3 | |||
| aa7d6e4da1 | |||
| fa5d8ac1d4 | |||
| e934302f42 | |||
| 3b62f51a4e | |||
| 91c14eff8c | |||
| a44ade105d | |||
| 82efee2b1f | |||
| ff465ec7d6 |
14
.agent-harness/references/kri-common/crypto-contract.md
Normal file
14
.agent-harness/references/kri-common/crypto-contract.md
Normal file
@@ -0,0 +1,14 @@
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Contract: kri-common
|
||||
Source: .agent/consumer-references/crypto-contract.md
|
||||
-->
|
||||
|
||||
# KriCommon Crypto Contract
|
||||
|
||||
- Crypto APIs are under `com.kri.common.feature.crypto.*` and do not use a central key database.
|
||||
- AES uses PBKDF2-HMAC-SHA256 key derivation with salt and defaults to AES-256-GCM; callers may supply a master key, salt, IV, AAD, and detached or appended GCM tag representation for legacy interoperability.
|
||||
- `kri.crypto.aes.keys` and per-call master keys are supported operational compromises. Never log them or commit real values.
|
||||
- Per-call key material takes precedence over configured keys, and encrypted values retain key ID and KDF metadata for decryption compatibility.
|
||||
- AES-GCM always requires its authentication tag. Use `AES_256_CBC_PKCS5` only for explicitly identified legacy data that has no tag, and do not treat CBC as authenticated encryption.
|
||||
- `DigestService` supports SHA-256/SHA-512 plus legacy-only MD5/SHA-1. `AdaptiveHashService` uses BCrypt for short secrets; do not use MD5, SHA-1, or a fast digest for new password or secret storage.
|
||||
@@ -0,0 +1,34 @@
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Contract: kri-common
|
||||
Source: .agent/consumer-references/platform-capabilities.md
|
||||
-->
|
||||
|
||||
# KriCommon Platform Capabilities
|
||||
|
||||
## Dependency and Configuration Boundary
|
||||
|
||||
- Include the matching Spring starter for any optional Web, Security, JPA, Redis, AOP, or Swagger integration the service enables; KriCommon intentionally declares many integrations as compile-only.
|
||||
- KriCommon configuration uses only `kri.*`. Established groups include `kri.auth.jwt`, `kri.auth.apikey`, `kri.crypto`, `kri.security`, `kri.swagger`, `kri.web`, `kri.web.mdc`, `kri.http.bypass`, `kri.redis`, `kri.scheduling`, and `kri.error.expose`.
|
||||
- Read the version-matched README and configuration-property classes before setting a property; do not infer a property name or default from an older service.
|
||||
- Supply production JWT secrets, API keys, credentials, allowlists, and service URLs through the consumer's approved secret and configuration system. Never rely on library example or default secrets in production.
|
||||
- Preserve consumer override points. KriCommon's default security chain is created only when the consumer does not provide one, and overridable beans should remain explicit.
|
||||
- Adding a path to API-key allowed paths scopes where API-key authentication is attempted; it does not make the path public or grant authorization.
|
||||
|
||||
## Optional Capabilities
|
||||
|
||||
- JWT and API-key authentication integrate with Spring Security. API-key JPA preload requires Spring Data JPA; a consumer-provided claims provider can be used without JPA.
|
||||
- Common Web may register error handling, tracing/MDC, request-user resolution, enum conversion, and CORS behavior. Check for overlap before defining consumer-local equivalents.
|
||||
- Swagger support requires springdoc and defines the shared Bearer/API-key schemes and grouped paths.
|
||||
- Redis and scheduling are opt-in through their `kri.*.enabled` settings and matching runtime dependencies.
|
||||
- HTTP bypass targets are server-configured. Never accept an arbitrary full target URL from a frontend; retain allowed-path checks and do not forward hop-by-hop headers.
|
||||
- The external API client returns response bodies as documented, while bypass responses preserve raw bytes and target `Content-Type`.
|
||||
- Bypass filters all HTTP/2 pseudo headers (names starting with `:`) in addition to existing hop-by-hop headers; use the response status accessor instead of forwarding `:status`.
|
||||
- `kri.http.bypass.targets.<target>.throw-on-error` defaults to `false`. When enabled, the final response after response customizers throws public `com.kri.common.feature.http.ExternalApiResponseException` for non-2xx status; existing targets retain response-return behavior by default.
|
||||
- `BypassResponse.requireSuccess()` and `ExternalApiResponse.requireSuccess()` explicitly enforce the same non-2xx guard. `ExternalApiClient` keeps its existing default behavior and decoded `getBody()` API, and `getBodyBytes()` exposes a defensive copy of the original received bytes, including compressed and binary error bodies.
|
||||
- A response customizer's `ExternalApiResponseException`, including one thrown by `requireSuccess()`, propagates unchanged; other customizer failures keep the existing `BYPASS_RESPONSE_CUSTOMIZE_FAILED` behavior. Response charset parsing ignores charset-like text inside other quoted `Content-Type` parameters and retains the UTF-8 fallback.
|
||||
- With Spring MVC and Servlet API present and `kri.web.enabled=true` (default), `ExternalApiErrorAutoConfiguration` registers a handler for this dedicated exception before the general error advice. It relays the original status, body bytes, `Content-Type`, and `Content-Encoding`, including empty bodies; authentication, cookie, and transport headers are not relayed by the error handler. Enable this policy only for targets whose raw errors may be exposed to clients. Connection failures remain distinct from upstream HTTP errors.
|
||||
- A consumer-provided error handler bean named `externalApiResponseAdvice` replaces the default without importing runtime types; explicitly caught/controller-handled exceptions also remain under the consumer's control.
|
||||
- `ExternalApiClient` multipart requests generate their own boundary and ignore a caller-supplied `Content-Type`. Multipart headers and `formField` values use UTF-8, while file bodies preserve the supplied bytes.
|
||||
- Multipart filenames, including non-ASCII names, are sent unchanged in the quoted `filename` parameter as raw UTF-8. No ASCII fallback or `filename*` parameter is added; CR/LF rejection and quote/backslash escaping still apply.
|
||||
- `JsonUtil` requires the consumer's explicit `ObjectMapper`; shared date/time helpers define KST as `Asia/Seoul` and also expose UTC semantics.
|
||||
@@ -0,0 +1,13 @@
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Contract: kri-common
|
||||
Source: .agent/consumer-references/upgrade-and-verification.md
|
||||
-->
|
||||
|
||||
# KriCommon Upgrade and Verification
|
||||
|
||||
- Review KriCommon release notes, README changes, configuration defaults, auto-configuration conditions, and affected public APIs before upgrading.
|
||||
- Commit dependency-lock or resolved-version changes according to the consumer repository's policy.
|
||||
- Run the consumer's focused compile and tests after an upgrade, including application-context startup tests when auto-configuration or security behavior is affected.
|
||||
- Keep `.agent/project.md` near 2-3 KiB as a routing document. Do not delete material rules to meet the budget; move conditional schema, query, API, and migration details to routed `.agent/references/` documents.
|
||||
- Do not modify KriCommon or another consumer repository unless it is explicitly included in the approved task scope.
|
||||
21
.agent/profile.yml
Normal file
21
.agent/profile.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
schema_version: 1
|
||||
|
||||
project:
|
||||
id: kri-contact-server
|
||||
name: KriContact Server
|
||||
type: internal-service
|
||||
layer: backend
|
||||
legacy: false
|
||||
|
||||
stack:
|
||||
- java-springboot
|
||||
|
||||
shared_contracts:
|
||||
consumes:
|
||||
- kri-common
|
||||
|
||||
databases:
|
||||
- id: contact
|
||||
engine: mysql
|
||||
role: primary-application-data
|
||||
access: read-write
|
||||
18
.agent/project.md
Normal file
18
.agent/project.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# KriContact Server Project Instruction Router
|
||||
|
||||
## Required Project References
|
||||
|
||||
Before each related task, read the current contents of every matching reference below, even if it was read earlier in the session.
|
||||
|
||||
| Task scope | Required reference |
|
||||
|---|---|
|
||||
| Any substantive analysis, planning, implementation, debugging, review, or documentation work in this repository | `.agent/references/repository-rules.md` |
|
||||
|
||||
If a task spans multiple scopes, read every matching reference. Do not assume remembered content is current.
|
||||
|
||||
## Harness Workflow
|
||||
|
||||
- `AGENTS.md` and `CLAUDE.md` are generated outputs. Never edit them directly.
|
||||
- Edit `.agent/project.md` only when routing changes. Store durable project detail in `.agent/references/`.
|
||||
- A reference-only content change does not require recomposition when its route is unchanged. Run harness verification to validate routing and UTF-8.
|
||||
- Recompose and verify after changing `.agent/project.md`, `.agent/profile.yml`, or another composed instruction source.
|
||||
30
.agent/references/repository-rules.md
Normal file
30
.agent/references/repository-rules.md
Normal file
@@ -0,0 +1,30 @@
|
||||
## KriContact Server Repository Rules
|
||||
|
||||
### Product Purpose and Current Phase
|
||||
|
||||
- This is the pre-launch Java 17 and Spring Boot backend for KRI contact operations. Preserve established API and data behavior except where the user explicitly approves a contract change.
|
||||
- The domain includes projects, contact lists and headers/items, uploads and downloads, assignments, call sessions, call/event/update histories, progress, scenarios and images, result codes, users, companies, roles, message templates, reservations, SMS, and email workflows.
|
||||
- Prefer domain correctness, operational safety, and backward-compatible evolution over broad refactoring.
|
||||
|
||||
### Domain Invariants and API Compatibility
|
||||
|
||||
- Preserve company, project, role, and user authorization boundaries for every query and mutation.
|
||||
- Treat list schemas, uploaded columns, item values, filtering, reset/update operations, assignments, and all history records as one coordinated consistency boundary.
|
||||
- Make call start, close, and hang-up state transitions explicit and idempotent where retries or duplicate requests are possible.
|
||||
- Preserve external-list endpoint request, response, authentication, error, and pagination behavior as a consumer contract.
|
||||
- Validate file names, paths, sizes, content handling, storage lifecycle, and cleanup scheduling at boundaries. Do not expose server paths or retain files beyond the approved lifecycle.
|
||||
- Do not send real SMS or email, initiate real calls, or invoke production business integrations during development or validation.
|
||||
|
||||
### Shared Library and Integrations
|
||||
|
||||
- Consume `com.kri.common:starter:beta.1.7.0`. Do not change this approved version or duplicate an available KriCommon feature without separate explicit approval.
|
||||
- Import public KriCommon APIs from `com.kri.common.feature.*` and keep application code out of KriCommon runtime internals.
|
||||
- Treat IntranetExtension, NotiHub, ShortUrl, CTI, file storage, and other external dependencies as explicit boundaries with validated inputs, timeouts, error mapping, retry/idempotency decisions, and safe rollback behavior.
|
||||
- Never log API keys, credentials, full message bodies, telephone numbers in bulk, uploaded list contents, or unrestricted personal information.
|
||||
|
||||
### Persistence and Verification
|
||||
|
||||
- Preserve MySQL transaction boundaries, QueryDSL/JPA ownership, locking, ordering, null, date/time, and generated-key behavior.
|
||||
- Do not edit generated QueryDSL sources directly. Change source entities and regenerate only through the repository workflow when required.
|
||||
- `AGENTS.md` and `CLAUDE.md` are generated. Edit `.agent/profile.yml` or `.agent/project.md`, then recompose instead of editing generated files.
|
||||
- Use the Gradle Wrapper and run the narrowest safe compile and focused tests. Do not start the service, connect to a real database, or call external integrations without separate approval.
|
||||
41
.agents/skills/attention-aware-communication/SKILL.md
Normal file
41
.agents/skills/attention-aware-communication/SKILL.md
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
name: attention-aware-communication
|
||||
description: Shape substantive answers, progress updates, and completion reports for fast, accurate reading without reducing the underlying work.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/attention-aware-communication/SKILL.md
|
||||
-->
|
||||
# Attention-Aware Communication
|
||||
|
||||
This skill changes presentation only. Investigate, implement, and verify as deeply as the task requires.
|
||||
|
||||
## Default: Attention-kind
|
||||
|
||||
- Put the bottom line in the first sentence and use plain Korean.
|
||||
- Say the least that fully answers, then stop. Remove preambles, padding, repetition, and closing restatements.
|
||||
- Never omit a number, scope condition, risk, prerequisite, uncertainty, or other fact that could cause the user to act incorrectly.
|
||||
- For genuine breadth, explain the one or two most important points first, name the remaining areas, and let the user choose whether to expand them. Do not use this to defer required caveats or a complete focused answer.
|
||||
- When the user asks for a detailed explanation, walkthrough, rationale, or full picture, suspend brevity and provide the necessary detail in scannable sections.
|
||||
- When asked for a deliverable such as a command, message, snippet, or commit text, return the deliverable without unnecessary framing unless safety or correctness requires context.
|
||||
- Ask one blocking question at a time and put it last. Keep working when a non-blocking assumption is safe.
|
||||
|
||||
## Progress and Completion: Rundown
|
||||
|
||||
Use Rundown formatting when a task has multiple steps or mixed states:
|
||||
|
||||
- Start with a one-line outcome that includes any blocker.
|
||||
- Distinguish verified completion, work in progress, work not started, and unknown state. Omit empty categories.
|
||||
- Put each blocker or material risk on its own line.
|
||||
- Report only observed states. Mark an unknown as unknown and state what check would resolve it.
|
||||
- End with the next action or a small numbered choice only when the user must decide.
|
||||
|
||||
## Explicit-Only: Spartan
|
||||
|
||||
Use Spartan style only when the user explicitly asks for it:
|
||||
|
||||
- Lead with the complete answer in one sentence.
|
||||
- Be terse, blunt, and direct; remove warmth, hedging, transitions, narration, and summaries.
|
||||
- Keep all load-bearing facts, warnings, and conditions even when they make the answer longer.
|
||||
- If the user also asks for depth, provide the full detail in short, separated blocks.
|
||||
37
.agents/skills/karpathy-guidelines/SKILL.md
Normal file
37
.agents/skills/karpathy-guidelines/SKILL.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: karpathy-guidelines
|
||||
description: Keep implementation, refactoring, and code review assumption-aware, simple, surgical, and tied to verifiable success criteria.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/karpathy-guidelines/SKILL.md
|
||||
-->
|
||||
# Karpathy Guidelines
|
||||
|
||||
Use these guidelines while implementing, refactoring, or reviewing code. They refine execution quality but do not expand the approved task scope.
|
||||
|
||||
## Think Before Coding
|
||||
|
||||
- Inspect the relevant code and repository conventions before choosing a solution.
|
||||
- Surface an assumption when different choices would materially change behavior, compatibility, data, or scope.
|
||||
- Ask only when the decision cannot be discovered safely and a reasonable assumption would be risky. Otherwise proceed with the smallest reasonable assumption and report it.
|
||||
|
||||
## Simplicity First
|
||||
|
||||
- Implement the smallest complete solution that satisfies the observable requirement.
|
||||
- Do not add speculative abstractions, extension points, configuration, fallback paths, or dependencies for hypothetical future use.
|
||||
- Prefer an existing repository pattern or standard-library capability over a new local framework.
|
||||
|
||||
## Surgical Changes
|
||||
|
||||
- Every changed line must trace to the approved objective, required validation, or a necessary compatibility adjustment.
|
||||
- Preserve existing naming, structure, public behavior, and formatting outside that boundary.
|
||||
- Do not mix the task with unrelated cleanup. Remove dead code, duplication, or ceremony introduced by the current change before finishing.
|
||||
|
||||
## Goal-Driven Execution
|
||||
|
||||
- Translate the request into observable success criteria before implementation.
|
||||
- Choose the narrowest check that can fail for the behavior being changed, then run broader repository checks when appropriate.
|
||||
- Iterate only within the approved scope until the criteria pass or a concrete blocker is established.
|
||||
- Before reporting completion, inspect the final diff for unnecessary code and use `verification-before-completion` for fresh evidence.
|
||||
29
.agents/skills/project-reference-loader/SKILL.md
Normal file
29
.agents/skills/project-reference-loader/SKILL.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: project-reference-loader
|
||||
description: Load the current project-specific and shared reference documents routed by AGENTS.md before substantive repository analysis, implementation, debugging, review, or planning.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/project-reference-loader/SKILL.md
|
||||
-->
|
||||
# Project Reference Loader
|
||||
|
||||
Use the repository's generated `AGENTS.md` as the routing entrypoint.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Find the `Required Project References` and shared-contract reference routes that match the current task.
|
||||
2. Read the current contents of every matching file before relying on remembered project behavior, even when the file was read earlier in the session.
|
||||
3. If the task crosses multiple scopes, read every matching reference. Do not load unrelated references merely because they exist.
|
||||
4. Treat routed references as binding project instructions within their stated scope. Resolve conflicts using the precedence rules in `AGENTS.md`.
|
||||
5. If a required reference is missing, unreadable, outside the repository, or internally inconsistent, stop the affected work and report the exact problem instead of guessing.
|
||||
|
||||
## Change Handling
|
||||
|
||||
- Edit authored project detail under `.agent/references/` when the durable rule belongs only to that repository.
|
||||
- Edit the provider's `.agent/consumer-references/` when the rule is part of a shared consumer contract.
|
||||
- Never edit generated `.agent-harness/references/` copies directly.
|
||||
- Changing `.agent/references/` does not require recomposing `AGENTS.md` when its route is unchanged; changing routing, `project.md`, `consumer.md`, or shared reference sources does.
|
||||
|
||||
Before completion, confirm that the references used still exist and that the result does not contradict them. This skill does not expand authorization to edit, commit, push, deploy, connect to external systems, or perform destructive operations.
|
||||
38
.agents/skills/verification-before-completion/SKILL.md
Normal file
38
.agents/skills/verification-before-completion/SKILL.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: verification-before-completion
|
||||
description: Require fresh, claim-specific evidence before reporting work complete, fixed, passing, ready, or safe to commit or publish.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/verification-before-completion/SKILL.md
|
||||
-->
|
||||
# Verification Before Completion
|
||||
|
||||
No completion claim without fresh evidence. This workflow verifies status; it does not authorize a commit, push, deployment, database operation, or other protected action.
|
||||
|
||||
## Verification Gate
|
||||
|
||||
Before making a success claim:
|
||||
|
||||
1. State the exact claim internally and identify which observable check can prove or disprove it.
|
||||
2. Run the relevant command or inspection fresh after the final change. Use repository-defined commands; do not invent a substitute that proves a different property.
|
||||
3. Read the complete result needed for the claim, including the exit code, failure count, skipped checks, and generated changes.
|
||||
4. Compare the evidence with the claim and the approved acceptance criteria.
|
||||
5. Report only the status supported by that evidence.
|
||||
|
||||
## Evidence Rules
|
||||
|
||||
- A passing lint does not prove compilation, a passing build does not prove runtime behavior, and a passing narrow test does not prove unrelated requirements.
|
||||
- For a regression test, establish that it is capable of detecting the defect when practical; do not treat an always-passing test as proof.
|
||||
- Recheck the worktree or final diff after generators, formatters, tests, or builds that may create or alter files.
|
||||
- Separate verified results, failures, checks not run, and pre-existing failures. Never quietly merge them into a success statement.
|
||||
- For delegated work, inspect the returned changes and run the relevant verification yourself before accepting the completion claim.
|
||||
- For absence or universal claims such as “no occurrences” or “all projects,” use a check whose scope actually covers the claim.
|
||||
|
||||
## Reporting
|
||||
|
||||
- Cite the commands or inspections actually run and summarize their observed results.
|
||||
- If a required check cannot run, state the actual incomplete or blocked status and the exact reason.
|
||||
- Do not use “should work,” “probably passes,” “seems correct,” or similar language as a substitute for verification.
|
||||
- Do not claim completion while a required check is failing or while known correctness, encoding, security, or generated-output drift remains unresolved.
|
||||
41
.claude/skills/attention-aware-communication/SKILL.md
Normal file
41
.claude/skills/attention-aware-communication/SKILL.md
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
name: attention-aware-communication
|
||||
description: Shape substantive answers, progress updates, and completion reports for fast, accurate reading without reducing the underlying work.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/attention-aware-communication/SKILL.md
|
||||
-->
|
||||
# Attention-Aware Communication
|
||||
|
||||
This skill changes presentation only. Investigate, implement, and verify as deeply as the task requires.
|
||||
|
||||
## Default: Attention-kind
|
||||
|
||||
- Put the bottom line in the first sentence and use plain Korean.
|
||||
- Say the least that fully answers, then stop. Remove preambles, padding, repetition, and closing restatements.
|
||||
- Never omit a number, scope condition, risk, prerequisite, uncertainty, or other fact that could cause the user to act incorrectly.
|
||||
- For genuine breadth, explain the one or two most important points first, name the remaining areas, and let the user choose whether to expand them. Do not use this to defer required caveats or a complete focused answer.
|
||||
- When the user asks for a detailed explanation, walkthrough, rationale, or full picture, suspend brevity and provide the necessary detail in scannable sections.
|
||||
- When asked for a deliverable such as a command, message, snippet, or commit text, return the deliverable without unnecessary framing unless safety or correctness requires context.
|
||||
- Ask one blocking question at a time and put it last. Keep working when a non-blocking assumption is safe.
|
||||
|
||||
## Progress and Completion: Rundown
|
||||
|
||||
Use Rundown formatting when a task has multiple steps or mixed states:
|
||||
|
||||
- Start with a one-line outcome that includes any blocker.
|
||||
- Distinguish verified completion, work in progress, work not started, and unknown state. Omit empty categories.
|
||||
- Put each blocker or material risk on its own line.
|
||||
- Report only observed states. Mark an unknown as unknown and state what check would resolve it.
|
||||
- End with the next action or a small numbered choice only when the user must decide.
|
||||
|
||||
## Explicit-Only: Spartan
|
||||
|
||||
Use Spartan style only when the user explicitly asks for it:
|
||||
|
||||
- Lead with the complete answer in one sentence.
|
||||
- Be terse, blunt, and direct; remove warmth, hedging, transitions, narration, and summaries.
|
||||
- Keep all load-bearing facts, warnings, and conditions even when they make the answer longer.
|
||||
- If the user also asks for depth, provide the full detail in short, separated blocks.
|
||||
37
.claude/skills/karpathy-guidelines/SKILL.md
Normal file
37
.claude/skills/karpathy-guidelines/SKILL.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: karpathy-guidelines
|
||||
description: Keep implementation, refactoring, and code review assumption-aware, simple, surgical, and tied to verifiable success criteria.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/karpathy-guidelines/SKILL.md
|
||||
-->
|
||||
# Karpathy Guidelines
|
||||
|
||||
Use these guidelines while implementing, refactoring, or reviewing code. They refine execution quality but do not expand the approved task scope.
|
||||
|
||||
## Think Before Coding
|
||||
|
||||
- Inspect the relevant code and repository conventions before choosing a solution.
|
||||
- Surface an assumption when different choices would materially change behavior, compatibility, data, or scope.
|
||||
- Ask only when the decision cannot be discovered safely and a reasonable assumption would be risky. Otherwise proceed with the smallest reasonable assumption and report it.
|
||||
|
||||
## Simplicity First
|
||||
|
||||
- Implement the smallest complete solution that satisfies the observable requirement.
|
||||
- Do not add speculative abstractions, extension points, configuration, fallback paths, or dependencies for hypothetical future use.
|
||||
- Prefer an existing repository pattern or standard-library capability over a new local framework.
|
||||
|
||||
## Surgical Changes
|
||||
|
||||
- Every changed line must trace to the approved objective, required validation, or a necessary compatibility adjustment.
|
||||
- Preserve existing naming, structure, public behavior, and formatting outside that boundary.
|
||||
- Do not mix the task with unrelated cleanup. Remove dead code, duplication, or ceremony introduced by the current change before finishing.
|
||||
|
||||
## Goal-Driven Execution
|
||||
|
||||
- Translate the request into observable success criteria before implementation.
|
||||
- Choose the narrowest check that can fail for the behavior being changed, then run broader repository checks when appropriate.
|
||||
- Iterate only within the approved scope until the criteria pass or a concrete blocker is established.
|
||||
- Before reporting completion, inspect the final diff for unnecessary code and use `verification-before-completion` for fresh evidence.
|
||||
29
.claude/skills/project-reference-loader/SKILL.md
Normal file
29
.claude/skills/project-reference-loader/SKILL.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: project-reference-loader
|
||||
description: Load the current project-specific and shared reference documents routed by AGENTS.md before substantive repository analysis, implementation, debugging, review, or planning.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/project-reference-loader/SKILL.md
|
||||
-->
|
||||
# Project Reference Loader
|
||||
|
||||
Use the repository's generated `AGENTS.md` as the routing entrypoint.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Find the `Required Project References` and shared-contract reference routes that match the current task.
|
||||
2. Read the current contents of every matching file before relying on remembered project behavior, even when the file was read earlier in the session.
|
||||
3. If the task crosses multiple scopes, read every matching reference. Do not load unrelated references merely because they exist.
|
||||
4. Treat routed references as binding project instructions within their stated scope. Resolve conflicts using the precedence rules in `AGENTS.md`.
|
||||
5. If a required reference is missing, unreadable, outside the repository, or internally inconsistent, stop the affected work and report the exact problem instead of guessing.
|
||||
|
||||
## Change Handling
|
||||
|
||||
- Edit authored project detail under `.agent/references/` when the durable rule belongs only to that repository.
|
||||
- Edit the provider's `.agent/consumer-references/` when the rule is part of a shared consumer contract.
|
||||
- Never edit generated `.agent-harness/references/` copies directly.
|
||||
- Changing `.agent/references/` does not require recomposing `AGENTS.md` when its route is unchanged; changing routing, `project.md`, `consumer.md`, or shared reference sources does.
|
||||
|
||||
Before completion, confirm that the references used still exist and that the result does not contradict them. This skill does not expand authorization to edit, commit, push, deploy, connect to external systems, or perform destructive operations.
|
||||
38
.claude/skills/verification-before-completion/SKILL.md
Normal file
38
.claude/skills/verification-before-completion/SKILL.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: verification-before-completion
|
||||
description: Require fresh, claim-specific evidence before reporting work complete, fixed, passing, ready, or safe to commit or publish.
|
||||
---
|
||||
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Source: skills/verification-before-completion/SKILL.md
|
||||
-->
|
||||
# Verification Before Completion
|
||||
|
||||
No completion claim without fresh evidence. This workflow verifies status; it does not authorize a commit, push, deployment, database operation, or other protected action.
|
||||
|
||||
## Verification Gate
|
||||
|
||||
Before making a success claim:
|
||||
|
||||
1. State the exact claim internally and identify which observable check can prove or disprove it.
|
||||
2. Run the relevant command or inspection fresh after the final change. Use repository-defined commands; do not invent a substitute that proves a different property.
|
||||
3. Read the complete result needed for the claim, including the exit code, failure count, skipped checks, and generated changes.
|
||||
4. Compare the evidence with the claim and the approved acceptance criteria.
|
||||
5. Report only the status supported by that evidence.
|
||||
|
||||
## Evidence Rules
|
||||
|
||||
- A passing lint does not prove compilation, a passing build does not prove runtime behavior, and a passing narrow test does not prove unrelated requirements.
|
||||
- For a regression test, establish that it is capable of detecting the defect when practical; do not treat an always-passing test as proof.
|
||||
- Recheck the worktree or final diff after generators, formatters, tests, or builds that may create or alter files.
|
||||
- Separate verified results, failures, checks not run, and pre-existing failures. Never quietly merge them into a success statement.
|
||||
- For delegated work, inspect the returned changes and run the relevant verification yourself before accepting the completion claim.
|
||||
- For absence or universal claims such as “no occurrences” or “all projects,” use a check whose scope actually covers the claim.
|
||||
|
||||
## Reporting
|
||||
|
||||
- Cite the commands or inspections actually run and summarize their observed results.
|
||||
- If a required check cannot run, state the actual incomplete or blocked status and the exact reason.
|
||||
- Do not use “should work,” “probably passes,” “seems correct,” or similar language as a substitute for verification.
|
||||
- Do not claim completion while a required check is failing or while known correctness, encoding, security, or generated-output drift remains unresolved.
|
||||
5
.gitattributes
vendored
5
.gitattributes
vendored
@@ -1,3 +1,8 @@
|
||||
/.gitattributes text eol=lf
|
||||
/gradlew text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.jar binary
|
||||
|
||||
/.agent/** text eol=lf
|
||||
/AGENTS.md text eol=lf
|
||||
/CLAUDE.md text eol=lf
|
||||
|
||||
278
AGENTS.md
Normal file
278
AGENTS.md
Normal file
@@ -0,0 +1,278 @@
|
||||
<!--
|
||||
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||
Project: kri-contact-server
|
||||
Schema version: 1
|
||||
Edit the source fragments or repository .agent files, then recompose.
|
||||
-->
|
||||
|
||||
# KRI Development Base Instructions
|
||||
|
||||
This document defines the shared working rules for KRI development repositories.
|
||||
Keep project-specific facts and commands in the project profile and project rules.
|
||||
|
||||
## Instruction Resolution
|
||||
|
||||
Apply repository instructions in this order:
|
||||
|
||||
1. Base rules
|
||||
2. Project-type rules
|
||||
3. Technology-stack rules
|
||||
4. Shared consumer contracts
|
||||
5. Project-specific rules
|
||||
6. The explicitly approved task scope
|
||||
|
||||
Later and more specific instructions may override earlier general instructions only within their stated scope.
|
||||
|
||||
- Apply a shared consumer contract only when `.agent/profile.yml` declares it.
|
||||
- Do not silently resolve a material instruction conflict. Report the conflicting rules and request a decision before changing files.
|
||||
- Rules involving destructive actions, credentials, external systems, production, deployment, databases, or Git publication require explicit authorization even when a later rule is less restrictive.
|
||||
|
||||
## Communication
|
||||
|
||||
- Respond to the user in Korean unless the user requests another language.
|
||||
- Keep code identifiers, commands, paths, protocol names, and external API terms in their original form.
|
||||
- Follow the repository's existing language conventions for code comments and user-facing messages.
|
||||
- Lead with the result or decision, then provide only the detail needed to verify it.
|
||||
- Do not create or retain a full session transcript.
|
||||
|
||||
### Attention-Aware Response Style
|
||||
|
||||
- Use `attention-aware-communication` for substantive answers, progress updates, and completion reports.
|
||||
- Default to concise, bottom-line-first Korean without omitting a condition, risk, number, or uncertainty needed for a correct decision.
|
||||
- Give full detail when the user requests depth. Use Spartan style only when explicitly requested.
|
||||
- Presentation rules never reduce investigation, implementation, validation, or reporting obligations.
|
||||
|
||||
## Work Authorization
|
||||
|
||||
- The default workflow is discussion first and explicit execution approval second.
|
||||
- During discussion, perform only read-only investigation needed to understand the task and propose a concrete plan, unless the user prohibits inspection.
|
||||
- Read-only investigation may include file inspection, code search, encoding checks, `git status`, `git diff`, `git log`, and sanitized official-documentation lookup.
|
||||
- Before execution approval, do not edit files, install dependencies, run builds or tests, start services, connect to databases, or change local or external state.
|
||||
- Before requesting approval, describe the intended scope, affected areas, validation plan, and material risks.
|
||||
- Treat approval as limited to the presented scope. Pause and discuss again if the work materially expands.
|
||||
- If the user explicitly requests immediate execution without prior discussion, the discussion gate may be skipped for the stated scope.
|
||||
- Fast-track authorization does not implicitly authorize protected operations such as destructive commands, production changes, deployments, database mutations, Git publication, or external messages.
|
||||
|
||||
## Local Development Environment
|
||||
|
||||
- Primary OS: Windows 11.
|
||||
- Primary shell: PowerShell.
|
||||
- Use Git Bash only when the repository already depends on Bash or POSIX shell behavior.
|
||||
- Prefer repository-provided wrappers and scripts over globally installed commands.
|
||||
- Do not assume that GNU utilities, WSL, Docker, or a Unix-compatible shell are available unless the project profile confirms them.
|
||||
- Detect Java, Node.js, .NET, Python, package-manager, and database-tool versions from repository configuration.
|
||||
- Do not install or modify global toolchains as part of a project task.
|
||||
|
||||
Preferred human-facing tools:
|
||||
|
||||
- Classic ASP: Visual Studio Code
|
||||
- Java and Spring Boot: IntelliJ IDEA
|
||||
- C# and .NET: JetBrains Rider
|
||||
- JavaScript, TypeScript, and Next.js: JetBrains WebStorm
|
||||
- Python: JetBrains PyCharm
|
||||
- Microsoft SQL Server: SQL Server Management Studio
|
||||
- Other databases: JetBrains DataGrip
|
||||
|
||||
- These preferences do not authorize launching or controlling a GUI application.
|
||||
- Prefer IDE-independent commands that can also run in CI.
|
||||
- Do not modify global IDE settings.
|
||||
- Do not create or modify `.idea`, `.vscode`, workspace, or run-configuration files unless the approved task requires it.
|
||||
- Preserve existing shared IDE configuration when it is already tracked.
|
||||
|
||||
## PowerShell and Path Safety
|
||||
|
||||
- Quote paths containing spaces, brackets, parentheses, Korean characters, or PowerShell metacharacters.
|
||||
- Prefer `-LiteralPath` when operating on an exact filesystem path.
|
||||
- Use project-relative paths in committed configuration and documentation. Do not commit machine-specific paths such as `D:\_____Dev\...`.
|
||||
- Do not pass filesystem targets between PowerShell, `cmd.exe`, and Bash for destructive or recursive operations.
|
||||
- Keep a filesystem operation within one shell from target resolution through execution.
|
||||
- Before a recursive delete or move, resolve and verify every absolute target.
|
||||
- Never use a drive root, workspace root, user profile, unresolved variable, wildcard, or broad glob as a recursive delete target.
|
||||
- Prefer recoverable operations when practical.
|
||||
|
||||
## Change Discipline
|
||||
|
||||
- Preserve all existing user changes, including uncommitted and untracked work.
|
||||
- Keep changes minimal but complete for the approved objective.
|
||||
- Avoid unrelated cleanup, formatting, renaming, dependency upgrades, and architectural refactoring.
|
||||
- Do not overwrite or revert unrelated changes.
|
||||
- Stop and report when the requested change overlaps existing work in a way that cannot be handled safely.
|
||||
- Prefer changing an authoritative source over editing generated output.
|
||||
- Treat files marked as generated as read-only unless regeneration is part of the approved plan.
|
||||
- Do not edit vendored dependencies, build outputs, caches, or generated clients unless explicitly required.
|
||||
- Do not regenerate a broad set of files for a narrow change without first explaining the expected output scope.
|
||||
|
||||
## Text Encoding and Korean Content Safety
|
||||
|
||||
- Treat the existing file encoding, BOM state, and line-ending style as part of the file's contract.
|
||||
- Preserve Korean comments, user-facing messages, error messages, identifiers, and documentation exactly unless the task explicitly requires changing them.
|
||||
- Do not assume that garbled terminal output means the file itself is corrupted. Verify bytes and encoding before modifying suspicious text.
|
||||
- Before editing an existing text file, determine its current encoding and BOM state when repository configuration does not already guarantee them.
|
||||
- Do not convert encoding, add or remove a BOM, or normalize line endings as a side effect of an unrelated change.
|
||||
- Avoid whole-file rewrites for small changes.
|
||||
- Do not rewrite source files through `Get-Content | Set-Content`, `Out-File`, shell redirection, or another method whose encoding behavior is implicit.
|
||||
- Do not use a patching or formatting tool on a non-UTF-8 file unless it is known to preserve that file's encoding.
|
||||
- Treat a console display problem and an on-disk encoding problem as separate issues.
|
||||
- After editing Korean text, inspect the diff for replacement characters (`<60>`), mojibake, unexpected escapes, BOM changes, and unrelated line-ending changes.
|
||||
- Run `.agent/tools/check-encoding.ps1` when it is available and the change touches Korean text or a non-default encoding.
|
||||
- If encoding cannot be identified confidently, stop before writing and report the affected file and evidence.
|
||||
- For a new text file, follow repository configuration. If no rule exists, use UTF-8 without BOM.
|
||||
|
||||
## Git Safety
|
||||
|
||||
- Use `git status`, `git diff`, and `git log` for read-only investigation.
|
||||
- Do not run `commit`, `push`, `pull`, `fetch`, `merge`, `rebase`, `reset`, `checkout`, `switch`, `stash`, `clean`, `tag`, or force operations unless that specific operation is explicitly approved.
|
||||
- Source-edit approval does not include commit or push approval.
|
||||
- Never amend an existing commit unless explicitly requested.
|
||||
- Before an approved commit, show the intended files, validation results, and proposed commit message.
|
||||
- Never push directly to a protected branch unless the user names the target branch and explicitly authorizes the push.
|
||||
|
||||
## Dependencies and External Actions
|
||||
|
||||
- Use the package manager, lockfile, and toolchain already selected by the repository.
|
||||
- Do not install global packages.
|
||||
- Do not add, remove, or upgrade a dependency unless it was included in the approved plan.
|
||||
- Pause for approval if an unplanned dependency becomes necessary.
|
||||
- Keep lockfiles synchronized with approved dependency changes.
|
||||
- Do not deploy, publish packages, create releases, send messages or email, call business APIs, or modify external services unless explicitly requested.
|
||||
- Never upload proprietary source code, internal documents, credentials, customer data, or database contents to an external service.
|
||||
- Remove secrets and unnecessary internal identifiers from external search queries.
|
||||
|
||||
## Database Safety
|
||||
|
||||
- Treat writing or reviewing SQL as source code separately from executing SQL against a database.
|
||||
- SQL files, migrations, schema proposals, and query drafts may be created within an approved source-change scope.
|
||||
- Do not connect to a shared, staging, or production database without explicit authorization for that environment.
|
||||
- Read-only queries against a non-local database also require authorization because results may contain sensitive data.
|
||||
- Do not execute DDL, DML, stored procedures, migrations, administrative commands, or data-correction scripts against a non-disposable database without separate authorization for the exact target and operation.
|
||||
- Source-change approval does not authorize migration execution.
|
||||
- Use a disposable local or test database for approved validation only after verifying its identity and disposable nature.
|
||||
- Never place credentials, connection strings, or sensitive query results in source files, logs, generated documents, or chat output.
|
||||
|
||||
## Secrets and Sensitive Data
|
||||
|
||||
- Never add credentials, tokens, passwords, private keys, connection strings, session identifiers, or production data to source control.
|
||||
- Read sensitive files only when the approved task requires it and no safer source exists.
|
||||
- Prefer inspecting configuration keys and schemas without displaying secret values.
|
||||
- Never echo secrets into terminal output, chat responses, logs, diffs, generated documents, test fixtures, or screenshots.
|
||||
- Redact sensitive values when reporting errors or command output.
|
||||
- If a possible secret is discovered, do not repeat it. Report only its location, type, and recommended containment action.
|
||||
- Do not rotate, revoke, copy, or otherwise modify credentials unless that exact action is explicitly authorized.
|
||||
|
||||
## Workflow Skills
|
||||
|
||||
- Use `project-reference-loader` before substantive repository analysis, planning, implementation, debugging, or review. Read only the current project and shared references routed for that task, and reread them for each related task even if they were loaded earlier in the session.
|
||||
- Use `karpathy-guidelines` when implementing, refactoring, or reviewing code. It keeps assumptions visible, changes surgical, and success criteria verifiable.
|
||||
- Use `verification-before-completion` before claiming that work is complete, fixed, passing, ready, or safe to commit or publish.
|
||||
- A skill does not expand task scope or authorize Git publication, database execution, deployment, destructive actions, or external communication.
|
||||
|
||||
## Validation
|
||||
|
||||
- Discover supported build, test, lint, type-check, and formatting commands from repository files and project instructions. Do not invent commands.
|
||||
- Include intended validation in the discussion-phase plan.
|
||||
- After approved changes, run the narrowest relevant validation first, then broader checks when appropriate.
|
||||
- Limit formatting to files within the approved scope.
|
||||
- Do not run tests that require a shared database, production service, paid external API, or sensitive data unless separately authorized.
|
||||
- Do not claim that a check passed unless it was executed successfully.
|
||||
- If a check cannot be run, state the exact reason.
|
||||
- Distinguish a current-change failure from a pre-existing failure or an undetermined failure.
|
||||
- Do not fix unrelated failures without expanding the approved scope.
|
||||
- Inspect the worktree after validation for unexpected generated files, formatting churn, encoding changes, or lockfile changes.
|
||||
|
||||
## Artifacts and Session Records
|
||||
|
||||
- Do not create full-session transcripts, automatic HTML copies, analysis reports, or extra documentation unless explicitly requested.
|
||||
- Store durable information in the repository's existing documentation structure.
|
||||
- Do not place generated reports or temporary analysis files in the repository root.
|
||||
- Remove task-specific temporary files created by the current task after validation when removal is safe.
|
||||
|
||||
## Completion Report
|
||||
|
||||
When implementation is complete, report in Korean:
|
||||
|
||||
- what changed and why;
|
||||
- the main affected files or components;
|
||||
- validation commands actually executed and their results;
|
||||
- checks not executed and the reason;
|
||||
- remaining risks, assumptions, or follow-up work;
|
||||
- database, deployment, dependency, encoding, and compatibility impact when applicable.
|
||||
|
||||
- Do not report completion while required validation is failing or known encoding corruption is unresolved.
|
||||
- Keep the report concise and do not include a full session transcript.
|
||||
|
||||
## Internal Service Project Rules
|
||||
|
||||
- Internal-only usage does not reduce security, privacy, compatibility, or validation requirements.
|
||||
- Preserve authentication, authorization, role boundaries, auditability, and personal-data protections.
|
||||
- Identify affected user workflows before changing visible behavior.
|
||||
- Treat Frontend and Backend repositories as separate deployable systems with an explicit API contract between them.
|
||||
- Coordinate request, response, authentication, error, and versioning changes across both sides when the approved scope includes both repositories.
|
||||
- Do not silently require a simultaneous Frontend and Backend deployment.
|
||||
- Prefer backward-compatible transitions when deployments may occur independently.
|
||||
- Include migration and rollback considerations for database, API, and configuration changes.
|
||||
- Do not modernize legacy code as an unrelated side effect.
|
||||
- Apply Classic ASP text-safety rules only when the project profile declares the `classic-asp` stack.
|
||||
- Do not access or modify production data merely because the service is internal.
|
||||
|
||||
## Java and Spring Boot
|
||||
|
||||
- Treat the configured JDK, Spring Boot, Gradle, plugin, dependency, and package versions as authoritative.
|
||||
- Use the repository's Gradle Wrapper. Do not substitute a machine-global Gradle installation.
|
||||
- Preserve the established package layout and controller, application/service, domain, and persistence boundaries.
|
||||
- Keep controllers thin, place business rules in the established service/domain layer, and prefer constructor injection.
|
||||
- Apply request and configuration validation at boundaries and preserve the project's exception and response conventions.
|
||||
- Make transaction boundaries explicit and narrow; do not add broad transactions to hide lifecycle or query problems.
|
||||
- Preserve authentication, authorization, auditing, logging, and secret-management conventions.
|
||||
- Do not edit generated QueryDSL or other generated sources. Change their source definitions and regenerate only when the repository workflow requires it.
|
||||
- Use the approved KriCommon contract when the project profile includes it; do not duplicate shared backend behavior locally.
|
||||
- Run the narrowest relevant Gradle compile, test, static-analysis, and build tasks.
|
||||
|
||||
## MySQL
|
||||
|
||||
- Use MySQL syntax and behavior only for data sources whose declared engine is `mysql`.
|
||||
- Preserve the configured version, schema, character set, collation, time zone, naming, migration, and access conventions.
|
||||
- Parameterize values. Do not build SQL by concatenating untrusted input.
|
||||
- Consider indexes and execution plans for changed filters, joins, ordering, grouping, and pagination without guessing from small data sets.
|
||||
- Preserve transaction, locking, null, date/time, decimal, and generated-key semantics.
|
||||
- Do not introduce MSSQL or other dialect syntax into MySQL paths.
|
||||
- A source-code change approval authorizes SQL analysis and migration drafting only. Execute DDL, DML, procedures, or migrations only with separate explicit approval and the declared data-source access level.
|
||||
|
||||
## KriCommon Consumer Contract
|
||||
|
||||
- Consume KriCommon as `com.kri.common:starter:<approved-version>` through the repository's established Gradle version-management convention.
|
||||
- Import service-facing APIs from `com.kri.common.feature.*`; treat `com.kri.common.runtime.*` as internal.
|
||||
- Prefer a shared feature or approved extension point over duplicating authentication, HTTP, error, enum, Excel, Redis, JSON, date/time, JPA, crypto, or utility behavior locally.
|
||||
- For HTTP/2 header safety and original upstream error propagation, use the shared HTTP/bypass features documented in the routed platform-capabilities reference instead of implementing consumer-local header filters and raw-response exception handlers.
|
||||
- Response customizers may call `requireSuccess()`; its upstream exception propagates unchanged. Response charset parsing ignores charset-like text inside other quoted header parameters.
|
||||
- Do not modify KriCommon or another consumer repository unless it is explicitly included in the approved task scope.
|
||||
|
||||
### Required Shared References
|
||||
|
||||
Before each related task, read the current contents of every matching reference, even if it was read earlier in the session.
|
||||
|
||||
| Task scope | Required reference |
|
||||
|---|---|
|
||||
| Dependency, configuration, security, Web, Swagger, Redis, scheduling, HTTP, JSON, or date/time behavior | `.agent-harness/references/kri-common/platform-capabilities.md` |
|
||||
| Encryption, hashing, key material, or legacy crypto interoperability | `.agent-harness/references/kri-common/crypto-contract.md` |
|
||||
| KriCommon version upgrade or consumer verification | `.agent-harness/references/kri-common/upgrade-and-verification.md` |
|
||||
|
||||
If a task spans multiple scopes, read every matching reference. Generated files under `.agent-harness/references/` are read-only copies; edit KriCommon's `.agent/consumer.md` or `.agent/consumer-references/` and recompose instead.
|
||||
|
||||
# KriContact Server Project Instruction Router
|
||||
|
||||
## Required Project References
|
||||
|
||||
Before each related task, read the current contents of every matching reference below, even if it was read earlier in the session.
|
||||
|
||||
| Task scope | Required reference |
|
||||
|---|---|
|
||||
| Any substantive analysis, planning, implementation, debugging, review, or documentation work in this repository | `.agent/references/repository-rules.md` |
|
||||
|
||||
If a task spans multiple scopes, read every matching reference. Do not assume remembered content is current.
|
||||
|
||||
## Harness Workflow
|
||||
|
||||
- `AGENTS.md` and `CLAUDE.md` are generated outputs. Never edit them directly.
|
||||
- Edit `.agent/project.md` only when routing changes. Store durable project detail in `.agent/references/`.
|
||||
- A reference-only content change does not require recomposition when its route is unchanged. Run harness verification to validate routing and UTF-8.
|
||||
- Recompose and verify after changing `.agent/project.md`, `.agent/profile.yml`, or another composed instruction source.
|
||||
20
build.gradle
20
build.gradle
@@ -38,7 +38,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.kri.common:starter:beta.1.4.0"
|
||||
implementation "com.kri.common:starter:beta.1.7.1"
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
@@ -76,24 +76,6 @@ dependencies {
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
}
|
||||
|
||||
// === QueryDSL Q클래스 생성 위치 설정 ===
|
||||
def querydslDir = layout.buildDirectory.dir("generated/querydsl").get().asFile
|
||||
|
||||
sourceSets {
|
||||
// Q클래스가 있는 디렉토리를 main 소스에 추가
|
||||
main.java.srcDirs += [querydslDir]
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.generatedSourceOutputDirectory.set(file(querydslDir))
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
tasks.named('clean') {
|
||||
doLast {
|
||||
delete querydslDir
|
||||
}
|
||||
}
|
||||
@@ -19,15 +19,15 @@ public final class ContactConstant {
|
||||
public static final String DEFAULT_USER_TEAM = "S101";
|
||||
public static final String DEFAULT_CALLER_TELNUM = "0234155100";
|
||||
|
||||
public static final int RESEARCHER_USER_ROLE = 2000;
|
||||
public static final int OUTSOURCE_USER_ROLE = 4000;
|
||||
public static final int FIELDWORK_USER_ROLE = 9000;
|
||||
public static final int CONTACT_INTERVIEWER_ROLE = 9002;
|
||||
public static final int FIELD_INTERVIEWER_ROLE = 9003;
|
||||
public static final StreamingReadOptions UPPER_CASE_HEADER_OPTIONS =
|
||||
new StreamingReadOptions(null, 0, 1, header -> header == null ? null : header.toUpperCase(
|
||||
new StreamingReadOptions(null, 0, 1, header -> header == null ? null : header.trim().toUpperCase(
|
||||
Locale.ROOT));
|
||||
|
||||
public static final String LIST_HEADER_ACCEPT_REGEX = "^[가-힣a-zA-Z0-9()_\\-\\[\\] ]+$";
|
||||
public static final String LIST_HEADER_COLOR_REGEX = "^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$";
|
||||
|
||||
public static final List<ListHeaderType> DEFAULT_AND_FILE_TYPE = Stream.concat(
|
||||
Arrays.stream(ListHeaderTypeDefault.values())
|
||||
@@ -35,11 +35,6 @@ public final class ContactConstant {
|
||||
Stream.of(ListHeaderType.FILE)
|
||||
).toList();
|
||||
|
||||
public static final List<ListHeaderType> ASSIGN_TYPE = List.of(
|
||||
ListHeaderType.OUTSOURCE,
|
||||
ListHeaderType.CONTACT_INTERVIEWER,
|
||||
ListHeaderType.FIELD_INTERVIEWER
|
||||
);
|
||||
|
||||
public static final List<ListHeaderType> EXACT_MATCH_HEADER_TYPE = List.of(
|
||||
ListHeaderType.CONTENT_ITEM
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.kri.contact.server.common.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.kri.common.feature.enums.CodeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Getter(onMethod_ = @JsonValue)
|
||||
@RequiredArgsConstructor
|
||||
@Schema(description = "전화 상태")
|
||||
public enum CallStatus implements CodeEnum<Short> {
|
||||
@Schema(description = "전화 시작")
|
||||
CALL_START((short) 2),
|
||||
@Schema(description = "전화 종료")
|
||||
CALL_CLOSE((short) 4),
|
||||
@Schema(description = "사용자 전화 종료")
|
||||
USER_HANGUP((short) 9);
|
||||
|
||||
private final Short code;
|
||||
|
||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||
public static CallStatus fromCode(Short code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (CallStatus s : values()) {
|
||||
if (s.code.equals(code)) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown CallStatus code: " + code);
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,9 @@ public enum ChannelType implements CodeEnum<Short> {
|
||||
@Schema(description = "이메일")
|
||||
EMAIL((short) 1),
|
||||
@Schema(description = "문자")
|
||||
SMS((short) 2);
|
||||
SMS((short) 2),
|
||||
@Schema(description = "알림톡")
|
||||
KKO_AT((short) 3);
|
||||
|
||||
private final Short code;
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.kri.contact.server.common.enums;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public enum ListAsyncAssignOperation {
|
||||
ASSIGN, RESET;
|
||||
|
||||
public static ListAsyncAssignOperation fromRequest(ListAsyncJobType type, Map<String, Object> request) {
|
||||
if (type != ListAsyncJobType.LIST_ASSIGN || request == null || request.get("operation") == null) {
|
||||
return null;
|
||||
}
|
||||
return valueOf(request.get("operation").toString());
|
||||
}
|
||||
|
||||
public String displayName() {
|
||||
return this == RESET ? "배정 초기화" : "리스트 배정";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.kri.contact.server.common.enums;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public enum ListAsyncJobStatus {
|
||||
QUEUED, RUNNING, CANCEL_REQUESTED, CANCELLED, SUCCEEDED, FAILED, PARTIALLY_SUCCEEDED;
|
||||
|
||||
public static final List<ListAsyncJobStatus> ACTIVE = List.of(QUEUED, RUNNING, CANCEL_REQUESTED);
|
||||
|
||||
public boolean isTerminal() {
|
||||
return this == CANCELLED || this == SUCCEEDED || this == FAILED || this == PARTIALLY_SUCCEEDED;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.kri.contact.server.common.enums;
|
||||
|
||||
public enum ListAsyncJobType {
|
||||
LIST_UPLOAD, LIST_RESET, LIST_UPDATE, LIST_ASSIGN,
|
||||
LIST_DOWNLOAD, CONTACT_HISTORY_DOWNLOAD, UPDATE_HISTORY_DOWNLOAD, ITEM_ZIP_DOWNLOAD,
|
||||
EMAIL_BULK, SMS_BULK, KKO_BULK;
|
||||
|
||||
public boolean isImportant() {
|
||||
return this == LIST_UPLOAD || this == LIST_RESET || this == LIST_UPDATE
|
||||
|| this == LIST_ASSIGN;
|
||||
}
|
||||
|
||||
public boolean conflictsWith(ListAsyncJobType existing, boolean sameUser) {
|
||||
return isImportant() || existing.isImportant() || (sameUser && this == existing);
|
||||
}
|
||||
|
||||
public String displayName() {
|
||||
return switch (this) {
|
||||
case LIST_UPLOAD -> "리스트 업로드";
|
||||
case LIST_RESET -> "리스트 초기화";
|
||||
case LIST_UPDATE -> "리스트 일괄 수정";
|
||||
case LIST_ASSIGN -> "배정 작업";
|
||||
case LIST_DOWNLOAD -> "리스트 다운로드";
|
||||
case CONTACT_HISTORY_DOWNLOAD -> "컨택 이력 다운로드";
|
||||
case UPDATE_HISTORY_DOWNLOAD -> "리스트 수정 이력 다운로드";
|
||||
case ITEM_ZIP_DOWNLOAD -> "첨부파일 ZIP 다운로드";
|
||||
case EMAIL_BULK -> "이메일 일괄 발송";
|
||||
case SMS_BULK -> "문자 일괄 발송";
|
||||
case KKO_BULK -> "알림톡 일괄 발송";
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.kri.contact.server.common.enums;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema(description = "컨택 이력 다운로드 정렬 순서")
|
||||
public enum ListEventHistoryOrder {
|
||||
ASC,
|
||||
DESC
|
||||
}
|
||||
@@ -22,12 +22,18 @@ public enum ListHeaderType implements CodeEnum<Short> {
|
||||
EMAIL(ListHeaderTypeSpecific.EMAIL), //31 : 이메일
|
||||
FILE(ListHeaderTypeSpecific.FILE), //81 : 파일업로드
|
||||
CONTENT_ITEM(ListHeaderTypeSpecific.CONTENT_ITEM), //91 : 목록형
|
||||
MULTILINE_TEXT(ListHeaderTypeSpecific.MULTILINE_TEXT), //98 : 여러 줄 텍스트
|
||||
TEXT((short) 99); //99 : 텍스트
|
||||
|
||||
private final Short code;
|
||||
|
||||
ListHeaderType(CodeEnum<Short> source) { this.code = source.getCode();}
|
||||
|
||||
/** 저장·처리 방식이 일반 텍스트와 동일한 타입 여부 */
|
||||
public boolean isText() {
|
||||
return this == TEXT || this == MULTILINE_TEXT;
|
||||
}
|
||||
|
||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||
public static ListHeaderType fromCode(Short code) {
|
||||
if (code == null) {
|
||||
|
||||
@@ -15,7 +15,8 @@ public enum ListHeaderTypeSpecific implements CodeEnum<Short> {
|
||||
TEL_NUM((short) 21), //21 : 전화번호
|
||||
EMAIL((short) 31), //31 : 이메일
|
||||
FILE((short) 81), //81 : 파일업로드
|
||||
CONTENT_ITEM((short) 91); //목록형
|
||||
CONTENT_ITEM((short) 91), //목록형
|
||||
MULTILINE_TEXT((short) 98); //98 : 여러 줄 텍스트 (텍스트 계열)
|
||||
|
||||
private final Short code;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.RequiredArgsConstructor;
|
||||
@RequiredArgsConstructor
|
||||
@Schema(description = "시스템 이벤트 타입")
|
||||
public enum SystemEventType implements CodeEnum<Short> {
|
||||
//1의 자리 1 insert, 2 update, 3 delete, 4 upload
|
||||
//1의 자리 0: select, 1 insert, 2 update, 3 delete, 4 upload
|
||||
//100의 자리 대분류, 10의 자리 소분류
|
||||
|
||||
LOGIN((short) 111), // 로그인
|
||||
@@ -18,13 +18,15 @@ public enum SystemEventType implements CodeEnum<Short> {
|
||||
CREATE_PROJECT((short) 211), // 프로젝트 생성
|
||||
UPDATE_PROJECT((short) 212), // 프로젝트 수정
|
||||
DELETE_PROJECT((short) 213), // 프로젝트 삭제
|
||||
|
||||
ASSIGN_PROJECT((short) 222), // 프로젝트 배정
|
||||
|
||||
UPDATE_PROJECT_DEFAULT_TEMPLATE((short) 232), // 기본 템플릿 수정
|
||||
|
||||
CREATE_USER((short) 311), // 사용자 생성
|
||||
UPDATE_USER((short) 312), // 사용자 수정
|
||||
DELETE_USER((short) 313), // 사용자 삭제
|
||||
UPLOAD_USER((short) 314), // 사용자 삭제
|
||||
UPLOAD_USER((short) 314), // 사용자 UPLOAD
|
||||
|
||||
CREATE_ROLE((short) 411), // 권한 생성
|
||||
UPDATE_ROLE((short) 412), // 권한 수정
|
||||
@@ -32,12 +34,18 @@ public enum SystemEventType implements CodeEnum<Short> {
|
||||
|
||||
UPSERT_LIST_HEADER((short) 1012), //리스트 헤더 수정
|
||||
|
||||
UPLOAD_LIST((short) 1111), //리스트 업로드
|
||||
UPDATE_LIST((short) 1112), //리스트 수정
|
||||
RESET_LIST((short) 1113), //리스트 삭제
|
||||
UPLOAD_LIST((short) 1114), //리스트 업로드
|
||||
|
||||
LIST_ASSIGN((short) 1122), //리스트 배정
|
||||
LIST_ASSIGN_RESET((short) 1123), //리스트 배정 초기화
|
||||
UPLOAD_LIST_ITEM_FILE((short) 1211), //리스트별 파일 업로드
|
||||
|
||||
SEARCH_LIST_HEADER_FROM_EXTERNAL((short) 1180), //외부에서 리스트 헤더 조회
|
||||
SEARCH_LIST_FROM_EXTERNAL((short) 1190), //외부에서 리스트 조회
|
||||
UPDATE_LIST_FROM_EXTERNAL((short) 1192), //외부에서 리스트 수정
|
||||
|
||||
UPLOAD_LIST_ITEM_FILE((short) 1214), //리스트별 파일 업로드
|
||||
|
||||
DUMMY((short) 9999);
|
||||
|
||||
|
||||
134
src/main/java/com/kri/contact/server/common/external/contactsurvey/ContactSurveyApiClient.java
vendored
Normal file
134
src/main/java/com/kri/contact/server/common/external/contactsurvey/ContactSurveyApiClient.java
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
package com.kri.contact.server.common.external.contactsurvey;
|
||||
|
||||
import com.kri.common.feature.http.ExternalApiClient;
|
||||
import com.kri.common.feature.web.BusinessException;
|
||||
import com.kri.contact.server.common.enums.SurveyType;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ContactSurveyApiClient {
|
||||
|
||||
private static final String CONTACT_SURVEY_PATH = "/include/ajax_contact.asp";
|
||||
private static final String CONTACT_SURVEY_COMMAND = "CONTACT_SURVEY";
|
||||
private static final int MAX_PKEY_LENGTH = 20;
|
||||
|
||||
private final ExternalApiClient externalApiClient = new ExternalApiClient();
|
||||
private final Environment environment;
|
||||
|
||||
@Value("${kri.contact-survey.enabled:false}")
|
||||
private boolean enabled;
|
||||
|
||||
@Value("${kri.contact-survey.kon-url}")
|
||||
private String konBaseUrl;
|
||||
|
||||
@Value("${kri.contact-survey.kiwi-url}")
|
||||
private String kiwiBaseUrl;
|
||||
|
||||
@Value("${kri.auth.apikey.header-name:X-API-Key}")
|
||||
private String apiKeyHeaderName;
|
||||
|
||||
@Value("${kri.auth.apikey.key}")
|
||||
private String apiKey;
|
||||
|
||||
public ContactSurveyApiClient(Environment environment) {
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
public void insert(SurveyType surveyType, String pkey, Long psidx) {
|
||||
request(surveyType, ContactSurveyCrud.INSERT, pkey, psidx);
|
||||
}
|
||||
|
||||
public void delete(SurveyType surveyType, String pkey, Long psidx) {
|
||||
request(surveyType, ContactSurveyCrud.DELETE, pkey, psidx);
|
||||
}
|
||||
|
||||
private void request(
|
||||
SurveyType surveyType,
|
||||
ContactSurveyCrud crud,
|
||||
String pkey,
|
||||
Long psidx
|
||||
) {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
validate(pkey, psidx);
|
||||
|
||||
String url = baseUrl(surveyType) + CONTACT_SURVEY_PATH;
|
||||
String body = "CRUD=" + crud
|
||||
+ "&COMMAND=" + CONTACT_SURVEY_COMMAND
|
||||
+ "&PKEY=" + encode(pkey)
|
||||
+ "&PSIDX=" + psidx
|
||||
+ "&TARGET=" + target();
|
||||
|
||||
externalApiClient.post(url, headers(), body);
|
||||
}
|
||||
|
||||
private String baseUrl(SurveyType surveyType) {
|
||||
String baseUrl = switch (surveyType) {
|
||||
case KON -> konBaseUrl;
|
||||
case KIWI -> kiwiBaseUrl;
|
||||
case EXTERNAL -> throw BusinessException.badRequest(
|
||||
"CONTACT_SURVEY_SYSTEM_NOT_SUPPORTED",
|
||||
"외부 설문은 CONTACT_SURVEY 매핑 API를 지원하지 않습니다."
|
||||
);
|
||||
};
|
||||
return baseUrl.endsWith("/") ? baseUrl.substring(0, baseUrl.length() - 1) : baseUrl;
|
||||
}
|
||||
|
||||
private void validate(String pkey, Long psidx) {
|
||||
if (pkey == null || pkey.isBlank() || pkey.length() > MAX_PKEY_LENGTH) {
|
||||
throw BusinessException.badRequest(
|
||||
"CONTACT_SURVEY_INVALID_PKEY",
|
||||
"설문 프로젝트 코드가 올바르지 않습니다."
|
||||
)
|
||||
.with("maxLength", MAX_PKEY_LENGTH);
|
||||
}
|
||||
if (psidx == null || psidx < 0) {
|
||||
throw BusinessException.badRequest(
|
||||
"CONTACT_SURVEY_INVALID_PSIDX",
|
||||
"프로젝트 설문 고유번호가 올바르지 않습니다."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private String encode(String value) {
|
||||
return URLEncoder.encode(value, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private String target() {
|
||||
String[] profiles = environment.getActiveProfiles();
|
||||
if (profiles.length == 0) {
|
||||
profiles = environment.getDefaultProfiles();
|
||||
}
|
||||
|
||||
for (String profile : profiles) {
|
||||
String target = profile.toUpperCase(Locale.ROOT);
|
||||
if (target.equals("PROD") || target.equals("DEV") || target.equals("LOCAL")) {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
throw BusinessException.internalError("UNSUPPORTED_CONTACT_SURVEY_PROFILE", "Unsupported contact survey target profile");
|
||||
}
|
||||
|
||||
private Map<String, String> headers() {
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put(apiKeyHeaderName, apiKey);
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
||||
return headers;
|
||||
}
|
||||
|
||||
private enum ContactSurveyCrud {
|
||||
INSERT,
|
||||
DELETE
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,25 @@
|
||||
package com.kri.contact.server.common.external.intranet;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@NoArgsConstructor // Jackson이 빈 객체를 생성할 수 있도록 추가
|
||||
@AllArgsConstructor // Builder 패턴 사용 시 필요
|
||||
@Schema(description = "인트라넷 사용자 검색 응답 DTO")
|
||||
public class SearchLoginInfoResponseDto {
|
||||
public record SearchLoginInfoResponseDto(
|
||||
|
||||
@Schema(description = "사용자 ID")
|
||||
private String userId;
|
||||
String userId,
|
||||
|
||||
@Schema(description = "사용자 소속 회사")
|
||||
private String userCmpn;
|
||||
String userCmpn,
|
||||
|
||||
@Schema(description = "사용자 이름")
|
||||
private String userNm;
|
||||
String userNm,
|
||||
|
||||
@Schema(description = "사용자 팀")
|
||||
private String userTeam;
|
||||
String userTeam,
|
||||
|
||||
@Schema(description = "사용자 역할")
|
||||
private int userRole;
|
||||
int userRole
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -16,10 +16,6 @@ public enum ChannelType implements CodeEnum<Short> {
|
||||
|
||||
private final Short code;
|
||||
|
||||
ChannelType(CodeEnum<Short> source) {
|
||||
this.code = source.getCode();
|
||||
}
|
||||
|
||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||
public static ChannelType fromCode(Short code) {
|
||||
if (code == null) {
|
||||
|
||||
@@ -2,16 +2,62 @@ package com.kri.contact.server.common.external.notihub;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.kri.common.feature.http.bypass.BypassClient;
|
||||
import com.kri.common.feature.http.bypass.BypassForwardOptions;
|
||||
import com.kri.common.feature.http.bypass.BypassRequest;
|
||||
import com.kri.common.feature.http.bypass.BypassResponse;
|
||||
import com.kri.common.feature.http.ExternalApiClient;
|
||||
import com.kri.common.feature.http.ExternalApiResponse;
|
||||
import com.kri.common.feature.web.BusinessException;
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubBulkSendCreateRequestDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubBulkSendInfoDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubBulkSendResponseDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubKkoSenderProfileDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubKkoTemplateDetailDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubKkoTemplateDetailRequestDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubKkoTemplateListRequestDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubKkoTemplateListResponseDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubReportExcelResponseDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubReportPageRequestDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubReportPageResponseDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubSendRequestBulkDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubSendRequestSingleDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubSendResultInfoDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubSendResultLastWithSidDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubSendResultSummaryRequestDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubSendResultSummaryResponseDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubSendSingleResponseDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubTemplateBasicDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubTemplateDetailDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubTemplateDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubTemplateSummaryDto;
|
||||
import com.kri.contact.server.dto.message.MessageSendCancelBulkRequestDto;
|
||||
import com.kri.contact.server.dto.message.MessageSendCancelSingleRequestDto;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.converter.FormHttpMessageConverter;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpOutputMessage;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
@Component
|
||||
@@ -20,6 +66,7 @@ public class NotiHubApiClient {
|
||||
|
||||
private final ExternalApiClient externalApiClient = new ExternalApiClient();
|
||||
private final ObjectMapper objectMapper;
|
||||
private final BypassClient bypassClient;
|
||||
|
||||
@Value("${kri.api-url.noti-hub}")
|
||||
private String notiHubBaseUrl;
|
||||
@@ -30,10 +77,26 @@ public class NotiHubApiClient {
|
||||
@Value("${kri.auth.apikey.key}")
|
||||
private String apiKey;
|
||||
|
||||
public ResponseEntity<byte[]> cancelSingle(
|
||||
MessageSendCancelSingleRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return forward(request, toJsonBytes(body), request.getContentType(), ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<byte[]> cancelBulk(
|
||||
MessageSendCancelBulkRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return forward(request, toJsonBytes(body), request.getContentType(), ctx);
|
||||
}
|
||||
|
||||
public NotiHubTemplateDto getTemplate(Long tmplatIdx) {
|
||||
String url = notiHubBaseUrl + "/template/" + tmplatIdx;
|
||||
try {
|
||||
ExternalApiResponse response = externalApiClient.get(url, headers());
|
||||
ExternalApiResponse response = externalApiClient.get(url, headers()).requireSuccess();
|
||||
return objectMapper.readValue(response.getBody(), NotiHubTemplateDto.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw BusinessException.badRequest("NOTI_HUB_RESPONSE_PARSE_FAILED", "noti-hub 응답을 해석할 수 없습니다.")
|
||||
@@ -41,12 +104,56 @@ public class NotiHubApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendEmailSingle(NotiHubSendRequestSingleDto request, RequestUserContext ctx) {
|
||||
postSingle("/send-email/single", request, ctx);
|
||||
public NotiHubSendSingleResponseDto sendEmailSingle(
|
||||
NotiHubSendRequestSingleDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return postSingle("/send-email/single", request, ctx);
|
||||
}
|
||||
|
||||
public void sendSmsSingle(NotiHubSendRequestSingleDto request, RequestUserContext ctx) {
|
||||
postSingle("/send-sms/single", request, ctx);
|
||||
public NotiHubSendSingleResponseDto sendSmsSingle(
|
||||
NotiHubSendRequestSingleDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return postSingle("/send-sms/single", request, ctx);
|
||||
}
|
||||
|
||||
public NotiHubSendSingleResponseDto sendKkoSingle(
|
||||
NotiHubSendRequestSingleDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return postSingle("/send-kko/single", request, ctx);
|
||||
}
|
||||
|
||||
public String createKkoBulk(NotiHubBulkSendCreateRequestDto request) {
|
||||
return createBulk("/send-kko/create/bulk", request);
|
||||
}
|
||||
|
||||
public NotiHubBulkSendResponseDto sendKkoBulk(NotiHubSendRequestBulkDto request) {
|
||||
return sendBulk("/send-kko/bulk", request);
|
||||
}
|
||||
|
||||
public ResponseEntity<List<NotiHubKkoSenderProfileDto>> getKkoSenderProfiles(
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return relay(request, null, new ParameterizedTypeReference<>() {}, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<NotiHubKkoTemplateListResponseDto> getKkoTemplateList(
|
||||
NotiHubKkoTemplateListRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return relay(request, body, NotiHubKkoTemplateListResponseDto.class, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<NotiHubKkoTemplateDetailDto> getKkoTemplateDetail(
|
||||
NotiHubKkoTemplateDetailRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return relay(request, body, NotiHubKkoTemplateDetailDto.class, ctx);
|
||||
}
|
||||
|
||||
public String createEmailBulk(NotiHubBulkSendCreateRequestDto request) {
|
||||
@@ -85,13 +192,128 @@ public class NotiHubApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
private void postSingle(String path, NotiHubSendRequestSingleDto request, RequestUserContext ctx) {
|
||||
post(urlWithContext(path, ctx), request);
|
||||
public ResponseEntity<List<NotiHubTemplateSummaryDto>> getTemplateList(
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return relay(request, null, new ParameterizedTypeReference<>() {}, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<NotiHubTemplateDetailDto> getTemplate(
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return relay(request, null, NotiHubTemplateDetailDto.class, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<byte[]> deleteTemplate(
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return forward(request, null, null, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<NotiHubTemplateDetailDto> createTemplate(
|
||||
NotiHubTemplateBasicDto template,
|
||||
List<MultipartFile> files,
|
||||
List<String> deleteFileNames,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return saveTemplate(template, files, deleteFileNames, request, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<NotiHubTemplateDetailDto> updateTemplate(
|
||||
NotiHubTemplateDetailDto template,
|
||||
List<MultipartFile> files,
|
||||
List<String> deleteFileNames,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return saveTemplate(template, files, deleteFileNames, request, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<List<NotiHubBulkSendInfoDto>> getBulkList(
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return relay(request, null, new ParameterizedTypeReference<>() {}, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<List<NotiHubSendResultInfoDto>> getSendResult(
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return relay(request, null, new ParameterizedTypeReference<>() {}, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<NotiHubReportPageResponseDto<NotiHubSendResultInfoDto>> getBulkDetail(
|
||||
NotiHubReportPageRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return relay(request, body, new ParameterizedTypeReference<>() {}, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<NotiHubReportExcelResponseDto> getBulkDetailExcel(
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return relay(request, null, NotiHubReportExcelResponseDto.class, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<List<NotiHubSendResultSummaryResponseDto>> getSendResultSummary(
|
||||
NotiHubSendResultSummaryRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return relay(request, body, new ParameterizedTypeReference<>() {}, ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<byte[]> getTemplateAttachment(
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return forward(request, null, request.getContentType(), ctx);
|
||||
}
|
||||
|
||||
public ResponseEntity<String> uploadBodyImage(
|
||||
MultipartFile file,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
|
||||
parts.add("file", toFilePart(file));
|
||||
ResponseEntity<byte[]> response = relayMultipart(request, parts, ctx);
|
||||
byte[] body = response.getBody();
|
||||
return ResponseEntity.status(response.getStatusCode())
|
||||
.headers(response.getHeaders())
|
||||
.body(body == null ? null : new String(body, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private NotiHubSendSingleResponseDto postSingle(
|
||||
String path,
|
||||
NotiHubSendRequestSingleDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
String url = urlWithContext(path, ctx);
|
||||
try {
|
||||
ExternalApiResponse response = post(url, request);
|
||||
return objectMapper.readValue(response.getBody(), NotiHubSendSingleResponseDto.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw BusinessException.badRequest("NOTI_HUB_RESPONSE_PARSE_FAILED", "noti-hub 응답을 해석할 수 없습니다.")
|
||||
.with("url", url);
|
||||
}
|
||||
}
|
||||
|
||||
private String createBulk(String path, NotiHubBulkSendCreateRequestDto request) {
|
||||
ExternalApiResponse response = put(notiHubBaseUrl + path, request);
|
||||
return response.getBody();
|
||||
ExternalApiResponse response = put(notiHubBaseUrl + path, request).requireSuccess();
|
||||
String bulkSendKey = response.getBody();
|
||||
if (bulkSendKey == null || bulkSendKey.isBlank() || bulkSendKey.length() != 32) {
|
||||
throw BusinessException.of(HttpStatus.BAD_GATEWAY, "NOTI_HUB_BULK_KEY_INVALID",
|
||||
"noti-hub 대량 발송 키가 올바르지 않습니다.");
|
||||
}
|
||||
return bulkSendKey;
|
||||
}
|
||||
|
||||
private NotiHubBulkSendResponseDto sendBulk(String path, NotiHubSendRequestBulkDto request) {
|
||||
@@ -107,7 +329,7 @@ public class NotiHubApiClient {
|
||||
|
||||
private ExternalApiResponse post(String url, Object request) {
|
||||
try {
|
||||
return externalApiClient.post(url, headers(), objectMapper.writeValueAsString(request));
|
||||
return externalApiClient.post(url, headers(), objectMapper.writeValueAsString(request)).requireSuccess();
|
||||
} catch (JsonProcessingException e) {
|
||||
throw BusinessException.badRequest("NOTI_HUB_REQUEST_SERIALIZE_FAILED", "noti-hub 요청을 생성할 수 없습니다.")
|
||||
.with("url", url);
|
||||
@@ -120,6 +342,9 @@ public class NotiHubApiClient {
|
||||
} catch (JsonProcessingException e) {
|
||||
throw BusinessException.badRequest("NOTI_HUB_REQUEST_SERIALIZE_FAILED", "noti-hub 요청을 생성할 수 없습니다.")
|
||||
.with("url", url);
|
||||
} catch (RuntimeException e) {
|
||||
throw BusinessException.of(HttpStatus.BAD_GATEWAY, "NOTI_HUB_CALL_FAILED",
|
||||
"noti-hub에 연결할 수 없습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,4 +368,239 @@ public class NotiHubApiClient {
|
||||
headers.put("Content-Type", "application/json");
|
||||
return headers;
|
||||
}
|
||||
|
||||
private <T> ResponseEntity<T> relay(
|
||||
HttpServletRequest request,
|
||||
Object body,
|
||||
Class<T> responseType,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return relay(request, body, ParameterizedTypeReference.forType(responseType), ctx);
|
||||
}
|
||||
|
||||
private <T> ResponseEntity<T> relay(
|
||||
HttpServletRequest request,
|
||||
Object body,
|
||||
ParameterizedTypeReference<T> responseType,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
ResponseEntity<byte[]> response = forward(request, toJsonBytes(body), request.getContentType(), ctx);
|
||||
return readJsonResponse(response, responseType);
|
||||
}
|
||||
|
||||
private ResponseEntity<NotiHubTemplateDetailDto> saveTemplate(
|
||||
NotiHubTemplateBasicDto template,
|
||||
List<MultipartFile> files,
|
||||
List<String> deleteFileNames,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
|
||||
HttpHeaders templateHeaders = new HttpHeaders();
|
||||
templateHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
parts.add("template", new HttpEntity<>(toJsonBytes(template), templateHeaders));
|
||||
|
||||
if (files != null) {
|
||||
files.forEach(file -> parts.add("files", toFilePart(file)));
|
||||
}
|
||||
if (deleteFileNames != null) {
|
||||
deleteFileNames.forEach(fileName -> parts.add("deleteFileNames", fileName));
|
||||
}
|
||||
return readJsonResponse(relayMultipart(request, parts, ctx),
|
||||
ParameterizedTypeReference.forType(NotiHubTemplateDetailDto.class));
|
||||
}
|
||||
|
||||
private byte[] toJsonBytes(Object body) {
|
||||
if (body == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return objectMapper.writeValueAsBytes(body);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw BusinessException.internalError("NOTI_HUB_REQUEST_WRITE_FAILED",
|
||||
"NotiHub request serialization failed.");
|
||||
}
|
||||
}
|
||||
|
||||
private <T> ResponseEntity<T> readJsonResponse(
|
||||
ResponseEntity<byte[]> response,
|
||||
ParameterizedTypeReference<T> responseType
|
||||
) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.putAll(response.getHeaders());
|
||||
// JSON serialization changes the bytes; upstream representation headers no longer apply.
|
||||
headers.remove(HttpHeaders.CONTENT_LENGTH);
|
||||
headers.remove(HttpHeaders.CONTENT_ENCODING);
|
||||
headers.remove(HttpHeaders.ETAG);
|
||||
if (headers.getContentType() == null) {
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
}
|
||||
byte[] body = response.getBody();
|
||||
if (body == null || body.length == 0) {
|
||||
return ResponseEntity.status(response.getStatusCode()).headers(headers).build();
|
||||
}
|
||||
try {
|
||||
T result = objectMapper.readValue(body,
|
||||
objectMapper.getTypeFactory().constructType(responseType.getType()));
|
||||
return ResponseEntity.status(response.getStatusCode()).headers(headers).body(result);
|
||||
} catch (IOException e) {
|
||||
throw BusinessException.of(HttpStatus.BAD_GATEWAY, "NOTI_HUB_RESPONSE_READ_FAILED",
|
||||
"NotiHub response deserialization failed.");
|
||||
}
|
||||
}
|
||||
|
||||
private ResponseEntity<byte[]> forward(
|
||||
HttpServletRequest request,
|
||||
byte[] body,
|
||||
String contentType,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
BypassForwardOptions options = BypassForwardOptions.builder()
|
||||
.stripPrefix("/api/v1")
|
||||
.requestCustomizer((incomingRequest, context) ->
|
||||
createNotiHubRequest(incomingRequest, contentType, ctx))
|
||||
.build();
|
||||
|
||||
BypassResponse response;
|
||||
try {
|
||||
response = bypassClient.forward("noti-hub", request, body, options);
|
||||
} catch (BusinessException e) {
|
||||
if ("BYPASS_CALL_FAILED".equals(e.getCode())) {
|
||||
throw BusinessException.of(
|
||||
HttpStatus.BAD_GATEWAY,
|
||||
"NOTI_HUB_CALL_FAILED",
|
||||
"noti-hub에 연결할 수 없습니다."
|
||||
);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return toResponseEntity(response, request);
|
||||
}
|
||||
|
||||
private ResponseEntity<byte[]> relayMultipart(
|
||||
HttpServletRequest request,
|
||||
MultiValueMap<String, Object> parts,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
ByteArrayOutputStream bodyBuffer = new ByteArrayOutputStream();
|
||||
HttpHeaders multipartHeaders = new HttpHeaders();
|
||||
HttpOutputMessage output = new HttpOutputMessage() {
|
||||
@Override
|
||||
public OutputStream getBody() {
|
||||
return bodyBuffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpHeaders getHeaders() {
|
||||
return multipartHeaders;
|
||||
}
|
||||
};
|
||||
|
||||
FormHttpMessageConverter converter = new FormHttpMessageConverter();
|
||||
converter.setCharset(StandardCharsets.UTF_8);
|
||||
|
||||
try {
|
||||
converter.write(parts, MediaType.MULTIPART_FORM_DATA, output);
|
||||
} catch (IOException e) {
|
||||
throw BusinessException.internalError(
|
||||
"NOTI_HUB_REQUEST_READ_FAILED",
|
||||
"noti-hub 요청 파일을 읽을 수 없습니다."
|
||||
);
|
||||
}
|
||||
|
||||
return forward(
|
||||
request,
|
||||
bodyBuffer.toByteArray(),
|
||||
multipartHeaders.getFirst(HttpHeaders.CONTENT_TYPE),
|
||||
ctx
|
||||
);
|
||||
}
|
||||
|
||||
private BypassRequest createNotiHubRequest(
|
||||
BypassRequest incomingRequest,
|
||||
String contentType,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return BypassRequest.builder()
|
||||
.method(incomingRequest.method())
|
||||
.path(toNotiHubPath(incomingRequest.path()))
|
||||
.queryParams(queryWithAuthenticatedUser(incomingRequest.queryParams(), ctx))
|
||||
.headers(createApiKeyHeaders(contentType))
|
||||
.body(incomingRequest.body())
|
||||
.build();
|
||||
}
|
||||
|
||||
private String toNotiHubPath(String path) {
|
||||
String notiHubPath = replacePathPrefix(path, "/message-send/cancel", "/send/cancel");
|
||||
notiHubPath = replacePathPrefix(notiHubPath, "/message-template", "/template");
|
||||
notiHubPath = replacePathPrefix(notiHubPath, "/message-report", "/report");
|
||||
return replacePathPrefix(notiHubPath, "/report/bulk-detail-excel", "/report/bulk-detail/excel");
|
||||
}
|
||||
|
||||
private String replacePathPrefix(String path, String prefix, String replacement) {
|
||||
if (path.equals(prefix) || path.startsWith(prefix + "/")) {
|
||||
return replacement + path.substring(prefix.length());
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
private Map<String, List<String>> queryWithAuthenticatedUser(
|
||||
Map<String, List<String>> incomingQuery,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
Map<String, List<String>> query = new LinkedHashMap<>(incomingQuery);
|
||||
replaceUserParameter(query, "userId", ctx.getUserId());
|
||||
replaceUserParameter(query, "userCmpn", ctx.getUserCmpn());
|
||||
replaceUserParameter(query, "userTeam", ctx.getUserTeam());
|
||||
replaceUserParameter(query, "userName", ctx.getUserName());
|
||||
replaceUserParameter(query, "userRole", ctx.getUserRole());
|
||||
replaceUserParameter(query, "clientIp", ctx.getClientIp());
|
||||
replaceUserParameter(query, "authenticated", ctx.isAuthenticated());
|
||||
return query;
|
||||
}
|
||||
|
||||
private Map<String, List<String>> createApiKeyHeaders(String contentType) {
|
||||
Map<String, List<String>> headers = new LinkedHashMap<>();
|
||||
headers.put(apiKeyHeaderName, List.of(apiKey));
|
||||
if (contentType != null) {
|
||||
headers.put(HttpHeaders.CONTENT_TYPE, List.of(contentType));
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
|
||||
private ResponseEntity<byte[]> toResponseEntity(
|
||||
BypassResponse response,
|
||||
HttpServletRequest request
|
||||
) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.putAll(response.httpHeaders());
|
||||
|
||||
boolean successful = HttpStatusCode.valueOf(response.statusCode()).is2xxSuccessful();
|
||||
boolean attachmentDownload = request.getRequestURI().endsWith("/attachment");
|
||||
if (successful && attachmentDownload && headers.getContentType() == null) {
|
||||
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
}
|
||||
|
||||
return ResponseEntity.status(response.statusCode())
|
||||
.headers(headers)
|
||||
.body(response.body());
|
||||
}
|
||||
|
||||
private HttpEntity<?> toFilePart(MultipartFile file) {
|
||||
String contentType = file.getContentType();
|
||||
MediaType mediaType = contentType == null
|
||||
? MediaType.APPLICATION_OCTET_STREAM
|
||||
: MediaType.parseMediaType(contentType);
|
||||
|
||||
HttpHeaders fileHeaders = new HttpHeaders();
|
||||
fileHeaders.setContentType(mediaType);
|
||||
return new HttpEntity<>(file.getResource(), fileHeaders);
|
||||
}
|
||||
|
||||
private void replaceUserParameter(Map<String, List<String>> query, String name, Object value) {
|
||||
query.remove(name);
|
||||
if (value != null) {
|
||||
query.put(name, List.of(String.valueOf(value)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,38 @@
|
||||
package com.kri.contact.server.common.external.notihub;
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@Schema(description = "NotiHubBulkSendCreateRequestDto")
|
||||
public class NotiHubBulkSendCreateRequestDto {
|
||||
public record NotiHubBulkSendCreateRequestDto(
|
||||
|
||||
@Schema(description = "reqstCmpn")
|
||||
private String reqstCmpn;
|
||||
String reqstCmpn,
|
||||
|
||||
@Schema(description = "reqstUser")
|
||||
private String reqstUser;
|
||||
String reqstUser,
|
||||
|
||||
@Schema(description = "reqstSvc")
|
||||
private String reqstSvc;
|
||||
String reqstSvc,
|
||||
|
||||
@Schema(description = "prjctCd")
|
||||
private String prjctCd;
|
||||
String prjctCd,
|
||||
|
||||
@Schema(description = "tmplatIdx")
|
||||
private Long tmplatIdx;
|
||||
Long tmplatIdx,
|
||||
|
||||
@Schema(description = "resve")
|
||||
private Boolean resve;
|
||||
Boolean resve,
|
||||
|
||||
@Schema(description = "sendDt")
|
||||
private LocalDateTime sendDt;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
LocalDateTime sendDt,
|
||||
|
||||
@Schema(description = "trgtCnt")
|
||||
private Integer trgtCnt;
|
||||
Integer trgtCnt
|
||||
) {
|
||||
}
|
||||
40
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubBulkSendInfoDto.java
vendored
Normal file
40
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubBulkSendInfoDto.java
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "NotiHub bulk send history")
|
||||
public class NotiHubBulkSendInfoDto extends NotiHubExtensibleDto {
|
||||
|
||||
private String bulkSendKey;
|
||||
|
||||
private String reqstSvc;
|
||||
|
||||
private String prjctCd;
|
||||
|
||||
private Long tmplatIdx;
|
||||
|
||||
private Boolean resve;
|
||||
|
||||
private LocalDateTime sendDt;
|
||||
|
||||
private Integer trgtCnt;
|
||||
|
||||
private Integer sendCnt;
|
||||
|
||||
private Integer succesCnt;
|
||||
|
||||
private Integer failCnt;
|
||||
|
||||
private LocalDateTime completeDt;
|
||||
|
||||
private String regUser;
|
||||
|
||||
private LocalDateTime regDt;
|
||||
}
|
||||
@@ -1,25 +1,23 @@
|
||||
package com.kri.contact.server.common.external.notihub;
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Schema(description = "NotiHubBulkSendResponseDto")
|
||||
public class NotiHubBulkSendResponseDto {
|
||||
public record NotiHubBulkSendResponseDto(
|
||||
|
||||
@Schema(description = "bulkSendKey")
|
||||
private String bulkSendKey;
|
||||
String bulkSendKey,
|
||||
|
||||
@Schema(description = "requestCount")
|
||||
private Integer requestCount;
|
||||
Integer requestCount,
|
||||
|
||||
@Schema(description = "acceptCount")
|
||||
private Integer acceptCount;
|
||||
Integer acceptCount,
|
||||
|
||||
@Schema(description = "failCount")
|
||||
private Integer failCount;
|
||||
Integer failCount
|
||||
) {
|
||||
}
|
||||
@@ -1,24 +1,27 @@
|
||||
package com.kri.contact.server.common.external.notihub;
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.Map;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@Schema(description = "NotiHubDestInfoDto")
|
||||
public class NotiHubDestInfoDto {
|
||||
public record NotiHubDestInfoDto(
|
||||
|
||||
@Schema(description = "sid")
|
||||
private String sid;
|
||||
String sid,
|
||||
|
||||
@Schema(description = "destEml")
|
||||
private String destEml;
|
||||
String destEml,
|
||||
|
||||
@Schema(description = "destTel")
|
||||
private String destTel;
|
||||
String destTel,
|
||||
|
||||
@Schema(description = "destNm")
|
||||
private String destNm;
|
||||
String destNm,
|
||||
|
||||
@Schema(description = "msgParam")
|
||||
private Map<String, String> msgParam;
|
||||
Map<String, String> msgParam
|
||||
) {
|
||||
}
|
||||
24
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubExtensibleDto.java
vendored
Normal file
24
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubExtensibleDto.java
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class NotiHubExtensibleDto {
|
||||
|
||||
private final Map<String, JsonNode> additionalProperties = new LinkedHashMap<>();
|
||||
|
||||
@JsonAnyGetter
|
||||
@Schema(hidden = true)
|
||||
public Map<String, JsonNode> getAdditionalProperties() {
|
||||
return additionalProperties;
|
||||
}
|
||||
|
||||
@JsonAnySetter
|
||||
public void setAdditionalProperty(String name, JsonNode value) {
|
||||
additionalProperties.put(name, value);
|
||||
}
|
||||
}
|
||||
11
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubKkoSenderProfileDto.java
vendored
Normal file
11
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubKkoSenderProfileDto.java
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema(description = "Kakao sender profile")
|
||||
public record NotiHubKkoSenderProfileDto(
|
||||
String senderKey,
|
||||
String name,
|
||||
String uuid
|
||||
) {
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import java.util.List;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record NotiHubKkoTemplateDetailDto(
|
||||
|
||||
String templateCode,
|
||||
|
||||
String templateName,
|
||||
|
||||
String templateContent,
|
||||
|
||||
String templatePreviewMessage,
|
||||
|
||||
String templateMessageType,
|
||||
|
||||
String templateEmphasizeType,
|
||||
|
||||
String inspectionStatus,
|
||||
|
||||
String status,
|
||||
|
||||
Boolean block,
|
||||
|
||||
Boolean dormant,
|
||||
|
||||
String templateExtra,
|
||||
|
||||
String templateImageName,
|
||||
|
||||
String templateImageUrl,
|
||||
|
||||
String templateTitle,
|
||||
|
||||
String templateSubtitle,
|
||||
|
||||
String templateHeader,
|
||||
|
||||
JsonNode templateItemHighlight,
|
||||
|
||||
JsonNode templateItem,
|
||||
|
||||
JsonNode templateRepresentLink,
|
||||
|
||||
List<JsonNode> buttons,
|
||||
|
||||
List<JsonNode> quickReplies
|
||||
) {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
public record NotiHubKkoTemplateDetailRequestDto(
|
||||
|
||||
@Schema(description = "Selected sender profile key; validated by NotiHub", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
String senderKey,
|
||||
@NotBlank
|
||||
@Size(max = 30)
|
||||
@Pattern(regexp = "[A-Za-z0-9_-]+")
|
||||
String templateCode
|
||||
) {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
public record NotiHubKkoTemplateListRequestDto(
|
||||
|
||||
@Schema(description = "Selected sender profile key; validated by NotiHub", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
String senderKey,
|
||||
@Size(min = 2, max = 50)
|
||||
String keyword
|
||||
) {
|
||||
|
||||
public NotiHubKkoTemplateListRequestDto {
|
||||
keyword = keyword == null || keyword.isBlank() ? null : keyword.trim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record NotiHubKkoTemplateListResponseDto(
|
||||
|
||||
int totalCount,
|
||||
|
||||
int totalPage,
|
||||
|
||||
int currentPage,
|
||||
|
||||
List<NotiHubKkoTemplateSummaryDto> list
|
||||
) {
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record NotiHubKkoTemplateSummaryDto(
|
||||
|
||||
String templateCode,
|
||||
|
||||
String templateName,
|
||||
|
||||
String serviceStatus,
|
||||
|
||||
String createdAt,
|
||||
|
||||
String modifiedAt
|
||||
) {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "NotiHub report Excel download")
|
||||
public class NotiHubReportExcelResponseDto extends NotiHubExtensibleDto {
|
||||
|
||||
private String fileName;
|
||||
|
||||
private String fileBase64;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.kri.common.feature.web.page.PageRequestDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "NotiHub report page request")
|
||||
public class NotiHubReportPageRequestDto extends PageRequestDto {
|
||||
|
||||
private final Map<String, JsonNode> additionalProperties = new LinkedHashMap<>();
|
||||
|
||||
@JsonAnyGetter
|
||||
@Schema(hidden = true)
|
||||
public Map<String, JsonNode> getAdditionalProperties() {
|
||||
return additionalProperties;
|
||||
}
|
||||
|
||||
@JsonAnySetter
|
||||
public void setAdditionalProperty(String name, JsonNode value) {
|
||||
additionalProperties.put(name, value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonUnwrapped;
|
||||
import com.kri.common.feature.web.page.PageResponseDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
|
||||
@Schema(description = "NotiHub report page response")
|
||||
public class NotiHubReportPageResponseDto<T> extends NotiHubExtensibleDto {
|
||||
|
||||
@Getter
|
||||
@JsonUnwrapped
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private final PageResponseDto<T> page;
|
||||
|
||||
// The shared response has no public Jackson constructor; adapt without recalculating metadata.
|
||||
@JsonCreator
|
||||
public NotiHubReportPageResponseDto(
|
||||
@JsonProperty("content") List<T> content,
|
||||
@JsonProperty("totalElements") long totalElements,
|
||||
@JsonProperty("totalPages") int totalPages,
|
||||
@JsonProperty("pageIndex") int pageIndex,
|
||||
@JsonProperty("pageSize") int pageSize,
|
||||
@JsonProperty("numberOfElements") int numberOfElements,
|
||||
@JsonProperty("first") boolean first,
|
||||
@JsonProperty("last") boolean last,
|
||||
@JsonProperty("empty") boolean empty
|
||||
) {
|
||||
page = PageResponseDto.<T>builder()
|
||||
.content(content)
|
||||
.totalElements(totalElements)
|
||||
.totalPages(totalPages)
|
||||
.pageIndex(pageIndex)
|
||||
.pageSize(pageSize)
|
||||
.numberOfElements(numberOfElements)
|
||||
.first(first)
|
||||
.last(last)
|
||||
.empty(empty)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,27 @@
|
||||
package com.kri.contact.server.common.external.notihub;
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@Schema(description = "NotiHubSendRequestBulkDto")
|
||||
public class NotiHubSendRequestBulkDto {
|
||||
public record NotiHubSendRequestBulkDto(
|
||||
|
||||
@Schema(description = "sendEml")
|
||||
private String sendEml;
|
||||
String sendEml,
|
||||
|
||||
@Schema(description = "sendTel")
|
||||
private String sendTel;
|
||||
String sendTel,
|
||||
|
||||
@Schema(description = "sendNm")
|
||||
private String sendNm;
|
||||
String sendNm,
|
||||
|
||||
@Schema(description = "bulkSendKey")
|
||||
private String bulkSendKey;
|
||||
String bulkSendKey,
|
||||
|
||||
@Schema(description = "destInfoList")
|
||||
private List<NotiHubDestInfoDto> destInfoList;
|
||||
List<NotiHubDestInfoDto> destInfoList
|
||||
) {
|
||||
}
|
||||
@@ -1,32 +1,39 @@
|
||||
package com.kri.contact.server.common.external.notihub;
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@Schema(description = "NotiHubSendRequestSingleDto")
|
||||
public class NotiHubSendRequestSingleDto {
|
||||
public record NotiHubSendRequestSingleDto(
|
||||
|
||||
@Schema(description = "sendEml")
|
||||
private String sendEml;
|
||||
String sendEml,
|
||||
|
||||
@Schema(description = "sendTel")
|
||||
private String sendTel;
|
||||
String sendTel,
|
||||
|
||||
@Schema(description = "sendNm")
|
||||
private String sendNm;
|
||||
String sendNm,
|
||||
|
||||
@Schema(description = "destInfo")
|
||||
private NotiHubDestInfoDto destInfo;
|
||||
NotiHubDestInfoDto destInfo,
|
||||
|
||||
@Schema(description = "tmplatIdx")
|
||||
private Long tmplatIdx;
|
||||
Long tmplatIdx,
|
||||
|
||||
@Schema(description = "reqstSvc")
|
||||
private String reqstSvc;
|
||||
String reqstSvc,
|
||||
|
||||
@Schema(description = "prjctCd")
|
||||
private String prjctCd;
|
||||
String prjctCd,
|
||||
|
||||
@Schema(description = "resve")
|
||||
private Boolean resve;
|
||||
Boolean resve,
|
||||
|
||||
@Schema(description = "sendDt")
|
||||
private LocalDateTime sendDt;
|
||||
LocalDateTime sendDt
|
||||
) {
|
||||
}
|
||||
60
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubSendResultInfoDto.java
vendored
Normal file
60
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubSendResultInfoDto.java
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "NotiHub send result")
|
||||
public class NotiHubSendResultInfoDto extends NotiHubExtensibleDto {
|
||||
|
||||
private String cmid;
|
||||
|
||||
private String bulkSendKey;
|
||||
|
||||
private String itrntPrjctCd;
|
||||
|
||||
private String reqstSvc;
|
||||
|
||||
private String prjctCd;
|
||||
|
||||
private String sid;
|
||||
|
||||
private Short sendTy;
|
||||
|
||||
private Boolean resve;
|
||||
|
||||
private Short resultCode;
|
||||
|
||||
private String resultLabel;
|
||||
|
||||
private String resultViewLabel;
|
||||
|
||||
private Long tmplatIdx;
|
||||
|
||||
private String kkoTmplatCd;
|
||||
|
||||
private String sendEml;
|
||||
|
||||
private String sendTel;
|
||||
|
||||
private String sendNm;
|
||||
|
||||
private LocalDateTime sendDt;
|
||||
|
||||
private String destEml;
|
||||
|
||||
private String destNm;
|
||||
|
||||
private String destTel;
|
||||
|
||||
private String regCmpn;
|
||||
|
||||
private String regUser;
|
||||
|
||||
private LocalDateTime regDt;
|
||||
}
|
||||
@@ -1,34 +1,29 @@
|
||||
package com.kri.contact.server.common.external.notihub;
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Schema(description = "NotiHubSendResultLastWithSidDto")
|
||||
public class NotiHubSendResultLastWithSidDto {
|
||||
public record NotiHubSendResultLastWithSidDto(
|
||||
|
||||
@Schema(description = "sid")
|
||||
private String sid;
|
||||
String sid,
|
||||
|
||||
@Schema(description = "lastResultCode")
|
||||
private Integer lastResultCode;
|
||||
Integer lastResultCode,
|
||||
|
||||
@Schema(description = "lastResultLabel")
|
||||
private String lastResultLabel;
|
||||
String lastResultLabel,
|
||||
|
||||
@Schema(description = "lastResultViewLabel")
|
||||
private String lastResultViewLabel;
|
||||
String lastResultViewLabel,
|
||||
|
||||
@Schema(description = "lastSendDt")
|
||||
private LocalDateTime lastSendDt;
|
||||
LocalDateTime lastSendDt,
|
||||
|
||||
@Schema(description = "totalSendCount")
|
||||
private Integer totalSendCount;
|
||||
Integer totalSendCount
|
||||
) {
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "NotiHub send result summary request")
|
||||
public class NotiHubSendResultSummaryRequestDto extends NotiHubExtensibleDto {
|
||||
|
||||
private String bulkSendKey;
|
||||
|
||||
private String itrntPrjctCd;
|
||||
|
||||
private String reqstSvc;
|
||||
|
||||
private String prjctCd;
|
||||
|
||||
private LocalDateTime sendStartDt;
|
||||
|
||||
private LocalDateTime sendEndDt;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "NotiHub send result summary")
|
||||
public class NotiHubSendResultSummaryResponseDto extends NotiHubExtensibleDto {
|
||||
|
||||
private Short sendTy;
|
||||
|
||||
private Short sendCorp;
|
||||
|
||||
private Long successCount;
|
||||
|
||||
private Long failCount;
|
||||
|
||||
private Long standByCount;
|
||||
|
||||
private Long totalCount;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private BigDecimal cost;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.Map;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Schema(description = "NotiHubSendSingleResponseDto")
|
||||
public record NotiHubSendSingleResponseDto(
|
||||
|
||||
@Schema(description = "NotiHub send identifier for single cancellation")
|
||||
Long sendIdx,
|
||||
|
||||
@Schema(description = "cmid")
|
||||
String cmid,
|
||||
|
||||
@Schema(description = "data")
|
||||
Map<String, Object> data
|
||||
) {
|
||||
}
|
||||
59
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubTemplateBasicDto.java
vendored
Normal file
59
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubTemplateBasicDto.java
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "NotiHub template creation request")
|
||||
public class NotiHubTemplateBasicDto extends NotiHubExtensibleDto {
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 32)
|
||||
private String itrntPrjctCd;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "NotiHub SendType code")
|
||||
private Short tmplatTy;
|
||||
|
||||
@Schema(description = "NotiHub TemplatePurpose code", allowableValues = {"0", "1"})
|
||||
private Short tmplatPurpose;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 128)
|
||||
private String tmplatNm;
|
||||
|
||||
@Size(max = 128)
|
||||
private String tmplatTitle;
|
||||
|
||||
private String tmplatBody;
|
||||
|
||||
private String senderKey;
|
||||
|
||||
private String kkoTmplatCd;
|
||||
|
||||
private String nationCd;
|
||||
|
||||
@Schema(accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String atchFl;
|
||||
|
||||
private Short delayTime;
|
||||
|
||||
@Size(max = 16)
|
||||
private String sendTel;
|
||||
|
||||
@Email
|
||||
@Size(max = 64)
|
||||
private String sendEml;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 32)
|
||||
private String sendNm;
|
||||
}
|
||||
30
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubTemplateDetailDto.java
vendored
Normal file
30
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubTemplateDetailDto.java
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "NotiHub template detail and update request")
|
||||
public class NotiHubTemplateDetailDto extends NotiHubTemplateBasicDto {
|
||||
|
||||
@NotNull
|
||||
private Long tmplatIdx;
|
||||
|
||||
@Schema(accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String regUser;
|
||||
|
||||
@Schema(accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Schema(accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String modUser;
|
||||
|
||||
@Schema(accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private LocalDateTime modDt;
|
||||
}
|
||||
@@ -1,27 +1,32 @@
|
||||
package com.kri.contact.server.common.external.notihub;
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Schema(description = "NotiHubTemplateDto")
|
||||
public class NotiHubTemplateDto {
|
||||
public record NotiHubTemplateDto(
|
||||
|
||||
@Schema(description = "tmplatIdx")
|
||||
private Long tmplatIdx;
|
||||
Long tmplatIdx,
|
||||
|
||||
@Schema(description = "tmplatPurpose")
|
||||
Integer tmplatPurpose,
|
||||
|
||||
@Schema(description = "tmplatTitle")
|
||||
String tmplatTitle,
|
||||
|
||||
@Schema(description = "tmplatBody")
|
||||
private String tmplatBody;
|
||||
String tmplatBody,
|
||||
|
||||
@Schema(description = "sendTel")
|
||||
private String sendTel;
|
||||
String sendTel,
|
||||
|
||||
@Schema(description = "sendEml")
|
||||
private String sendEml;
|
||||
String sendEml,
|
||||
|
||||
@Schema(description = "sendNm")
|
||||
private String sendNm;
|
||||
String sendNm
|
||||
) {
|
||||
}
|
||||
19
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubTemplateSummaryDto.java
vendored
Normal file
19
src/main/java/com/kri/contact/server/common/external/notihub/dto/NotiHubTemplateSummaryDto.java
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.kri.contact.server.common.external.notihub.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "NotiHub template summary")
|
||||
public class NotiHubTemplateSummaryDto extends NotiHubExtensibleDto {
|
||||
|
||||
private Long tmplatIdx;
|
||||
|
||||
private String tmplatNm;
|
||||
|
||||
private Short tmplatPurpose;
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.kri.contact.server.common.external.shorturl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class ShortUrlCreateRequestDto {
|
||||
public record ShortUrlCreateRequestDto(
|
||||
|
||||
private String orgUrl;
|
||||
private boolean useParam;
|
||||
String orgUrl,
|
||||
|
||||
boolean useParam
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.kri.contact.server.common.jpa;
|
||||
|
||||
import com.kri.common.feature.jpa.AbstractCodeEnumConverter;
|
||||
import com.kri.contact.server.common.enums.CallStatus;
|
||||
import jakarta.persistence.Converter;
|
||||
|
||||
@Converter(autoApply = false)
|
||||
public class CallStatusConverter extends AbstractCodeEnumConverter<CallStatus, Short> {
|
||||
|
||||
public CallStatusConverter() {
|
||||
super(CallStatus.class);
|
||||
}
|
||||
}
|
||||
111
src/main/java/com/kri/contact/server/common/util/SidUtil.java
Normal file
111
src/main/java/com/kri/contact/server/common/util/SidUtil.java
Normal file
@@ -0,0 +1,111 @@
|
||||
package com.kri.contact.server.common.util;
|
||||
|
||||
import com.kri.common.feature.web.BusinessException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public final class SidUtil {
|
||||
|
||||
private static final int MAX_LENGTH = 32;
|
||||
private static final Pattern SID_PATTERN = Pattern.compile(
|
||||
"^[A-Za-z0-9](?:[A-Za-z0-9_-]{0,30}[A-Za-z0-9])?$"
|
||||
);
|
||||
private static final Pattern NUMERIC_PATTERN = Pattern.compile("^[0-9]{1,32}$");
|
||||
|
||||
private SidUtil() {
|
||||
}
|
||||
|
||||
public static String normalizeSid(String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
String normalized = value.trim();
|
||||
return SID_PATTERN.matcher(normalized).matches() ? normalized : null;
|
||||
}
|
||||
|
||||
public static String requireSid(String value) {
|
||||
String normalized = normalizeSid(value);
|
||||
if (normalized == null) {
|
||||
throw BusinessException.badRequest(
|
||||
"INVALID_SID",
|
||||
"SID는 영문 대소문자, 숫자, -, _만 사용할 수 있으며 시작과 끝은 영문 또는 숫자여야 합니다."
|
||||
).with("maxLength", MAX_LENGTH);
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
public static Optional<SidFilterCondition> parseFilterCondition(String value) {
|
||||
if (value == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
String normalized = value.trim();
|
||||
if (normalized.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
if (!normalized.contains("~")) {
|
||||
String sid = normalizeSid(normalized);
|
||||
return sid == null
|
||||
? Optional.empty()
|
||||
: Optional.of(SidFilterCondition.exact(sid));
|
||||
}
|
||||
|
||||
String[] tokens = normalized.split("~", -1);
|
||||
if (tokens.length != 2) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
String startToken = tokens[0].trim();
|
||||
String endToken = tokens[1].trim();
|
||||
if (!NUMERIC_PATTERN.matcher(startToken).matches()
|
||||
|| !NUMERIC_PATTERN.matcher(endToken).matches()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
BigDecimal start = new BigDecimal(startToken);
|
||||
BigDecimal end = new BigDecimal(endToken);
|
||||
if (start.compareTo(end) > 0) {
|
||||
BigDecimal temp = start;
|
||||
start = end;
|
||||
end = temp;
|
||||
}
|
||||
return Optional.of(SidFilterCondition.range(start, end));
|
||||
}
|
||||
|
||||
public static void requireValidFilterConditions(Collection<String> conditions) {
|
||||
if (conditions == null || conditions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String condition : conditions) {
|
||||
if (parseFilterCondition(condition).isEmpty()) {
|
||||
throw BusinessException.badRequest(
|
||||
"INVALID_SID_FILTER",
|
||||
"SID 필터는 유효한 SID 또는 숫자~숫자 형식이어야 합니다."
|
||||
).with("sidCondition", condition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public record SidFilterCondition(
|
||||
String exactSid,
|
||||
BigDecimal rangeStart,
|
||||
BigDecimal rangeEnd
|
||||
) {
|
||||
|
||||
private static SidFilterCondition exact(String sid) {
|
||||
return new SidFilterCondition(sid, null, null);
|
||||
}
|
||||
|
||||
private static SidFilterCondition range(BigDecimal start, BigDecimal end) {
|
||||
return new SidFilterCondition(null, start, end);
|
||||
}
|
||||
|
||||
public boolean isExact() {
|
||||
return exactSid != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.kri.contact.server.config;
|
||||
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
public class DefaultTxConfig {
|
||||
|
||||
@Bean(name = "transactionManager")
|
||||
@Primary
|
||||
public PlatformTransactionManager transactionManager(
|
||||
@Qualifier("entityManagerFactory") EntityManagerFactory emf
|
||||
) {
|
||||
return new JpaTransactionManager(emf);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.kri.contact.server.config;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Validated
|
||||
@ConfigurationProperties(prefix = "kri.list-async")
|
||||
public class ListAsyncProperties {
|
||||
@Min(1)
|
||||
private int threads = 2;
|
||||
@Min(1)
|
||||
private int queueCapacity = 10;
|
||||
@NotBlank
|
||||
@Size(max = 64)
|
||||
private String ownerInstance = "contact-server";
|
||||
@NotBlank
|
||||
private String resultBaseDir = "upload-file/list-async-results";
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.kri.contact.server.config;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Validated
|
||||
@ConfigurationProperties(prefix = "kri.list-event-history")
|
||||
public class ListEventHistoryProperties {
|
||||
|
||||
@Min(value = 1, message = "설문 이력 잠금 대기 시간은 0초보다 커야 합니다.")
|
||||
private long surveyLockWaitTimeoutSeconds;
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.datetime.DateTimeUtil;
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.dto.list.ListAssignRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListAssignResetRequestDto;
|
||||
import com.kri.contact.server.dto.assign.ProjectCompanyAssignSummaryDto;
|
||||
import com.kri.contact.server.dto.assign.ProjectFieldworkAssignSummaryDto;
|
||||
import com.kri.contact.server.service.AssignService;
|
||||
import com.kri.contact.server.service.common.SystemEventLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -12,12 +12,12 @@ import jakarta.validation.Valid;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@@ -41,6 +41,32 @@ public class AssignController {
|
||||
return assignService.getPrjctCmpnAssign(prjctIdx);
|
||||
}
|
||||
|
||||
@Operation(summary = "프로젝트 외주사별 리스트 배정 현황 조회")
|
||||
@GetMapping("/prjct-cmpn-summary/{prjctIdx}")
|
||||
public ProjectCompanyAssignSummaryDto getProjectCompanyAssignSummary(
|
||||
@PathVariable Long prjctIdx,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return assignService.getProjectCompanyAssignSummary(prjctIdx, ctx.getUserRole());
|
||||
}
|
||||
|
||||
@Operation(summary = "프로젝트 필드워커별 리스트 배정 현황 조회")
|
||||
@GetMapping("/prjct-fieldwork-summary/{prjctIdx}")
|
||||
public ProjectFieldworkAssignSummaryDto getProjectFieldworkAssignSummary(
|
||||
@PathVariable Long prjctIdx,
|
||||
@RequestParam Short assignType,
|
||||
@RequestParam(required = false) List<String> cmpnIds,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return assignService.getProjectFieldworkAssignSummary(
|
||||
prjctIdx,
|
||||
assignType,
|
||||
cmpnIds,
|
||||
ctx.getUserCmpn(),
|
||||
ctx.getUserRole()
|
||||
);
|
||||
}
|
||||
|
||||
@Operation(summary = "프로젝트 fieldwork 배정")
|
||||
@PutMapping("/prjct-fieldwork/{prjctIdx}")
|
||||
public void upsertPrjctFieldworkAssign(
|
||||
@@ -66,33 +92,4 @@ public class AssignController {
|
||||
systemEventLogService.writeAssignCmpnProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx,
|
||||
assignCmpnIdList);
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 배정")
|
||||
@PutMapping("/list/{prjctIdx}/{assignId}")
|
||||
public Integer upsertListAssign(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable String assignId,
|
||||
@Valid @RequestBody ListAssignRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
Integer assignCnt = assignService.upsertListAssign(prjctIdx, assignId, req, ctx.getUserId(), now);
|
||||
systemEventLogService.writeAssignList(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, req);
|
||||
|
||||
return assignCnt;
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 배정 초기화")
|
||||
@DeleteMapping("/list/reset/{prjctIdx}")
|
||||
public Integer resetListAssign(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody ListAssignResetRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
Integer resetCnt = assignService.resetListAssign(prjctIdx, req);
|
||||
systemEventLogService.writeAssignListReset(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, req);
|
||||
|
||||
return resetCnt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.auth.dto.JwtUserClaimsDto;
|
||||
import com.kri.common.feature.datetime.DateTimeUtil;
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.dto.auth.LoginRequestDto;
|
||||
@@ -11,6 +12,10 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.CacheControl;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.annotation.CurrentSecurityContext;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -35,11 +40,19 @@ public class AuthController {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
LoginResponseDto response = authService.tryLogin(request);
|
||||
systemEventLogService.writeLoginLog(response.getUser().getUserId(), now, ctx.getClientIp());
|
||||
systemEventLogService.writeLoginLog(response.user().getUserId(), now, ctx.getClientIp());
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Operation(summary = "현재 인증 사용자 조회")
|
||||
@GetMapping("/my-info")
|
||||
public ResponseEntity<JwtUserClaimsDto> myInfo(
|
||||
@CurrentSecurityContext(expression = "authentication.details") JwtUserClaimsDto user
|
||||
) {
|
||||
return ResponseEntity.ok().cacheControl(CacheControl.noStore()).body(user);
|
||||
}
|
||||
|
||||
@Operation(summary = "로그아웃 요청")
|
||||
@PostMapping("/logout/{userId}")
|
||||
public boolean logout(@PathVariable String userId, RequestUserContext ctx) {
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.service.KartService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/kart/project")
|
||||
@RequiredArgsConstructor
|
||||
@Validated
|
||||
public class KartController {
|
||||
|
||||
private final KartService kartService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public JsonNode projects(
|
||||
@RequestParam @NotBlank @Size(max = 32) String intranetCode,
|
||||
@RequestParam @Min(0) @Max(1) int projectType,
|
||||
@RequestParam(defaultValue = "") String keyword,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext user
|
||||
) {
|
||||
return kartService.projects(intranetCode, projectType, keyword, request, user);
|
||||
}
|
||||
|
||||
@PostMapping("/{projectType}/{pkey}/share")
|
||||
public String reportUrl(
|
||||
@PathVariable @Min(0) @Max(1) int projectType,
|
||||
@PathVariable String pkey,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext user
|
||||
) {
|
||||
return kartService.reportUrl(projectType, pkey, request, user);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.dto.list.ListEventHistDownloadRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListFilterDto;
|
||||
import com.kri.contact.server.dto.list.async.ListAsyncJobAcceptedDto;
|
||||
import com.kri.contact.server.service.async.ListAsyncDownloadService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/list/jobs/{prjctIdx}/downloads")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "ListAsyncDownload", description = "리스트 비동기 다운로드 API")
|
||||
public class ListAsyncDownloadController {
|
||||
private final ListAsyncDownloadService downloads;
|
||||
|
||||
@Operation(summary = "리스트 Excel 생성 접수")
|
||||
@PostMapping("/list")
|
||||
public ListAsyncJobAcceptedDto list(@PathVariable Long prjctIdx,
|
||||
@RequestParam(defaultValue = "true") boolean includeResult,
|
||||
@Valid @RequestBody(required = false) ListFilterDto filter, RequestUserContext user) {
|
||||
return downloads.list(prjctIdx, filter, includeResult, user);
|
||||
}
|
||||
|
||||
@Operation(summary = "컨택 이력 Excel 생성 접수")
|
||||
@PostMapping("/event-history")
|
||||
public ListAsyncJobAcceptedDto eventHistory(@PathVariable Long prjctIdx,
|
||||
@RequestParam(defaultValue = "true") boolean includeResult,
|
||||
@Valid @RequestBody ListEventHistDownloadRequestDto request, RequestUserContext user) {
|
||||
return downloads.eventHistory(prjctIdx, request, includeResult, user);
|
||||
}
|
||||
|
||||
@Operation(summary = "수정 이력 Excel 생성 접수")
|
||||
@PostMapping("/update-history")
|
||||
public ListAsyncJobAcceptedDto updateHistory(@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody(required = false) ListFilterDto filter, RequestUserContext user) {
|
||||
return downloads.updateHistory(prjctIdx, filter, user);
|
||||
}
|
||||
|
||||
@Operation(summary = "다중 첨부 ZIP 생성 접수")
|
||||
@PostMapping("/item-files")
|
||||
public ListAsyncJobAcceptedDto itemFiles(@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody(required = false) ListFilterDto filter, RequestUserContext user) {
|
||||
return downloads.itemFiles(prjctIdx, filter, user);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.web.BusinessException;
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.common.enums.ListAsyncJobType;
|
||||
import com.kri.contact.server.common.enums.ListAsyncAssignOperation;
|
||||
import com.kri.contact.server.dto.list.async.ListAsyncAvailabilityDto;
|
||||
import com.kri.contact.server.dto.list.async.ListAsyncActiveJobsDto;
|
||||
import com.kri.contact.server.dto.list.async.ListAsyncJobStatusDto;
|
||||
import com.kri.contact.server.dto.list.async.ListAsyncResultFileDto;
|
||||
import com.kri.contact.server.dto.list.async.ListUploadResetActiveDto;
|
||||
import com.kri.contact.server.dto.list.async.ListAsyncSidFailuresDto;
|
||||
import com.kri.contact.server.persistence.entity.TListAsyncJobEntity;
|
||||
import com.kri.contact.server.service.async.ListAsyncJobAccess;
|
||||
import com.kri.contact.server.service.async.ListAsyncJobExecutor;
|
||||
import com.kri.contact.server.service.async.ListAsyncJobStore;
|
||||
import com.kri.contact.server.service.file.ListAsyncResultFileService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ContentDisposition;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.CacheControl;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/list/jobs/{prjctIdx}")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "ListAsyncJob", description = "리스트 비동기 작업 관리 API")
|
||||
public class ListAsyncJobController {
|
||||
private final ListAsyncJobAccess access;
|
||||
private final ListAsyncJobExecutor executor;
|
||||
private final ListAsyncResultFileService files;
|
||||
|
||||
@GetMapping("/availability")
|
||||
public ResponseEntity<ListAsyncAvailabilityDto> availability(
|
||||
@PathVariable Long prjctIdx,
|
||||
@RequestParam ListAsyncJobType jobType, RequestUserContext user) {
|
||||
access.requireProject(prjctIdx, user);
|
||||
return ResponseEntity.ok().cacheControl(CacheControl.noStore())
|
||||
.body(executor.availability(prjctIdx, user.getUserId(), jobType));
|
||||
}
|
||||
|
||||
@GetMapping("/upload-reset-active")
|
||||
public ResponseEntity<ListUploadResetActiveDto> uploadResetActive(@PathVariable Long prjctIdx,
|
||||
RequestUserContext user) {
|
||||
var view = access.activeUploadReset(prjctIdx, user).map(job -> {
|
||||
boolean mine = user.getUserId().equals(job.getRequestUser());
|
||||
return new ListUploadResetActiveDto.Job(job.getJobType(), job.getJobStatus(), job.getJobStage(),
|
||||
job.getTotalSidCnt(), processedSidCount(job), mine, mine ? job.getJobKey() : null);
|
||||
});
|
||||
return ResponseEntity.ok().cacheControl(CacheControl.noStore())
|
||||
.body(new ListUploadResetActiveDto(view.isPresent(), view.orElse(null)));
|
||||
}
|
||||
|
||||
@GetMapping("/my-active")
|
||||
public ResponseEntity<ListAsyncActiveJobsDto> myActive(@PathVariable Long prjctIdx, RequestUserContext user) {
|
||||
return ResponseEntity.ok().cacheControl(CacheControl.noStore())
|
||||
.body(new ListAsyncActiveJobsDto(access.myActive(prjctIdx, user).stream().map(this::toStatus).toList()));
|
||||
}
|
||||
|
||||
@GetMapping("/{jobKey}")
|
||||
public ListAsyncJobStatusDto status(@PathVariable Long prjctIdx, @PathVariable String jobKey,
|
||||
RequestUserContext user) {
|
||||
return toStatus(access.require(prjctIdx, jobKey, user));
|
||||
}
|
||||
|
||||
@PostMapping("/{jobKey}/cancel")
|
||||
public ListAsyncJobStatusDto cancel(@PathVariable Long prjctIdx, @PathVariable String jobKey,
|
||||
RequestUserContext user) {
|
||||
access.require(prjctIdx, jobKey, user);
|
||||
executor.cancel(jobKey, user.getUserId());
|
||||
return toStatus(access.require(prjctIdx, jobKey, user));
|
||||
}
|
||||
|
||||
@GetMapping("/{jobKey}/sid-failures")
|
||||
public ListAsyncSidFailuresDto sidFailures(
|
||||
@PathVariable Long prjctIdx, @PathVariable String jobKey,
|
||||
@RequestParam(defaultValue = "0") int offset, @RequestParam(defaultValue = "100") int limit,
|
||||
RequestUserContext user) {
|
||||
var job = access.require(prjctIdx, jobKey, user);
|
||||
if (offset < 0 || limit < 1 || limit > 1000) {
|
||||
throw BusinessException.badRequest("INVALID_FAILURE_PAGE", "offset은 0 이상, limit은 1~1000이어야 합니다.");
|
||||
}
|
||||
return ListAsyncSidFailuresDto.from(job, offset, limit);
|
||||
}
|
||||
|
||||
@GetMapping("/{jobKey}/range-failures")
|
||||
public java.util.Map<String,Object> rangeFailures(@PathVariable Long prjctIdx, @PathVariable String jobKey,
|
||||
@RequestParam(defaultValue = "0") int offset, @RequestParam(defaultValue = "100") int limit, RequestUserContext user) {
|
||||
return failurePage(prjctIdx, jobKey, offset, limit, user, "rangeFailures");
|
||||
}
|
||||
|
||||
@GetMapping("/{jobKey}/validation-errors")
|
||||
public java.util.Map<String,Object> validationErrors(@PathVariable Long prjctIdx, @PathVariable String jobKey,
|
||||
@RequestParam(defaultValue = "0") int offset, @RequestParam(defaultValue = "100") int limit, RequestUserContext user) {
|
||||
return failurePage(prjctIdx, jobKey, offset, limit, user, "validationErrors");
|
||||
}
|
||||
|
||||
private java.util.Map<String,Object> failurePage(Long prjctIdx, String jobKey, int offset, int limit, RequestUserContext user, String field) {
|
||||
var job = access.require(prjctIdx, jobKey, user);
|
||||
if (offset < 0 || limit < 1 || limit > 1000) throw BusinessException.badRequest("INVALID_FAILURE_PAGE", "조회 범위가 올바르지 않습니다.");
|
||||
var detail = job.getErrorDetailJson();
|
||||
var failures = detail != null && detail.get(field) instanceof List<?> values ? values : List.of();
|
||||
int start = Math.min(offset, failures.size());
|
||||
return java.util.Map.of("total", failures.size(), "offset", offset,
|
||||
"items", failures.subList(start, (int) Math.min(failures.size(), (long) start + limit)));
|
||||
}
|
||||
|
||||
@GetMapping("/{jobKey}/files/{index}")
|
||||
public void download(@PathVariable Long prjctIdx, @PathVariable String jobKey,
|
||||
@PathVariable int index, RequestUserContext user, HttpServletResponse response) throws IOException {
|
||||
TListAsyncJobEntity job = access.require(prjctIdx, jobKey, user);
|
||||
List<ListAsyncResultFileDto> results = job.getResultFilesJson();
|
||||
if (results == null || index < 0 || index >= results.size() || !results.get(index).ready()) {
|
||||
throw BusinessException.notFound("LIST_RESULT_FILE_NOT_FOUND", "결과 파일을 찾을 수 없습니다.");
|
||||
}
|
||||
ListAsyncResultFileDto result = results.get(index);
|
||||
files.download(result.fileRef(), path -> {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader(HttpHeaders.CACHE_CONTROL, "no-store");
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION,
|
||||
ContentDisposition.attachment().filename(result.fileName(), StandardCharsets.UTF_8).build().toString());
|
||||
response.setContentLengthLong(Files.size(path));
|
||||
Files.copy(path, response.getOutputStream());
|
||||
response.flushBuffer();
|
||||
});
|
||||
}
|
||||
|
||||
private ListAsyncJobStatusDto toStatus(TListAsyncJobEntity job) {
|
||||
var results = job.getResultFilesJson() == null
|
||||
? List.<ListAsyncResultFileDto>of() : job.getResultFilesJson();
|
||||
var resultViews = IntStream.range(0, results.size()).mapToObj(index -> {
|
||||
var file = results.get(index);
|
||||
return new ListAsyncJobStatusDto.ResultFile(index, file.type(), file.fileName(),
|
||||
file.sizeBytes(), file.ready() && files.exists(file.fileRef()));
|
||||
}).toList();
|
||||
long failed = ListAsyncJobStore.failedSidCount(job);
|
||||
long processed = processedSidCount(job);
|
||||
Long remaining = job.getTotalSidCnt() == null ? null : Math.max(0L, job.getTotalSidCnt() - processed);
|
||||
return new ListAsyncJobStatusDto(job.getJobKey(), job.getJobType(),
|
||||
ListAsyncAssignOperation.fromRequest(job.getJobType(), job.getRequestJson()), job.getJobStatus(),
|
||||
job.getJobStage(), job.getTotalSidCnt(), job.getCompletedSidCnt(), job.getCompletedChunkCnt(),
|
||||
failed, processed, remaining,
|
||||
job.getProgressJson(), job.getFailedChunkNo(), job.getErrorCode(), job.getErrorMessage(),
|
||||
job.getCancelReason(), job.getRegDt(), job.getStartedDt(), job.getFinishedDt(), resultViews);
|
||||
}
|
||||
|
||||
private static long processedSidCount(TListAsyncJobEntity job) {
|
||||
return Math.addExact(job.getCompletedSidCnt(), ListAsyncJobStore.failedSidCount(job));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.web.BusinessException;
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.common.enums.ListAsyncJobType;
|
||||
import com.kri.contact.server.dto.list.ListResetRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListUploadRequestDto;
|
||||
import com.kri.contact.server.dto.list.async.ListAsyncJobAcceptedDto;
|
||||
import com.kri.contact.server.service.async.ListAsyncJobAccess;
|
||||
import com.kri.contact.server.service.async.ListAsyncMaintenanceService;
|
||||
import com.kri.contact.server.service.file.ListFileService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ContentDisposition;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/list/jobs/{prjctIdx}")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "ListAsyncMaintenance", description = "리스트 비동기 업로드 및 초기화 API")
|
||||
public class ListAsyncMaintenanceController {
|
||||
private final ListAsyncMaintenanceService maintenance;
|
||||
private final ListAsyncJobAccess access;
|
||||
private final ListFileService sources;
|
||||
|
||||
@PostMapping("/reset")
|
||||
public ListAsyncJobAcceptedDto reset(@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody ListResetRequestDto request, RequestUserContext user) {
|
||||
return maintenance.reset(prjctIdx, request, user);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ListAsyncJobAcceptedDto upload(@PathVariable Long prjctIdx, @RequestParam("file") MultipartFile file,
|
||||
@Valid @RequestPart("request") ListUploadRequestDto request, RequestUserContext user) {
|
||||
return maintenance.upload(prjctIdx, file, request, user);
|
||||
}
|
||||
|
||||
@GetMapping("/{jobKey}/source-file")
|
||||
public void source(@PathVariable Long prjctIdx, @PathVariable String jobKey, RequestUserContext user,
|
||||
HttpServletResponse response) throws IOException {
|
||||
var job = access.require(prjctIdx, jobKey, user);
|
||||
if (job.getJobType() != ListAsyncJobType.LIST_UPLOAD || job.getInputFileRef() == null) {
|
||||
throw BusinessException.notFound("LIST_UPLOAD_FILE_NOT_FOUND", "원본 파일을 찾을 수 없습니다.");
|
||||
}
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader(HttpHeaders.CACHE_CONTROL, "no-store");
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition.attachment()
|
||||
.filename("upload_source.xlsx", StandardCharsets.UTF_8).build().toString());
|
||||
sources.copyListFile(prjctIdx, job.getInputFileRef(), response.getOutputStream());
|
||||
response.flushBuffer();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.web.BusinessException;
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.common.enums.ChannelType;
|
||||
import com.kri.contact.server.dto.list.async.ListAsyncJobAcceptedDto;
|
||||
import com.kri.contact.server.dto.message.MessageSendBulkRequestDto;
|
||||
import com.kri.contact.server.service.async.ListAsyncJobAccess;
|
||||
import com.kri.contact.server.service.async.ListAsyncMessageService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/list/jobs/{prjctIdx}")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "ListAsyncMessage", description = "리스트 비동기 메시지 발송 API")
|
||||
public class ListAsyncMessageController {
|
||||
private final ListAsyncMessageService messages;
|
||||
private final ListAsyncJobAccess access;
|
||||
|
||||
@PostMapping("/messages/email")
|
||||
public ListAsyncJobAcceptedDto email(@PathVariable Long prjctIdx, @Valid @RequestBody MessageSendBulkRequestDto request, RequestUserContext user) {
|
||||
return messages.submit(prjctIdx, ChannelType.EMAIL, request, user);
|
||||
}
|
||||
@PostMapping("/messages/sms")
|
||||
public ListAsyncJobAcceptedDto sms(@PathVariable Long prjctIdx, @Valid @RequestBody MessageSendBulkRequestDto request, RequestUserContext user) {
|
||||
return messages.submit(prjctIdx, ChannelType.SMS, request, user);
|
||||
}
|
||||
@PostMapping("/messages/kko")
|
||||
public ListAsyncJobAcceptedDto kko(@PathVariable Long prjctIdx, @Valid @RequestBody MessageSendBulkRequestDto request, RequestUserContext user) {
|
||||
return messages.submit(prjctIdx, ChannelType.KKO_AT, request, user);
|
||||
}
|
||||
public record ReportPage(int total, int offset, List<?> items) {}
|
||||
|
||||
@GetMapping("/{jobKey}/message-report/{section}")
|
||||
public ReportPage report(@PathVariable Long prjctIdx, @PathVariable String jobKey, @PathVariable String section,
|
||||
@RequestParam(defaultValue = "0") int offset, @RequestParam(defaultValue = "100") int limit, RequestUserContext user) {
|
||||
var job = access.require(prjctIdx, jobKey, user);
|
||||
String field = switch (section) {
|
||||
case "batches" -> "messageBatches";
|
||||
case "preparation-failures" -> "preparationFailures";
|
||||
default -> throw BusinessException.badRequest("INVALID_REPORT_SECTION", "조회 항목이 올바르지 않습니다.");
|
||||
};
|
||||
if (offset < 0 || limit < 1 || limit > 1000) throw BusinessException.badRequest("INVALID_REPORT_PAGE", "조회 범위가 올바르지 않습니다.");
|
||||
var detail = job.getErrorDetailJson() == null ? Map.<String,Object>of() : job.getErrorDetailJson();
|
||||
List<?> items = detail.get(field) instanceof List<?> values ? values : List.of();
|
||||
int start = Math.min(offset, items.size());
|
||||
return new ReportPage(items.size(), offset, items.subList(start, (int) Math.min(items.size(), (long) start + limit)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.dto.list.ListAssignRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListAssignResetRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListUpdateRequestDto;
|
||||
import com.kri.contact.server.dto.list.async.ListAsyncJobAcceptedDto;
|
||||
import com.kri.contact.server.service.async.ListAsyncMutationService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/list/jobs/{prjctIdx}/mutations")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "ListAsyncMutation", description = "리스트 비동기 수정 및 배정 API")
|
||||
public class ListAsyncMutationController {
|
||||
private final ListAsyncMutationService mutations;
|
||||
|
||||
@PostMapping("/update")
|
||||
public ListAsyncJobAcceptedDto update(@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody ListUpdateRequestDto request, RequestUserContext user) {
|
||||
return mutations.update(prjctIdx, request, user);
|
||||
}
|
||||
|
||||
@PostMapping("/assign/{assignId}")
|
||||
public ListAsyncJobAcceptedDto assign(@PathVariable Long prjctIdx, @PathVariable String assignId,
|
||||
@Valid @RequestBody ListAssignRequestDto request, RequestUserContext user) {
|
||||
return mutations.assign(prjctIdx, assignId, request, user);
|
||||
}
|
||||
|
||||
@PostMapping("/assign-reset")
|
||||
public ListAsyncJobAcceptedDto resetAssignments(@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody ListAssignResetRequestDto request, RequestUserContext user) {
|
||||
return mutations.resetAssignments(prjctIdx, request, user);
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,14 @@ package com.kri.contact.server.controller;
|
||||
import com.kri.common.feature.datetime.DateTimeUtil;
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.dto.list.ListCallHistDto;
|
||||
import com.kri.contact.server.dto.list.ListCallHistRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListCallCloseRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListCallStartRequestDto;
|
||||
import com.kri.contact.server.service.ListCallHistService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -25,16 +25,16 @@ public class ListCallHistController {
|
||||
|
||||
private final ListCallHistService listCallHistService;
|
||||
|
||||
@Operation(summary = "Save list call history")
|
||||
@PutMapping("/{prjctIdx}/{sid}")
|
||||
public ListCallHistDto saveCallHistory(
|
||||
@Operation(summary = "Start list call history")
|
||||
@PutMapping("/{prjctIdx}/{sid}/call-start")
|
||||
public ListCallHistDto callStart(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid,
|
||||
@Valid @RequestBody ListCallHistRequestDto request,
|
||||
@PathVariable String sid,
|
||||
@Valid @RequestBody ListCallStartRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
return listCallHistService.saveCallHistory(
|
||||
return listCallHistService.callStart(
|
||||
prjctIdx,
|
||||
sid,
|
||||
request,
|
||||
@@ -45,17 +45,23 @@ public class ListCallHistController {
|
||||
);
|
||||
}
|
||||
|
||||
@Operation(summary = "Find list call history by agent session")
|
||||
@GetMapping("/session/{agentSessionId}")
|
||||
public ListCallHistDto findByAgentSessionId(
|
||||
@PathVariable String agentSessionId,
|
||||
@Operation(summary = "Close list call history")
|
||||
@PutMapping("/{prjctIdx}/{sid}/call-close")
|
||||
public ListCallHistDto callClose(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable String sid,
|
||||
@Valid @RequestBody ListCallCloseRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return listCallHistService.findByAgentSessionId(
|
||||
agentSessionId,
|
||||
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
return listCallHistService.callClose(
|
||||
prjctIdx,
|
||||
sid,
|
||||
request,
|
||||
ctx.getUserId(),
|
||||
ctx.getUserCmpn(),
|
||||
ctx.getUserRole()
|
||||
ctx.getUserRole(),
|
||||
now
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,24 +3,18 @@ package com.kri.contact.server.controller;
|
||||
import static com.kri.contact.server.common.util.ExcelResponseBuilder.buildExcelResponse;
|
||||
|
||||
import com.kri.common.feature.datetime.DateTimeUtil;
|
||||
import com.kri.common.feature.util.CollectionUtil;
|
||||
import com.kri.common.feature.web.BusinessException;
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.common.feature.web.page.PageResponseDto;
|
||||
import com.kri.contact.server.common.enums.ListSearchResponseType;
|
||||
import com.kri.contact.server.dto.excel.ExcelUploadResultDto;
|
||||
import com.kri.contact.server.dto.list.ListFilterDto;
|
||||
import com.kri.contact.server.dto.list.ListResetRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListSearchRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListSearchWithFullResultDto;
|
||||
import com.kri.contact.server.dto.list.ListUpdateRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListUploadFileInfoDto;
|
||||
import com.kri.contact.server.dto.list.ListUploadHistoryDto;
|
||||
import com.kri.contact.server.dto.list.ListUploadRequestDto;
|
||||
import com.kri.contact.server.dto.project.ProjectInfoDto;
|
||||
import com.kri.contact.server.dto.systemlog.UploadContentDto;
|
||||
import com.kri.contact.server.service.ListDownloadService;
|
||||
import com.kri.contact.server.service.ListResetService;
|
||||
import com.kri.contact.server.service.ListSearchService;
|
||||
import com.kri.contact.server.service.ListUpdateService;
|
||||
import com.kri.contact.server.service.ListUploadService;
|
||||
@@ -34,13 +28,11 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -48,7 +40,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -63,14 +54,13 @@ public class ListController {
|
||||
private final ListSearchService listSearchService;
|
||||
private final ListUploadService listUploadService;
|
||||
private final ListUpdateService listUpdateService;
|
||||
private final ListResetService listResetService;
|
||||
private final SystemEventLogService systemEventLogService;
|
||||
|
||||
@Operation(summary = "리스트 정보 조회 With Sid")
|
||||
@GetMapping("/search-sid/{prjctIdx}/{sid}")
|
||||
public ListSearchWithFullResultDto searchListWithSid(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid
|
||||
@PathVariable String sid
|
||||
) {
|
||||
return listSearchService.searchListWithSid(prjctIdx, sid);
|
||||
}
|
||||
@@ -111,45 +101,7 @@ public class ListController {
|
||||
) {
|
||||
getProjectOrThrow(prjctIdx);
|
||||
ListUploadFileInfoDto uploadFile = listUploadService.downloadUploadFile(prjctIdx, listUploadLogId);
|
||||
return buildExcelResponse(uploadFile.getFileName(), uploadFile.getBytes());
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 다운로드")
|
||||
@PostMapping("/excel/download/{prjctIdx}")
|
||||
public ResponseEntity<byte[]> downloadList(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody(required = false) ListFilterDto listFilter
|
||||
) {
|
||||
ProjectInfoDto projectInfoDto = getProjectOrThrow(prjctIdx);
|
||||
byte[] bytes = listDownloadService.downloadList(prjctIdx, listFilter);
|
||||
return buildExcelResponse(projectInfoDto.getPrjctName() + " list.xlsx", bytes);
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 수정 이력 다운로드")
|
||||
@PostMapping("/excel/download/update/{prjctIdx}")
|
||||
public ResponseEntity<byte[]> downloadListUpdateHistory(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody(required = false) ListFilterDto listFilter
|
||||
) {
|
||||
ProjectInfoDto projectInfoDto = getProjectOrThrow(prjctIdx);
|
||||
byte[] bytes = listDownloadService.downloadSidWithUpdateHist(prjctIdx, listFilter);
|
||||
return buildExcelResponse(projectInfoDto.getPrjctName() + " 수정 이력.xlsx", bytes);
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 파일 업로드")
|
||||
@PostMapping(value = "/excel/upload/{prjctIdx}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ExcelUploadResultDto uploadExcel(
|
||||
@PathVariable Long prjctIdx,
|
||||
@RequestParam("file") MultipartFile file,
|
||||
@Valid @RequestPart("request") ListUploadRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
getProjectOrThrow(prjctIdx);
|
||||
|
||||
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
ExcelUploadResultDto result = listUploadService.uploadExcel(prjctIdx, file, request, ctx.getUserId(), now);
|
||||
systemEventLogService.writeUploadList(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, UploadContentDto.from(file));
|
||||
return result;
|
||||
return buildExcelResponse(uploadFile.fileName(), uploadFile.bytes());
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 수정")
|
||||
@@ -159,8 +111,6 @@ public class ListController {
|
||||
@Valid @RequestBody ListUpdateRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
validateListUpdateRequest(request);
|
||||
|
||||
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
int updateCount = listUpdateService.updateList(prjctIdx, request, ctx.getUserRole(), ctx.getUserId(), now);
|
||||
systemEventLogService.writeUpdateList(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, request);
|
||||
@@ -171,7 +121,7 @@ public class ListController {
|
||||
@PostMapping(value = "/item-file/upload/{prjctIdx}/{sid}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public void uploadItemFile(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid,
|
||||
@PathVariable String sid,
|
||||
@RequestParam Map<String, MultipartFile> files,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
@@ -188,46 +138,16 @@ public class ListController {
|
||||
systemEventLogService.writeUploadListItemFiles(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, contents);
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 별 업로드 파일 다운로드")
|
||||
@PostMapping("/item-file/download/{prjctIdx}")
|
||||
public ResponseEntity<byte[]> downloadItemFile(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody(required = false) ListFilterDto listFilter
|
||||
){
|
||||
ProjectInfoDto projectInfoDto = getProjectOrThrow(prjctIdx);
|
||||
byte[] bytes = listDownloadService.downloadItemFile(prjctIdx, listFilter);
|
||||
return buildZipResponse(projectInfoDto.getPrjctName() + " item_files.zip", bytes);
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 단건 파일 다운로드")
|
||||
@GetMapping("/item-file/download/{prjctIdx}/{sid}/{listHderId}")
|
||||
public ResponseEntity<byte[]> downloadOneItemFile(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid,
|
||||
@PathVariable String sid,
|
||||
@PathVariable Integer listHderId
|
||||
) {
|
||||
getProjectOrThrow(prjctIdx);
|
||||
ListUploadFileInfoDto file = listDownloadService.downloadItemFile(prjctIdx, sid, listHderId);
|
||||
return buildFileResponse(file.getFileName(), file.getBytes());
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 초기화")
|
||||
@DeleteMapping("/{prjctIdx}")
|
||||
public int resetList(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody ListResetRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
int resetCount = listResetService.resetByFilter(
|
||||
prjctIdx,
|
||||
request.getListFilter(),
|
||||
request.getResetMode(),
|
||||
ctx.getUserId(),
|
||||
now
|
||||
);
|
||||
systemEventLogService.writeResetList(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, request);
|
||||
return resetCount;
|
||||
return buildFileResponse(file.fileName(), file.bytes());
|
||||
}
|
||||
|
||||
private ProjectInfoDto getProjectOrThrow(Long prjctIdx) {
|
||||
@@ -238,25 +158,6 @@ public class ListController {
|
||||
return projectInfoDto;
|
||||
}
|
||||
|
||||
private void validateListUpdateRequest(ListUpdateRequestDto request){
|
||||
if(
|
||||
CollectionUtil.isEmpty(request.getUpdateContents()) &&
|
||||
CollectionUtil.isEmpty(request.getUpdateResultCodes())
|
||||
){
|
||||
throw BusinessException.badRequest("EMPTY_UPDATE_CONTENT","리스트 수정내용이 없습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
private ResponseEntity<byte[]> buildZipResponse(String fileName, byte[] bytes) {
|
||||
String contentDisposition = "attachment; filename*=UTF-8''" +
|
||||
URLEncoder.encode(fileName, StandardCharsets.UTF_8).replace("+", "%20");
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, contentDisposition)
|
||||
.contentType(MediaType.parseMediaType("application/zip"))
|
||||
.body(bytes);
|
||||
}
|
||||
|
||||
private ResponseEntity<byte[]> buildFileResponse(String fileName, byte[] bytes) {
|
||||
String contentDisposition = "attachment; filename*=UTF-8''" +
|
||||
URLEncoder.encode(fileName, StandardCharsets.UTF_8).replace("+", "%20");
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.datetime.DateTimeUtil;
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.dto.list.ListSearchExternalDto;
|
||||
import com.kri.contact.server.dto.list.ListUpdateRequestDto;
|
||||
import com.kri.contact.server.service.ListHeaderService;
|
||||
import com.kri.contact.server.service.ListSearchService;
|
||||
import com.kri.contact.server.service.ListUpdateService;
|
||||
import com.kri.contact.server.service.ProjectService;
|
||||
import com.kri.contact.server.service.common.SystemEventLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/list-external")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "ListExternal", description = "외부 공개용 리스트 API")
|
||||
public class ListExternalController {
|
||||
|
||||
private final ListHeaderService listHeaderService;
|
||||
private final ListSearchService listSearchService;
|
||||
private final ListUpdateService listUpdateService;
|
||||
private final ProjectService projectService;
|
||||
private final SystemEventLogService systemEventLogService;
|
||||
|
||||
@Operation(summary = "리스트 헤더 조회")
|
||||
@GetMapping("/header/{prjctCd}")
|
||||
public List<String> searchListHeader(
|
||||
@PathVariable String prjctCd,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
Long prjctIdx = projectService.getProjectIdxByCode(prjctCd);
|
||||
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
List<String> headerNames = listHeaderService.getHeaderName(prjctIdx);
|
||||
systemEventLogService.writeSearchListHeaderFromExternal(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx);
|
||||
|
||||
return headerNames;
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 정보 조회")
|
||||
@GetMapping("/search/{prjctCd}/{sid}")
|
||||
public ListSearchExternalDto searchListWithSid(
|
||||
@PathVariable String prjctCd,
|
||||
@PathVariable String sid,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
Long prjctIdx = projectService.getProjectIdxByCode(prjctCd);
|
||||
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
ListSearchExternalDto listInfo = listSearchService.searchListWithSidFromExternal(prjctIdx, prjctCd, sid);
|
||||
systemEventLogService.writeSearchListFromExternal(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, sid);
|
||||
|
||||
return listInfo;
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 수정 sid기반")
|
||||
@PatchMapping("/update/{prjctCd}/{sid}")
|
||||
public int updateListWithSid(
|
||||
@PathVariable String prjctCd,
|
||||
@PathVariable String sid,
|
||||
@RequestBody Map<String, String> updateContents,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
Long prjctIdx = projectService.getProjectIdxByCode(prjctCd);
|
||||
Map<Integer, String> contentsByHeaderId = listHeaderService.convertHeaderNamesToIds(
|
||||
prjctIdx,
|
||||
updateContents
|
||||
);
|
||||
ListUpdateRequestDto request = ListUpdateRequestDto.from(contentsByHeaderId, sid);
|
||||
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
int updateCount = listUpdateService.updateList(prjctIdx, request, ctx.getUserRole(), ctx.getUserId(), now);
|
||||
systemEventLogService.writeUpdateListFromExternal(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, updateContents);
|
||||
|
||||
return updateCount;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class ListHeaderController {
|
||||
@Operation(summary = "리스트 헤더 조회")
|
||||
@GetMapping("/{prjctIdx}")
|
||||
public List<ListHeaderWithFilterContentDto> getListHeader (@PathVariable Long prjctIdx) {
|
||||
return listHeaderService.getHeader(prjctIdx);
|
||||
return listHeaderService.getHeaderWithFilterContent(prjctIdx);
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 헤더 수정")
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import static com.kri.contact.server.common.util.ExcelResponseBuilder.buildExcelResponse;
|
||||
|
||||
import com.kri.common.feature.datetime.DateTimeUtil;
|
||||
import com.kri.common.feature.web.BusinessException;
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.dto.list.ListEventHistDownloadRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListEventHistFromSurveyDto;
|
||||
import com.kri.contact.server.dto.list.ListEventHistInsertRequestDto;
|
||||
import com.kri.contact.server.dto.list.ListEventHistSurveyMetaDto;
|
||||
import com.kri.contact.server.dto.list.ListEventHistoryDto;
|
||||
import com.kri.contact.server.dto.list.ListUpdateHistoryDto;
|
||||
import com.kri.contact.server.dto.project.ProjectInfoDto;
|
||||
import com.kri.contact.server.service.ListDownloadService;
|
||||
import com.kri.contact.server.service.ListHistoryQueryService;
|
||||
import com.kri.contact.server.service.ListUpdateService;
|
||||
import com.kri.contact.server.service.ProjectService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -23,6 +16,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -37,8 +31,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Tag(name = "ListHistory", description = "리스트 이력 API")
|
||||
public class ListHistoryController {
|
||||
|
||||
private final ProjectService projectService;
|
||||
private final ListDownloadService listDownloadService;
|
||||
private final ListHistoryQueryService listHistoryQueryService;
|
||||
private final ListUpdateService listUpdateService;
|
||||
|
||||
@@ -46,7 +38,7 @@ public class ListHistoryController {
|
||||
@GetMapping("/event/{prjctIdx}/{sid}")
|
||||
public List<ListEventHistoryDto> findListEventHistories(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid
|
||||
@PathVariable String sid
|
||||
) {
|
||||
return listHistoryQueryService.findEventHistories(prjctIdx, sid);
|
||||
}
|
||||
@@ -55,36 +47,19 @@ public class ListHistoryController {
|
||||
@GetMapping("/update/{prjctIdx}/{sid}")
|
||||
public List<ListUpdateHistoryDto> findListUpdateHistories(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid
|
||||
@PathVariable String sid
|
||||
) {
|
||||
return listHistoryQueryService.findUpdateHistories(prjctIdx, sid);
|
||||
}
|
||||
|
||||
@Operation(summary = "리스트 이벤트 이력 다운로드")
|
||||
@PostMapping("/excel/download/event/{prjctIdx}")
|
||||
public ResponseEntity<byte[]> downloadListWithEventHistory(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody ListEventHistDownloadRequestDto request
|
||||
) {
|
||||
ProjectInfoDto projectInfoDto = getProjectOrThrow(prjctIdx);
|
||||
byte[] bytes = listDownloadService.downloadListWithEventHist(
|
||||
prjctIdx,
|
||||
request.getListFilter(),
|
||||
request.getResultCodeTypes(),
|
||||
request.getSearchBase(),
|
||||
request.getDateRange()
|
||||
);
|
||||
return buildExcelResponse(projectInfoDto.getPrjctName() + " 컨택 이력.xlsx", bytes);
|
||||
}
|
||||
|
||||
@Operation(description = "설문 상태 추가")
|
||||
@PostMapping("/survey")
|
||||
public void putSurveyHistory(
|
||||
@Valid @RequestBody ListEventHistFromSurveyDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
if (request.getMeta().getRemoteAddr() == null) {
|
||||
request.getMeta().setRemoteAddr(ctx.getClientIp());
|
||||
if (request.meta().getRemoteAddr() == null) {
|
||||
request.meta().setRemoteAddr(ctx.getClientIp());
|
||||
}
|
||||
String regUser = resolveRegUser(request, ctx);
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
@@ -108,22 +83,30 @@ public class ListHistoryController {
|
||||
);
|
||||
}
|
||||
|
||||
@Operation(description = "리스트 이벤트 이력 단건 삭제")
|
||||
@DeleteMapping("/event/{listEventHistIdx}")
|
||||
public ResponseEntity<Void> deleteEventHistory(
|
||||
@PathVariable Long listEventHistIdx,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
listUpdateService.deleteEventHistory(
|
||||
listEventHistIdx,
|
||||
ctx.getUserId(),
|
||||
ctx.getUserRole(),
|
||||
now
|
||||
);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private String resolveRegUser(ListEventHistFromSurveyDto request, RequestUserContext ctx) {
|
||||
if (ctx.getUserId() != null) {
|
||||
return ctx.getUserId();
|
||||
}
|
||||
ListEventHistSurveyMetaDto meta = request.getMeta();
|
||||
ListEventHistSurveyMetaDto meta = request.meta();
|
||||
if (meta != null && meta.getEntryType() != null) {
|
||||
return meta.getEntryType().name();
|
||||
}
|
||||
return "SYSTEM";
|
||||
}
|
||||
|
||||
private ProjectInfoDto getProjectOrThrow(Long prjctIdx) {
|
||||
ProjectInfoDto projectInfoDto = projectService.getProject(prjctIdx);
|
||||
if (projectInfoDto == null) {
|
||||
throw BusinessException.internalError("프로젝트가 없습니다.");
|
||||
}
|
||||
return projectInfoDto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.dto.message.MessageBulkSendResponseDto;
|
||||
import com.kri.contact.server.dto.message.MessageSendBulkRequestDto;
|
||||
import com.kri.contact.server.dto.message.MessageSendSingleRequestDto;
|
||||
import com.kri.contact.server.service.MessageService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/message")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "Message", description = "Message send API")
|
||||
public class MessageController {
|
||||
|
||||
private final MessageService messageService;
|
||||
|
||||
@Operation(summary = "Email single send")
|
||||
@PostMapping("/email/single/{prjctIdx}")
|
||||
public void sendEmailSingle(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody MessageSendSingleRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
messageService.sendEmailSingle(prjctIdx, request, ctx);
|
||||
}
|
||||
|
||||
@Operation(summary = "Email bulk send")
|
||||
@PostMapping("/email/bulk/{prjctIdx}")
|
||||
public MessageBulkSendResponseDto sendEmailBulk(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody MessageSendBulkRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageService.sendEmailBulk(prjctIdx, request, ctx);
|
||||
}
|
||||
|
||||
@Operation(summary = "SMS single send")
|
||||
@PostMapping("/sms/single/{prjctIdx}")
|
||||
public void sendSmsSingle(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody MessageSendSingleRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
messageService.sendSmsSingle(prjctIdx, request, ctx);
|
||||
}
|
||||
|
||||
@Operation(summary = "SMS bulk send")
|
||||
@PostMapping("/sms/bulk/{prjctIdx}")
|
||||
public MessageBulkSendResponseDto sendSmsBulk(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody MessageSendBulkRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageService.sendSmsBulk(prjctIdx, request, ctx);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubBulkSendInfoDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubReportExcelResponseDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubReportPageRequestDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubReportPageResponseDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubSendResultInfoDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubSendResultSummaryRequestDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubSendResultSummaryResponseDto;
|
||||
import com.kri.contact.server.service.MessageResultService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/message-report")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "Message Report", description = "Message report API")
|
||||
public class MessageReportController {
|
||||
|
||||
private final MessageResultService messageResultService;
|
||||
|
||||
@GetMapping("/bulk-list/{sendTy}/{reqstSvc}/{prjctCd}")
|
||||
public ResponseEntity<List<NotiHubBulkSendInfoDto>> getBulkList(
|
||||
@PathVariable Integer sendTy,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageResultService.getBulkList(request, ctx);
|
||||
}
|
||||
|
||||
@GetMapping("/send-result/{sid}/{prjctCd}/{reqstSvc}")
|
||||
public ResponseEntity<List<NotiHubSendResultInfoDto>> getSendResult(
|
||||
@RequestParam(required = false) Integer channelTy,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageResultService.getSendResult(request, ctx);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/bulk-detail/{bulkSendKey}", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<NotiHubReportPageResponseDto<NotiHubSendResultInfoDto>> getBulkDetail(
|
||||
@Valid @RequestBody NotiHubReportPageRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageResultService.getBulkDetail(body, request, ctx);
|
||||
}
|
||||
|
||||
@PostMapping("/bulk-detail-excel/{bulkSendKey}")
|
||||
public ResponseEntity<NotiHubReportExcelResponseDto> getBulkDetailExcel(
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageResultService.getBulkDetailExcel(request, ctx);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/send-result-summary", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<NotiHubSendResultSummaryResponseDto>> getSendResultSummary(
|
||||
@Valid @RequestBody NotiHubSendResultSummaryRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageResultService.getSendResultSummary(body, request, ctx);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.dto.message.MessageSendCancelBulkRequestDto;
|
||||
import com.kri.contact.server.dto.message.MessageSendCancelResponseDto;
|
||||
import com.kri.contact.server.dto.message.MessageSendCancelSingleRequestDto;
|
||||
import com.kri.contact.server.dto.message.MessageSendSingleRequestDto;
|
||||
import com.kri.contact.server.dto.message.MessageSendSingleResponseDto;
|
||||
import com.kri.contact.server.service.MessageSendService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/message-send")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "Message", description = "Message send API")
|
||||
public class MessageSendController {
|
||||
|
||||
private final MessageSendService messageSendService;
|
||||
|
||||
@Operation(summary = "Cancel a scheduled message")
|
||||
@ApiResponse(responseCode = "200", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
|
||||
schema = @Schema(implementation = MessageSendCancelResponseDto.class)))
|
||||
@PostMapping(value = "/cancel/single", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<byte[]> cancelSingle(
|
||||
@Valid @RequestBody MessageSendCancelSingleRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageSendService.cancelSingle(body, request, ctx);
|
||||
}
|
||||
|
||||
@Operation(summary = "Cancel eligible scheduled messages in a bulk send")
|
||||
@ApiResponse(responseCode = "200", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
|
||||
schema = @Schema(implementation = MessageSendCancelResponseDto.class)))
|
||||
@PostMapping(value = "/cancel/bulk", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<byte[]> cancelBulk(
|
||||
@Valid @RequestBody MessageSendCancelBulkRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageSendService.cancelBulk(body, request, ctx);
|
||||
}
|
||||
|
||||
@Operation(summary = "Email single send")
|
||||
@PostMapping("/email/single/{prjctIdx}")
|
||||
public MessageSendSingleResponseDto sendEmailSingle(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody MessageSendSingleRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageSendService.sendEmailSingle(prjctIdx, request, ctx);
|
||||
}
|
||||
|
||||
@Operation(summary = "Kakao Alimtalk single send")
|
||||
@PostMapping("/kko/single/{prjctIdx}")
|
||||
public MessageSendSingleResponseDto sendKkoSingle(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody MessageSendSingleRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageSendService.sendKkoSingle(prjctIdx, request, ctx);
|
||||
}
|
||||
|
||||
@Operation(summary = "SMS single send")
|
||||
@PostMapping("/sms/single/{prjctIdx}")
|
||||
public MessageSendSingleResponseDto sendSmsSingle(
|
||||
@PathVariable Long prjctIdx,
|
||||
@Valid @RequestBody MessageSendSingleRequestDto request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageSendService.sendSmsSingle(prjctIdx, request, ctx);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.feature.web.RequestUserContext;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubKkoSenderProfileDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubKkoTemplateDetailDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubKkoTemplateDetailRequestDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubKkoTemplateListRequestDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubKkoTemplateListResponseDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubTemplateBasicDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubTemplateDetailDto;
|
||||
import com.kri.contact.server.common.external.notihub.dto.NotiHubTemplateSummaryDto;
|
||||
import com.kri.contact.server.service.MessageTemplateService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/message-template")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "Message Template", description = "Message template API")
|
||||
public class MessageTemplateController {
|
||||
|
||||
private final MessageTemplateService messageTemplateService;
|
||||
|
||||
@GetMapping("/kko/profiles")
|
||||
public ResponseEntity<List<NotiHubKkoSenderProfileDto>> getKkoSenderProfiles(
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageTemplateService.getKkoSenderProfiles(request, ctx);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/kko/list", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<NotiHubKkoTemplateListResponseDto> getKkoTemplateList(
|
||||
@Valid @RequestBody NotiHubKkoTemplateListRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageTemplateService.getKkoTemplateList(body, request, ctx);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/kko/detail", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<NotiHubKkoTemplateDetailDto> getKkoTemplateDetail(
|
||||
@Valid @RequestBody NotiHubKkoTemplateDetailRequestDto body,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageTemplateService.getKkoTemplateDetail(body, request, ctx);
|
||||
}
|
||||
|
||||
@GetMapping("/list/{chnnlTy}/{itrntPrjctCd}")
|
||||
public ResponseEntity<List<NotiHubTemplateSummaryDto>> getTemplateList(
|
||||
@PathVariable Integer chnnlTy,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageTemplateService.getTemplateList(request, ctx);
|
||||
}
|
||||
|
||||
@GetMapping("/{tmplatIdx:[0-9]+}")
|
||||
public ResponseEntity<NotiHubTemplateDetailDto> getTemplate(
|
||||
@PathVariable Long tmplatIdx,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageTemplateService.getTemplate(request, ctx);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{tmplatIdx:[0-9]+}")
|
||||
public ResponseEntity<byte[]> deleteTemplate(
|
||||
@PathVariable Long tmplatIdx,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageTemplateService.deleteTemplate(tmplatIdx, request, ctx);
|
||||
}
|
||||
|
||||
@GetMapping("/{tmplatIdx:[0-9]+}/attachment")
|
||||
public ResponseEntity<byte[]> getAttachment(
|
||||
@PathVariable Long tmplatIdx,
|
||||
@RequestParam String fileName,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageTemplateService.getAttachment(request, ctx);
|
||||
}
|
||||
|
||||
@PutMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ResponseEntity<NotiHubTemplateDetailDto> createTemplate(
|
||||
@Valid @RequestPart("template") NotiHubTemplateBasicDto template,
|
||||
@RequestPart(value = "files", required = false) List<MultipartFile> files,
|
||||
@RequestParam(value = "deleteFileNames", required = false) List<String> deleteFileNames,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageTemplateService.createTemplate(template, files, deleteFileNames, request, ctx);
|
||||
}
|
||||
|
||||
@PatchMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ResponseEntity<NotiHubTemplateDetailDto> updateTemplate(
|
||||
@Valid @RequestPart("template") NotiHubTemplateDetailDto template,
|
||||
@RequestPart(value = "files", required = false) List<MultipartFile> files,
|
||||
@RequestParam(value = "deleteFileNames", required = false) List<String> deleteFileNames,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageTemplateService.updateTemplate(template, files, deleteFileNames, request, ctx);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/body-image/{itrntPrjctCd}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ResponseEntity<String> uploadBodyImage(
|
||||
@RequestPart("file") MultipartFile file,
|
||||
HttpServletRequest request,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return messageTemplateService.uploadBodyImage(file, request, ctx);
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class ProjectController {
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return projectService.getTopProject(topCount, keyword, ctx.getUserId(), ctx.getUserCmpn(),
|
||||
ctx.getUserRole());
|
||||
ctx.getUserTeam(), ctx.getUserRole());
|
||||
}
|
||||
|
||||
@Operation(summary = "프로젝트 목록 조회")
|
||||
@@ -64,7 +64,8 @@ public class ProjectController {
|
||||
@Valid @RequestBody ProjectSearchRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return projectService.searchProject(req, ctx.getUserId(), ctx.getUserCmpn(), ctx.getUserRole());
|
||||
return projectService.searchProject(req, ctx.getUserId(), ctx.getUserCmpn(), ctx.getUserTeam(),
|
||||
ctx.getUserRole());
|
||||
}
|
||||
|
||||
@Operation(summary = "프로젝트를 소유하고 있는 모든 부서/실사 목록 조회")
|
||||
@@ -115,10 +116,10 @@ public class ProjectController {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
String newHtml = contactScenarioFileService.syncOnSave(
|
||||
req.getProjectInfo().getPrjctCd(),
|
||||
req.getProjectInfo().getContactSenario()
|
||||
req.projectInfo().getPrjctCd(),
|
||||
req.projectInfo().getContactSenario()
|
||||
);
|
||||
req.getProjectInfo().setContactSenario(newHtml);
|
||||
req.projectInfo().setContactSenario(newHtml);
|
||||
|
||||
projectService.updateProject(prjctIdx, req, ctx.getUserId(), now, ctx);
|
||||
|
||||
|
||||
@@ -8,14 +8,18 @@ import com.kri.contact.server.service.ReserveService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@@ -36,6 +40,26 @@ public class ReserveController {
|
||||
return reserveService.reserve(request, ctx.getUserId(), now);
|
||||
}
|
||||
|
||||
@Operation(summary = "Find reserve notifications by user")
|
||||
@GetMapping("/user/{userId}")
|
||||
public List<ListReserveDto> findNotifications(
|
||||
@PathVariable String userId,
|
||||
@RequestParam(defaultValue = "false") boolean requestPast
|
||||
) {
|
||||
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
return reserveService.findNotifications(userId, requestPast, now);
|
||||
}
|
||||
|
||||
@Operation(summary = "Find reserves by user and date range")
|
||||
@GetMapping("/user/{userId}/search")
|
||||
public List<ListReserveDto> findByUserAndDateRange(
|
||||
@PathVariable String userId,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate fromDt,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate toDt
|
||||
) {
|
||||
return reserveService.findByUserAndDateRange(userId, fromDt, toDt);
|
||||
}
|
||||
|
||||
@Operation(summary = "Find reserves by user")
|
||||
@GetMapping("/{prjctIdx}/user/{userId}")
|
||||
public List<ListReserveDto> findByUser(
|
||||
@@ -49,8 +73,17 @@ public class ReserveController {
|
||||
@GetMapping("/{prjctIdx}/sid/{sid}")
|
||||
public List<ListReserveDto> findBySid(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable Integer sid
|
||||
@PathVariable String sid
|
||||
) {
|
||||
return reserveService.findBySid(prjctIdx, sid);
|
||||
}
|
||||
|
||||
@Operation(summary = "Confirm reserve notification")
|
||||
@PatchMapping("/confirm/{listResveIdx}")
|
||||
public void confirm(
|
||||
@PathVariable Long listResveIdx,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
reserveService.confirm(listResveIdx, ctx.getUserId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.kri.contact.server.controller;
|
||||
import com.kri.contact.server.common.enums.ResultCodeType;
|
||||
import com.kri.contact.server.dto.project.ResultCodeDto;
|
||||
import com.kri.contact.server.service.ResultCodeService;
|
||||
import com.kri.contact.server.service.common.SystemEventLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.util.List;
|
||||
@@ -20,7 +19,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Tag(name = "Result Code", description = "결과 코드 API")
|
||||
public class ResultCodeController {
|
||||
|
||||
private final SystemEventLogService systemEventLogService;
|
||||
private final ResultCodeService resultCodeService;
|
||||
|
||||
@Operation(summary = "결과 코드 조회")
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kri.contact.server.dto.assign;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
|
||||
@Builder
|
||||
@Schema(description = "외주사별 리스트 배정 현황")
|
||||
public record CompanyAssignSummaryItemDto(
|
||||
|
||||
String cmpnId,
|
||||
|
||||
String cmpnAlias,
|
||||
|
||||
long assignedCount
|
||||
) {
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.kri.contact.server.dto.assign;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
|
||||
@Builder
|
||||
@Schema(description = "필드워커별 리스트 배정 현황")
|
||||
public record FieldworkAssignSummaryItemDto(
|
||||
|
||||
String userId,
|
||||
|
||||
String userName,
|
||||
|
||||
String userCmpn,
|
||||
|
||||
long assignedCount
|
||||
) {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.kri.contact.server.dto.assign;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.List;
|
||||
import lombok.Builder;
|
||||
|
||||
@Builder
|
||||
@Schema(description = "프로젝트 외주사 리스트 배정 요약")
|
||||
public record ProjectCompanyAssignSummaryDto(
|
||||
|
||||
long totalCount,
|
||||
|
||||
long unassignedCount,
|
||||
|
||||
List<CompanyAssignSummaryItemDto> assignees
|
||||
) {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.kri.contact.server.dto.assign;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.List;
|
||||
import lombok.Builder;
|
||||
|
||||
@Builder
|
||||
@Schema(description = "프로젝트 필드워커 리스트 배정 요약")
|
||||
public record ProjectFieldworkAssignSummaryDto(
|
||||
|
||||
long totalCount,
|
||||
|
||||
long unassignedCount,
|
||||
|
||||
List<FieldworkAssignSummaryItemDto> assignees
|
||||
) {
|
||||
}
|
||||
@@ -1,17 +1,19 @@
|
||||
package com.kri.contact.server.dto.auth;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "사용자 로그인 요청")
|
||||
public class LoginRequestDto {
|
||||
public record LoginRequestDto(
|
||||
|
||||
@Schema(description = "사용자 ID")
|
||||
private String userId;
|
||||
String userId,
|
||||
|
||||
@Schema(description = "사용자 PW")
|
||||
private String userPw;
|
||||
String userPw
|
||||
) {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LoginRequestDto[redacted]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,18 +4,17 @@ package com.kri.contact.server.dto.auth;
|
||||
import com.kri.common.feature.auth.dto.JwtUserClaimsDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@Schema(description = "로그인 응답")
|
||||
public class LoginResponseDto {
|
||||
public record LoginResponseDto(
|
||||
|
||||
@Schema(description = "jwt access 토큰")
|
||||
private String accessToken;
|
||||
String accessToken,
|
||||
|
||||
@Schema(description = "사용자 정보")
|
||||
private JwtUserClaimsDto user;
|
||||
JwtUserClaimsDto user
|
||||
) {
|
||||
|
||||
public static LoginResponseDto from(String accessToken, JwtUserClaimsDto jwtUserClaims) {
|
||||
return LoginResponseDto.builder()
|
||||
@@ -23,4 +22,9 @@ public class LoginResponseDto {
|
||||
.user(jwtUserClaims)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LoginResponseDto[redacted]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,58 +7,51 @@ import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(description = "회사 정보")
|
||||
public class CmpnInfoDto {
|
||||
public record CmpnInfoDto(
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "회사 id(회사이름)")
|
||||
private String cmpnId;
|
||||
String cmpnId,
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "회사 별칭")
|
||||
private String cmpnAlias;
|
||||
String cmpnAlias,
|
||||
|
||||
@Size(max = 16)
|
||||
@Schema(description = "회사 전화번호")
|
||||
private String cmpnTel;
|
||||
String cmpnTel,
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "자사 여부")
|
||||
private Boolean ownCmpn;
|
||||
Boolean ownCmpn,
|
||||
|
||||
@Schema(description = "메모")
|
||||
private String memo;
|
||||
String memo,
|
||||
|
||||
@Size(max = 32)
|
||||
@Schema(description = "등록자", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private String regUser;
|
||||
String regUser,
|
||||
|
||||
@Schema(description = "등록일시", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private LocalDateTime regDt;
|
||||
LocalDateTime regDt,
|
||||
|
||||
@Size(max = 32)
|
||||
@Schema(description = "수정자", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private String modUser;
|
||||
String modUser,
|
||||
|
||||
@Schema(description = "수정일시", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private LocalDateTime modDt;
|
||||
LocalDateTime modDt
|
||||
) {
|
||||
|
||||
public static CmpnInfoDto from(TCmpnEntity entity) {
|
||||
return CmpnInfoDto.builder()
|
||||
|
||||
@@ -1,30 +1,40 @@
|
||||
package com.kri.contact.server.dto.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||
import com.fasterxml.jackson.annotation.Nulls;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@JsonDeserialize(builder = DataVerificationDto.JsonBuilder.class)
|
||||
@Schema(description = "데이터 검증에 대한 공용 Dto")
|
||||
public class DataVerificationDto {
|
||||
public record DataVerificationDto(
|
||||
|
||||
@Schema(description = "데이터 검증 통과 여부")
|
||||
private boolean success;
|
||||
boolean success,
|
||||
|
||||
@Schema(description = "검증 필드명")
|
||||
private String fieldName;
|
||||
String fieldName,
|
||||
|
||||
@Schema(description = "검증 메시지(error)")
|
||||
private String errMessage;
|
||||
String errMessage
|
||||
) {
|
||||
|
||||
public DataVerificationDto() {
|
||||
this.success = true;
|
||||
this.fieldName = "";
|
||||
this.errMessage = "";
|
||||
this(true, "", "");
|
||||
}
|
||||
|
||||
@JsonPOJOBuilder(withPrefix = "")
|
||||
public static class JsonBuilder {
|
||||
@JsonSetter(nulls = Nulls.AS_EMPTY)
|
||||
public boolean success = true;
|
||||
public String fieldName = "";
|
||||
public String errMessage = "";
|
||||
|
||||
public DataVerificationDto build() {
|
||||
return new DataVerificationDto(success, fieldName, errMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,22 +2,16 @@ package com.kri.contact.server.dto.common;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(description = "날짜 범위 Dto")
|
||||
public class DateRangeDto {
|
||||
public record DateRangeDto(
|
||||
|
||||
@Schema(description = "시작 날짜")
|
||||
private LocalDateTime startDate;
|
||||
LocalDateTime startDate,
|
||||
|
||||
@Schema(description = "종료 날짜")
|
||||
private LocalDateTime endDate;
|
||||
LocalDateTime endDate
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -11,25 +11,18 @@ import lombok.experimental.SuperBuilder;
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "ExcelErrorDto")
|
||||
public class ExcelErrorDto {
|
||||
public abstract class ExcelErrorDto {
|
||||
|
||||
@ExcelColumn(header = "행 번호", order = 0)
|
||||
@Schema(description = "rowNumber")
|
||||
private int rowNumber;
|
||||
|
||||
@ExcelColumn(header = "필드명", order = 1)
|
||||
@ExcelColumn(header = "필드명", order = 2)
|
||||
@Schema(description = "fieldName")
|
||||
private String fieldName;
|
||||
|
||||
@ExcelColumn(header = "에러 메시지", order = 2)
|
||||
@ExcelColumn(header = "에러 메시지", order = 3)
|
||||
@Schema(description = "errorMessage")
|
||||
private String errorMessage;
|
||||
|
||||
public static ExcelErrorDto of(int rowNumber, String fieldName, String errorMessage) {
|
||||
return ExcelErrorDto.builder()
|
||||
.rowNumber(rowNumber)
|
||||
.fieldName(fieldName)
|
||||
.errorMessage(errorMessage)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,32 +2,29 @@ package com.kri.contact.server.dto.excel;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@Schema(description = "ExcelUploadResultDto")
|
||||
public class ExcelUploadResultDto {
|
||||
public record ExcelUploadResultDto(
|
||||
|
||||
@Schema(description = "전체 읽은 행 수 (헤더 제외)")
|
||||
private int totalCount;
|
||||
int totalCount,
|
||||
|
||||
@Schema(description = "DB에 실제로 insert/update 성공한 개수")
|
||||
private int successCount;
|
||||
int successCount,
|
||||
|
||||
@Schema(description = "실패(에러) 개수")
|
||||
private int failCount;
|
||||
int failCount,
|
||||
|
||||
@Schema(description = "에러 엑셀 파일이 있는지 여부")
|
||||
private boolean hasErrorFile;
|
||||
boolean hasErrorFile,
|
||||
|
||||
@Schema(description = "프론트가 저장용으로 쓸 파일명")
|
||||
private String errorFileName;
|
||||
String errorFileName,
|
||||
|
||||
@Schema(description = "에러 엑셀 파일 (xlsx)의 Base64 문자열 (hasErrorFile == true일 때만 세팅)")
|
||||
private String errorFileBase64;
|
||||
String errorFileBase64
|
||||
) {
|
||||
|
||||
public static ExcelUploadResultDto success(int totalCount, int successCount) {
|
||||
return ExcelUploadResultDto.builder()
|
||||
@@ -37,5 +34,4 @@ public class ExcelUploadResultDto {
|
||||
.hasErrorFile(false)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.kri.contact.server.dto.excel;
|
||||
|
||||
import com.kri.common.feature.excel.ExcelColumn;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
@@ -11,9 +11,24 @@ import lombok.experimental.SuperBuilder;
|
||||
@Setter
|
||||
@Schema(description = "ListUploadErrorDto")
|
||||
public class ListUploadErrorDto extends ExcelErrorDto {
|
||||
|
||||
@ExcelColumn(header = "SID", order = 1)
|
||||
@Schema(description = "sid")
|
||||
private String sid;
|
||||
|
||||
public static ListUploadErrorDto of(int rowNumber, String fieldName, String errorMessage) {
|
||||
return of(rowNumber, null, fieldName, errorMessage);
|
||||
}
|
||||
|
||||
public static ListUploadErrorDto of(
|
||||
int rowNumber,
|
||||
String sid,
|
||||
String fieldName,
|
||||
String errorMessage
|
||||
) {
|
||||
return ListUploadErrorDto.builder()
|
||||
.rowNumber(rowNumber)
|
||||
.sid(sid)
|
||||
.fieldName(fieldName)
|
||||
.errorMessage(errorMessage)
|
||||
.build();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.kri.contact.server.dto.excel;
|
||||
|
||||
import com.kri.common.feature.excel.ExcelColumn;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
@@ -12,9 +12,23 @@ import lombok.experimental.SuperBuilder;
|
||||
@Schema(description = "UserUploadErrorDto")
|
||||
public class UserUploadErrorDto extends ExcelErrorDto {
|
||||
|
||||
@ExcelColumn(header = "사용자 ID", order = 1)
|
||||
@Schema(description = "userId")
|
||||
private String userId;
|
||||
|
||||
public static UserUploadErrorDto of(int rowNumber, String fieldName, String errorMessage) {
|
||||
return of(rowNumber, null, fieldName, errorMessage);
|
||||
}
|
||||
|
||||
public static UserUploadErrorDto of(
|
||||
int rowNumber,
|
||||
String userId,
|
||||
String fieldName,
|
||||
String errorMessage
|
||||
) {
|
||||
return UserUploadErrorDto.builder()
|
||||
.rowNumber(rowNumber)
|
||||
.userId(userId)
|
||||
.fieldName(fieldName)
|
||||
.errorMessage(errorMessage)
|
||||
.build();
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.kri.contact.server.dto.list;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.kri.contact.server.common.enums.ResultCodeType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.AssertTrue;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "마지막 이벤트 일자 필터 조건")
|
||||
public record LastEventDateRangeDto(
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "결과 코드 타입")
|
||||
ResultCodeType resultCodeType,
|
||||
|
||||
@Schema(description = "프로젝트 설문 고유번호. SURVEY 타입인 경우 필수")
|
||||
Long prjctSurveyIdx,
|
||||
|
||||
@Schema(description = "시작 일시")
|
||||
LocalDateTime startDate,
|
||||
|
||||
@Schema(description = "종료 일시")
|
||||
LocalDateTime endDate
|
||||
) {
|
||||
|
||||
@JsonIgnore
|
||||
@AssertTrue(message = "SURVEY 타입은 prjctSurveyIdx가 필요합니다.")
|
||||
public boolean isSurveyTargetValid() {
|
||||
return resultCodeType != ResultCodeType.SURVEY || prjctSurveyIdx != null;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import com.kri.contact.server.common.enums.ListAssignType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.kri.contact.server.common.enums.ListAssignType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user