Compare commits
36 Commits
43743a4f08
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 5917a70439 | |||
| 47d741de16 | |||
| fa4d8f70c0 | |||
| b4f08e9e3a | |||
| 07f075fb40 | |||
| 25bacaad45 | |||
| 71a470ccb4 | |||
| 7cd26f7aab | |||
| e3d0c83e7a | |||
| 11fb6d9b8d | |||
| 7ef2a78212 | |||
| 9c1b8a8649 | |||
| 8e4e30c4e6 | |||
| 21047390ac | |||
| 91880ff65f | |||
| 67fbd3d5a6 | |||
| 097cbddeb2 | |||
| f089a7d2a6 | |||
| d2f3f195d3 | |||
| 15d11938a7 | |||
| 6fc5b5ccf1 | |||
| 6b6b5c5280 | |||
| c61fa5f54b | |||
| e17ecc96fa | |||
| d04732f9cd | |||
| 65a3632727 | |||
| c7a56efa1d | |||
| 24cd25548b | |||
| e9fcd4c499 | |||
| 336e99f3d5 | |||
| 5f8cade0b8 | |||
| 65a543ed96 | |||
| f428e1241b | |||
| db18a687e3 | |||
| 06e4569157 | |||
| 825282deab |
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,28 @@
|
|||||||
|
<!--
|
||||||
|
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`.
|
||||||
|
- `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.
|
||||||
25
.agent/profile.yml
Normal file
25
.agent/profile.yml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
schema_version: 1
|
||||||
|
|
||||||
|
project:
|
||||||
|
id: gwcf-review-back
|
||||||
|
name: GWCF Monitoring Backend
|
||||||
|
type: requested-project
|
||||||
|
layer: backend
|
||||||
|
legacy: false
|
||||||
|
|
||||||
|
stack:
|
||||||
|
- java-springboot
|
||||||
|
|
||||||
|
shared_contracts:
|
||||||
|
consumes:
|
||||||
|
- kri-common
|
||||||
|
|
||||||
|
databases:
|
||||||
|
- id: gwcf-review
|
||||||
|
engine: mysql
|
||||||
|
role: primary-monitoring-data
|
||||||
|
access: read-write
|
||||||
|
- id: kon
|
||||||
|
engine: mssql
|
||||||
|
role: kon-reference-data
|
||||||
|
access: read-only
|
||||||
18
.agent/project.md
Normal file
18
.agent/project.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# GWCF Monitoring Backend 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.
|
||||||
21
.agent/references/repository-rules.md
Normal file
21
.agent/references/repository-rules.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
## GWCF Monitoring Backend Repository Rules
|
||||||
|
|
||||||
|
### Deliverable and Domain
|
||||||
|
|
||||||
|
- This Spring Boot backend manages GWCF performance records, monitoring assignments, schedules, visits, reviews, users, codes, files, templates, and event history.
|
||||||
|
- Its operational character is similar to KriContact, but its API, data, permissions, and deliverables remain project-specific contracts.
|
||||||
|
- Treat approved planning material and acceptance criteria as the scope boundary. Preserve assignment, confirmation, monitoring, visit, review, and user workflow state transitions.
|
||||||
|
|
||||||
|
### Data, File, and Integration Safety
|
||||||
|
|
||||||
|
- Preserve organization, performance, user, assignment, and role authorization boundaries for every query and mutation.
|
||||||
|
- Treat Excel uploads/downloads, review templates, PDF conversion, visit files, and stored paths as sensitive file-lifecycle operations. Validate names, paths, sizes, types, cleanup, and partial failures.
|
||||||
|
- Keep MySQL JPA/QueryDSL persistence separate from the read-only KON MSSQL/MyBatis integration. Do not mix dialects, transactions, entities, or mapper assumptions.
|
||||||
|
- Make retries and duplicate submissions safe for assignment, confirmation, visit, upload, and review operations.
|
||||||
|
- Do not expose personal information, monitoring details, customer documents, raw file paths, or unrestricted event logs.
|
||||||
|
|
||||||
|
### Shared Library and Verification
|
||||||
|
|
||||||
|
- Consume `com.kri.common:starter:beta.1.6.3` and use public `com.kri.common.feature.*` APIs. Do not duplicate a KriCommon feature locally.
|
||||||
|
- `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 narrow safe checks. Do not connect to real databases, run the PDF converter, or process customer files during validation 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
|
/gradlew text eol=lf
|
||||||
*.bat text eol=crlf
|
*.bat text eol=crlf
|
||||||
*.jar binary
|
*.jar binary
|
||||||
|
|
||||||
|
/.agent/** text eol=lf
|
||||||
|
/AGENTS.md text eol=lf
|
||||||
|
/CLAUDE.md text eol=lf
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,6 +1,8 @@
|
|||||||
HELP.md
|
HELP.md
|
||||||
.gradle
|
.gradle
|
||||||
build/
|
build/
|
||||||
|
logs/
|
||||||
|
upload-file/
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
!**/src/main/**/build/
|
!**/src/main/**/build/
|
||||||
!**/src/test/**/build/
|
!**/src/test/**/build/
|
||||||
@@ -19,6 +21,7 @@ bin/
|
|||||||
|
|
||||||
### IntelliJ IDEA ###
|
### IntelliJ IDEA ###
|
||||||
.idea
|
.idea
|
||||||
|
.idea_bak
|
||||||
*.iws
|
*.iws
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
|
|||||||
288
AGENTS.md
Normal file
288
AGENTS.md
Normal file
@@ -0,0 +1,288 @@
|
|||||||
|
<!--
|
||||||
|
GENERATED BY KRI AGENT HARNESS. DO NOT EDIT DIRECTLY.
|
||||||
|
Project: gwcf-review-back
|
||||||
|
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.
|
||||||
|
|
||||||
|
## Requested Project Rules
|
||||||
|
|
||||||
|
- Treat the approved requirements, acceptance criteria, and recorded decisions as the primary scope boundary.
|
||||||
|
- Do not infer a requirement solely from a file name, folder date, or apparently newer document.
|
||||||
|
- When requirements conflict, report the exact sources and request a decision.
|
||||||
|
- Preserve original customer, partner, and planning documents as read-only evidence unless document editing is explicitly approved.
|
||||||
|
- Summarize durable implementation requirements inside the repository rather than relying only on files outside the repository.
|
||||||
|
- Do not expand the deliverable with speculative features, infrastructure, or architectural changes.
|
||||||
|
- Record material assumptions and unresolved decisions in the project-specific rules or existing project documentation.
|
||||||
|
- Define observable acceptance criteria before implementation.
|
||||||
|
- Treat separately managed Frontend and Backend repositories as independent deliverables with a coordinated contract.
|
||||||
|
- Protect customer, partner, survey, and field data as sensitive information.
|
||||||
|
- Keep handoff, operation, configuration, and validation instructions usable by the requesting team.
|
||||||
|
- Report deviations from the requested scope and obtain approval before proceeding.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
## Microsoft SQL Server
|
||||||
|
|
||||||
|
- Use T-SQL syntax and behavior only for data sources whose declared engine is `mssql`.
|
||||||
|
- Preserve the configured SQL Server version, database and schema names, collation, naming, migration, and access conventions.
|
||||||
|
- Parameterize values. Do not build SQL by concatenating untrusted input.
|
||||||
|
- Preserve Unicode behavior and use the repository's established `nvarchar`/`nchar` and parameter conventions where Korean or other Unicode text is possible.
|
||||||
|
- Treat stored-procedure parameters, result sets, return values, transaction behavior, and error behavior as public contracts.
|
||||||
|
- Consider indexes and actual execution characteristics for changed filters, joins, ordering, grouping, and pagination.
|
||||||
|
- Do not introduce MySQL or other dialect syntax into MSSQL paths.
|
||||||
|
- Keep read-only legacy integrations read-only. A source-code change approval authorizes SQL analysis and script drafting only; execution requires 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.
|
||||||
|
- 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.
|
||||||
|
|
||||||
|
# GWCF Monitoring Backend 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,7 +30,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "com.kri.common:starter:beta.1.1.29"
|
implementation "com.kri.common:starter:beta.1.6.4"
|
||||||
|
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kri.gwcf.review.back.common.consts;
|
package com.kri.gwcf.review.back.common.consts;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@@ -8,4 +9,16 @@ public final class GwcfConstant {
|
|||||||
public static final String SYSTEM_USER_NAME = "SYSTEM";
|
public static final String SYSTEM_USER_NAME = "SYSTEM";
|
||||||
public static final Integer WRITTEN_USER_ROLE = 2021;
|
public static final Integer WRITTEN_USER_ROLE = 2021;
|
||||||
public static final Integer MONITORING_USER_ROLE = 9003;
|
public static final Integer MONITORING_USER_ROLE = 9003;
|
||||||
|
public static final Short REJECT_ASSIGN_ORDER = 9999;
|
||||||
|
|
||||||
|
public static final Integer MONITORING_REVIEW_TYPE = 1;
|
||||||
|
public static final Integer MONITORING_VISIT_DEPARTURE_STATUS = 2;
|
||||||
|
public static final Integer MONITORING_VISIT_ARRIVAL_STATUS = 3;
|
||||||
|
|
||||||
|
public static final List<Integer> REVIEW_TYPE = List.of(1, 3);
|
||||||
|
public static final List<Integer> REVIEW_CLASSIFICATION = List.of(1, 3, 4, 5, 99);
|
||||||
|
public static final List<Integer> MONITORING_VISIT_RESETTABLE_REVIEW_STATUS = List.of(
|
||||||
|
MONITORING_VISIT_DEPARTURE_STATUS,
|
||||||
|
MONITORING_VISIT_ARRIVAL_STATUS
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.kri.gwcf.review.back.common.enums;
|
||||||
|
|
||||||
|
import com.kri.common.feature.enums.CodeEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Schema(description = "배정 승인 상태")
|
||||||
|
public enum AssignConfirmStatus implements CodeEnum<Short> {
|
||||||
|
REQUESTED((short) 0), // 요청
|
||||||
|
CONFIRMED((short) 1), // 승인
|
||||||
|
REJECTED((short) 9); // 거절
|
||||||
|
|
||||||
|
private final Short code;
|
||||||
|
}
|
||||||
@@ -25,15 +25,19 @@ public enum SystemEventType implements CodeEnum<Short> {
|
|||||||
|
|
||||||
ASSIGN_PERFORMANCE_REQUEST((short) 1031), //공연 배정 요청
|
ASSIGN_PERFORMANCE_REQUEST((short) 1031), //공연 배정 요청
|
||||||
ASSIGN_PERFORMANCE_CONFIRM((short) 1032), //공연 배정 승인
|
ASSIGN_PERFORMANCE_CONFIRM((short) 1032), //공연 배정 승인
|
||||||
ASSIGN_PERFORMANCE_REJECT((short) 1033), //공연 배정 거절
|
ASSIGN_PERFORMANCE_CANCEL((short) 1033), //공연 배정 거절
|
||||||
ASSIGN_PERFORMANCE_FORCE((short) 1034), //강제 공연 배정
|
ASSIGN_PERFORMANCE_FORCE((short) 1034), //강제 공연 배정
|
||||||
|
UPLOAD_WRITTEN_ASSIGN((short) 1036),
|
||||||
|
ASSIGN_PERFORMANCE_REJECT((short) 1039), //공연 배정 거절
|
||||||
|
|
||||||
VISIT_START((short) 2011), //모니터링 출발
|
VISIT_START((short) 2011), //모니터링 출발
|
||||||
VISIT_END((short) 2012), //모니터링 도착
|
VISIT_END((short) 2012), //모니터링 도착
|
||||||
|
VISIT_RESET((short) 2099), //모니터링 출발.도착 초기화
|
||||||
|
|
||||||
UPLOAD_MONITORING_REVIEW((short) 2041), //모니터링 결과보고서 업로드
|
UPLOAD_MONITORING_REVIEW((short) 2041), //모니터링 결과보고서 업로드
|
||||||
UPLOAD_LOCAL_GOV_REVIEW((short) 2042), //지자체 결과보고서 업로드
|
UPLOAD_LOCAL_GOV_REVIEW((short) 2042), //지자체 결과보고서 업로드
|
||||||
UPDATE_WRITTEN_REVIEW((short) 2043), //지자체 결과보고서 업로드
|
START_WRITTEN_REVIEW((short) 2044), // 서면 평가 시작
|
||||||
|
END_WRITTEN_REVIEW((short) 2045), // 서면평가 종료
|
||||||
|
|
||||||
DUMMY((short) 9999);
|
DUMMY((short) 9999);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.kri.gwcf.review.back.common.util;
|
||||||
|
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
public final class DownloadHeaderUtil {
|
||||||
|
|
||||||
|
public static String attachmentContentDisposition(String fileName) {
|
||||||
|
return "attachment; filename*=UTF-8''" +
|
||||||
|
URLEncoder.encode(fileName, StandardCharsets.UTF_8).replace("+", "%20");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.kri.gwcf.review.back.config;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableAsync
|
||||||
|
public class AsyncConfig {
|
||||||
|
|
||||||
|
@Bean(name = "pdfConvertTaskExecutor")
|
||||||
|
public Executor pdfConvertTaskExecutor() {
|
||||||
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
|
executor.setCorePoolSize(1);
|
||||||
|
executor.setMaxPoolSize(1);
|
||||||
|
executor.setQueueCapacity(100);
|
||||||
|
executor.setThreadNamePrefix("pdf-convert-");
|
||||||
|
executor.initialize();
|
||||||
|
return executor;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,4 +10,5 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||||||
public class FileStorageProperties {
|
public class FileStorageProperties {
|
||||||
private String visitBaseDir;
|
private String visitBaseDir;
|
||||||
private String reviewBaseDir;
|
private String reviewBaseDir;
|
||||||
|
private String reviewTemplateBaseDir;
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,34 @@
|
|||||||
package com.kri.gwcf.review.back.controller;
|
package com.kri.gwcf.review.back.controller;
|
||||||
|
|
||||||
|
import static com.kri.gwcf.review.back.common.util.ExcelResponseBuilder.buildExcelResponse;
|
||||||
|
|
||||||
import com.kri.common.feature.datetime.DateTimeUtil;
|
import com.kri.common.feature.datetime.DateTimeUtil;
|
||||||
import com.kri.common.feature.web.RequestUserContext;
|
import com.kri.common.feature.web.RequestUserContext;
|
||||||
|
import com.kri.gwcf.review.back.dto.assign.AssignUserCountDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.assign.MonitoringAssignSaveRequestDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.excel.ExcelUploadResultDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.kon.PerformanceApplyCountDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.monitoring.MonitoringApplyUserDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.performance.PerformanceAssignDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.systemlog.UploadContentDto;
|
||||||
|
import com.kri.gwcf.review.back.service.AssignService;
|
||||||
import com.kri.gwcf.review.back.service.common.SystemEventLogService;
|
import com.kri.gwcf.review.back.service.common.SystemEventLogService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
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.PatchMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/assign")
|
@RequestMapping("/api/v1/assign")
|
||||||
@@ -18,14 +36,132 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@Tag(name = "Assign", description = "배정 API")
|
@Tag(name = "Assign", description = "배정 API")
|
||||||
public class AssignController {
|
public class AssignController {
|
||||||
|
|
||||||
|
private final AssignService assignService;
|
||||||
private final SystemEventLogService systemEventLogService;
|
private final SystemEventLogService systemEventLogService;
|
||||||
|
|
||||||
@Operation(summary = "참여 동의")
|
@Operation(summary = "사용자별 배정 건수 조회")
|
||||||
@PostMapping("/confirm/{userId}")
|
@GetMapping("/users/count")
|
||||||
public boolean assignConfirm(@PathVariable String userId, RequestUserContext ctx) {
|
public List<AssignUserCountDto> findAssignUserCounts() {
|
||||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
return assignService.findAssignUserCounts();
|
||||||
|
}
|
||||||
|
|
||||||
systemEventLogService.writeAssignConfirmLog(userId, now, ctx.getClientIp());
|
@Operation(summary = "모니터링 신청자 목록")
|
||||||
return false;
|
@GetMapping("/monitoring/apply-users/{performanceId}")
|
||||||
|
public List<MonitoringApplyUserDto> findMonitoringApplyUsers(
|
||||||
|
@PathVariable Integer performanceId
|
||||||
|
) {
|
||||||
|
return assignService.findMonitoringApplyUsers(performanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "공연별 모니터링 신청자 수")
|
||||||
|
@GetMapping("/monitoring/apply-users/count")
|
||||||
|
public List<PerformanceApplyCountDto> findMonitoringApplyUsersCount() {
|
||||||
|
return assignService.findMonitoringApplyUsersCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "참여 동의")
|
||||||
|
@PostMapping("/confirm/{performanceId}/{userId}")
|
||||||
|
public String assignConfirm(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable String userId,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
String result = assignService.confirmMonitoringAssignByUser(performanceId, userId, true);
|
||||||
|
systemEventLogService.writeAssignConfirmLog(userId, now, ctx.getClientIp(), String.valueOf(performanceId));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "참여 거절")
|
||||||
|
@PostMapping("/reject/{performanceId}/{userId}")
|
||||||
|
public String assignReject(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable String userId,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
String result = assignService.confirmMonitoringAssignByUser(performanceId, userId, false);
|
||||||
|
systemEventLogService.writeAssignRejectLog(userId, now, ctx.getClientIp(), String.valueOf(performanceId));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "모니터링 배정 저장")
|
||||||
|
@PostMapping("/monitoring")
|
||||||
|
public List<PerformanceAssignDto> saveMonitoringAssign(
|
||||||
|
@RequestBody MonitoringAssignSaveRequestDto dto,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
List<PerformanceAssignDto> result =
|
||||||
|
assignService.saveMonitoringAssign(dto.getPerformanceId(), dto.getUserIds(), ctx.getUserId(), now);
|
||||||
|
systemEventLogService.writeAssignPerformanceRequestLog(
|
||||||
|
ctx.getUserId(),
|
||||||
|
now,
|
||||||
|
ctx.getClientIp(),
|
||||||
|
dto.getPerformanceId(),
|
||||||
|
dto.getUserIds()
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "서면평가위원 일괄 배정 양식 다운로드")
|
||||||
|
@PostMapping("/written/excel/template")
|
||||||
|
public ResponseEntity<byte[]> exportUserTemplate() {
|
||||||
|
byte[] bytes = assignService.exportAssignTemplate();
|
||||||
|
return buildExcelResponse("user_assign_template.xlsx", bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "서면평가위원 일괄 배정(엑셀 업로드)")
|
||||||
|
@PostMapping(value = "/written/excel/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
|
public ExcelUploadResultDto createWrittenAssignsFromExcel(
|
||||||
|
@RequestParam("file") MultipartFile file,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
ExcelUploadResultDto result = assignService.createWrittenAssignsFromExcel(file, ctx.getUserId(), now);
|
||||||
|
systemEventLogService.writeUploadWrittenAssignLog(
|
||||||
|
ctx.getUserId(),
|
||||||
|
now,
|
||||||
|
ctx.getClientIp(),
|
||||||
|
UploadContentDto.from(file, ctx.getUserId())
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "배정 확정")
|
||||||
|
@PatchMapping("/confirm/{performanceId}/{userId}")
|
||||||
|
public void confirmAssign(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable String userId,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
assignService.confirmAssign(performanceId, userId, true);
|
||||||
|
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
systemEventLogService.writeAssignConfirmByAdminLog(
|
||||||
|
ctx.getUserId(),
|
||||||
|
now,
|
||||||
|
ctx.getClientIp(),
|
||||||
|
performanceId,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "배정 취소")
|
||||||
|
@PatchMapping("/cancel/{performanceId}/{userId}")
|
||||||
|
public void cancelAssign(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable String userId,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
assignService.confirmAssign(performanceId, userId, false);
|
||||||
|
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
systemEventLogService.writeAssignCancelLog(
|
||||||
|
ctx.getUserId(),
|
||||||
|
now,
|
||||||
|
ctx.getClientIp(),
|
||||||
|
performanceId,
|
||||||
|
userId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.kri.gwcf.review.back.controller;
|
||||||
|
|
||||||
|
import com.kri.gwcf.review.back.dto.common.CodeDto;
|
||||||
|
import com.kri.gwcf.review.back.service.CodeService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/v1/code")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Tag(name = "Code", description = "코드 API")
|
||||||
|
public class CodeController {
|
||||||
|
|
||||||
|
private final CodeService codeService;
|
||||||
|
|
||||||
|
@Operation(summary = "코드 조회")
|
||||||
|
@GetMapping("/{codeGroup}")
|
||||||
|
public List<CodeDto> getCodeList(@PathVariable String codeGroup) {
|
||||||
|
return codeService.findByCodeGroup(codeGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package com.kri.gwcf.review.back.controller;
|
||||||
|
|
||||||
|
import static com.kri.gwcf.review.back.common.util.DownloadHeaderUtil.attachmentContentDisposition;
|
||||||
|
|
||||||
|
import com.kri.common.feature.datetime.DateTimeUtil;
|
||||||
|
import com.kri.common.feature.web.RequestUserContext;
|
||||||
|
import com.kri.gwcf.review.back.dto.monitoring.MonitoringGpsRequestDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.performance.PerformanceMonitoringVisitDto;
|
||||||
|
import com.kri.gwcf.review.back.service.VisitService;
|
||||||
|
import com.kri.gwcf.review.back.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 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.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.RequestPart;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/v1/monitoring/visit")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Tag(name = "Monitoring Visit", description = "모니터링 방문 API")
|
||||||
|
public class MonitoringVisitController {
|
||||||
|
|
||||||
|
private final VisitService visitService;
|
||||||
|
private final SystemEventLogService systemEventLogService;
|
||||||
|
|
||||||
|
@Operation(summary = "모니터링 출발 저장")
|
||||||
|
@PostMapping("/departure/{performanceId}")
|
||||||
|
public PerformanceMonitoringVisitDto saveDeparture(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@RequestBody MonitoringGpsRequestDto gps,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
PerformanceMonitoringVisitDto result = visitService.saveDeparture(performanceId, gps, ctx.getUserId(), now);
|
||||||
|
systemEventLogService.writeVisitStartLog(ctx.getUserId(), now, ctx.getClientIp(), performanceId);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "모니터링 도착 저장 + 증빙 사진 업로드")
|
||||||
|
@PostMapping(value = "/arrival/{performanceId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
|
public PerformanceMonitoringVisitDto saveArrival(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@RequestPart("gps") MonitoringGpsRequestDto gps,
|
||||||
|
@RequestPart(value = "files", required = false) List<MultipartFile> files,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
PerformanceMonitoringVisitDto result = visitService.saveArrival(performanceId, gps, files, ctx.getUserId(), now);
|
||||||
|
int evidenceFileCount = files == null ? 0 : (int) files.stream()
|
||||||
|
.filter(file -> file != null && !file.isEmpty())
|
||||||
|
.count();
|
||||||
|
systemEventLogService.writeVisitEndLog(
|
||||||
|
ctx.getUserId(),
|
||||||
|
now,
|
||||||
|
ctx.getClientIp(),
|
||||||
|
performanceId,
|
||||||
|
evidenceFileCount
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "증빙 사진 조회")
|
||||||
|
@GetMapping("/evidence/{performanceId}/{userId}")
|
||||||
|
public List<PerformanceMonitoringVisitDto> findEvidence(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable String userId
|
||||||
|
) {
|
||||||
|
return visitService.findEvidence(performanceId, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "모니터링 방문 초기화")
|
||||||
|
@DeleteMapping("/reset/{performanceId}/{userId}")
|
||||||
|
public void reset(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable String userId,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
visitService.reset(performanceId, userId);
|
||||||
|
|
||||||
|
systemEventLogService.writeVisitResetLog(
|
||||||
|
ctx.getUserId(),
|
||||||
|
now,
|
||||||
|
ctx.getClientIp(),
|
||||||
|
performanceId,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "증빙 사진 ZIP 다운로드")
|
||||||
|
@GetMapping("/evidence/zip/{performanceId}/{userId}")
|
||||||
|
public ResponseEntity<byte[]> downloadEvidenceZip(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable String userId
|
||||||
|
) {
|
||||||
|
byte[] bytes = visitService.downloadEvidenceZip(performanceId, userId);
|
||||||
|
String fileName = "evidence_" + performanceId + "_" + userId + ".zip";
|
||||||
|
return ResponseEntity.ok()
|
||||||
|
.header(HttpHeaders.CONTENT_DISPOSITION, attachmentContentDisposition(fileName))
|
||||||
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
.body(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -64,6 +64,16 @@ public class PerformanceController {
|
|||||||
return buildExcelResponse("performance_upload_template.xlsx", bytes);
|
return buildExcelResponse("performance_upload_template.xlsx", bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "공연정보 엑셀 다운로드")
|
||||||
|
@PostMapping("/excel/download")
|
||||||
|
public ResponseEntity<byte[]> exportPerformance(
|
||||||
|
@RequestBody String[] performanceIds
|
||||||
|
) {
|
||||||
|
byte[] bytes = performanceService.exportPerformance(performanceIds);
|
||||||
|
|
||||||
|
return buildExcelResponse("performance.xlsx", bytes);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "공연 일괄 생성(엑셀 업로드)",
|
summary = "공연 일괄 생성(엑셀 업로드)",
|
||||||
description = "성공하면 JSON, 실패가 있으면 실패 내역 엑셀(xlsx) 반환"
|
description = "성공하면 JSON, 실패가 있으면 실패 내역 엑셀(xlsx) 반환"
|
||||||
@@ -79,7 +89,7 @@ public class PerformanceController {
|
|||||||
|
|
||||||
ExcelUploadResultDto result = performanceService.createPerformancesFromExcel(file, regId, now);
|
ExcelUploadResultDto result = performanceService.createPerformancesFromExcel(file, regId, now);
|
||||||
|
|
||||||
systemEventLogService.writeUploadPerformanceLog(regId, now, clientIp, UploadContentDto.from(file));
|
systemEventLogService.writeUploadPerformanceLog(regId, now, clientIp, UploadContentDto.from(file, regId));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,160 @@
|
|||||||
|
package com.kri.gwcf.review.back.controller;
|
||||||
|
|
||||||
|
import com.kri.common.feature.datetime.DateTimeUtil;
|
||||||
|
import com.kri.common.feature.web.RequestUserContext;
|
||||||
|
import static com.kri.gwcf.review.back.common.util.DownloadHeaderUtil.attachmentContentDisposition;
|
||||||
|
import com.kri.gwcf.review.back.dto.performance.PerformanceReviewDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.systemlog.UploadContentDto;
|
||||||
|
import com.kri.gwcf.review.back.service.ReviewService;
|
||||||
|
import com.kri.gwcf.review.back.service.ReviewTemplateService;
|
||||||
|
import com.kri.gwcf.review.back.service.common.SystemEventLogService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
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.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/v1/review")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Tag(name = "Review", description = "평가/모니터링 API")
|
||||||
|
public class ReviewController {
|
||||||
|
|
||||||
|
private final ReviewService reviewService;
|
||||||
|
private final ReviewTemplateService reviewTemplateService;
|
||||||
|
private final SystemEventLogService systemEventLogService;
|
||||||
|
|
||||||
|
@Operation(summary = "서면평가 시작 저장")
|
||||||
|
@PostMapping("/start/{performanceId}/{userId}")
|
||||||
|
public PerformanceReviewDto startWrittenReview(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable String userId,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
PerformanceReviewDto result = reviewService.saveWrittenReviewStatus(performanceId, 1, userId, now);
|
||||||
|
systemEventLogService.writeStartWrittenReviewLog(userId, now, ctx.getClientIp(), performanceId);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "서면평가 완료 저장")
|
||||||
|
@PostMapping("/end/{performanceId}/{userId}")
|
||||||
|
public PerformanceReviewDto endWrittenReview(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable String userId,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
PerformanceReviewDto result = reviewService.saveWrittenReviewStatus(performanceId, 10, userId, now);
|
||||||
|
systemEventLogService.writeEndWrittenReviewLog(userId, now, ctx.getClientIp(), performanceId);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "평가/모니터링 파일 업로드")
|
||||||
|
@PostMapping(value = "/{performanceId}/{reviewType}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
|
public PerformanceReviewDto uploadReviewFile(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable Integer reviewType,
|
||||||
|
@RequestParam(required = false) String paramUserId,
|
||||||
|
@RequestParam("file") MultipartFile file,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
String userId = paramUserId != null ? paramUserId : ctx.getUserId();
|
||||||
|
|
||||||
|
PerformanceReviewDto result = reviewService.uploadReviewFile(performanceId, reviewType, file, userId, now);
|
||||||
|
systemEventLogService.writeUploadReviewFileLog(
|
||||||
|
ctx.getUserId(),
|
||||||
|
now,
|
||||||
|
ctx.getClientIp(),
|
||||||
|
performanceId,
|
||||||
|
reviewType,
|
||||||
|
UploadContentDto.from(file, userId)
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "평가/모니터링 파일 조회")
|
||||||
|
@GetMapping("/{performanceId}/{reviewType}/{userId}")
|
||||||
|
public PerformanceReviewDto getReviewFile(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable Integer reviewType,
|
||||||
|
@PathVariable String userId
|
||||||
|
) {
|
||||||
|
return reviewService.getReviewFile(performanceId, reviewType, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "평가/모니터링 원본 파일 다운로드")
|
||||||
|
@GetMapping("/download/{performanceId}/{reviewType}/{userId}")
|
||||||
|
public ResponseEntity<Resource> downloadOriginalFile(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable Integer reviewType,
|
||||||
|
@PathVariable String userId
|
||||||
|
) {
|
||||||
|
return download(reviewService.getOriginalFileResource(performanceId, reviewType, userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "평가/모니터링 원본 파일 압축 다운로드")
|
||||||
|
@GetMapping("/download/{performanceId}/{reviewType}")
|
||||||
|
public ResponseEntity<Resource> downloadOriginalFileZip(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable Integer reviewType
|
||||||
|
) {
|
||||||
|
return download(reviewService.getOriginalFileZipResource(performanceId, reviewType));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "PDF 변환 파일 조회/다운로드")
|
||||||
|
@GetMapping("/pdf/{performanceId}/{reviewType}/{userId}")
|
||||||
|
public ResponseEntity<Resource> downloadPdfOrOriginalFile(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable Integer reviewType,
|
||||||
|
@PathVariable String userId
|
||||||
|
) {
|
||||||
|
return download(reviewService.getPdfOrOriginalFileResource(performanceId, reviewType, userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "평가양식 업로드")
|
||||||
|
@PostMapping(value = "/template/upload/{reviewType}/{classification}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
|
public String uploadReviewTemplate(
|
||||||
|
@PathVariable Integer reviewType,
|
||||||
|
@PathVariable Integer classification,
|
||||||
|
@RequestParam("file") MultipartFile file
|
||||||
|
) {
|
||||||
|
return reviewTemplateService.uploadReviewTemplate(reviewType, classification, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "평가양식 다운로드")
|
||||||
|
@GetMapping("/template/download/{reviewType}/{classification}")
|
||||||
|
public ResponseEntity<Resource> downloadReviewTemplate(
|
||||||
|
@PathVariable Integer reviewType,
|
||||||
|
@PathVariable Integer classification
|
||||||
|
) {
|
||||||
|
return download(reviewTemplateService.getReviewTemplateResource(reviewType, classification));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "평가양식 pdf 다운로드")
|
||||||
|
@GetMapping("/template/pdf/{reviewType}/{classification}")
|
||||||
|
public ResponseEntity<Resource> downloadReviewPdfTemplate(
|
||||||
|
@PathVariable Integer reviewType,
|
||||||
|
@PathVariable Integer classification
|
||||||
|
) {
|
||||||
|
return download(reviewTemplateService.getReviewTemplatePdfResource(reviewType, classification));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResponseEntity<Resource> download(Resource resource) {
|
||||||
|
return ResponseEntity.ok()
|
||||||
|
.header(HttpHeaders.CONTENT_DISPOSITION, attachmentContentDisposition(resource.getFilename()))
|
||||||
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
.body(resource);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,6 +59,17 @@ public class UserController {
|
|||||||
return buildExcelResponse("user_upload_template.xlsx", bytes);
|
return buildExcelResponse("user_upload_template.xlsx", bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "사용자 엑셀 다운로드")
|
||||||
|
@PostMapping("/excel/download/{userRole}")
|
||||||
|
public ResponseEntity<byte[]> exportUser(
|
||||||
|
@PathVariable Integer userRole,
|
||||||
|
@RequestBody String[] userIds
|
||||||
|
) {
|
||||||
|
byte[] bytes = userService.exportUser(userRole, userIds);
|
||||||
|
|
||||||
|
return buildExcelResponse("user.xlsx", bytes);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "사용자 일괄 생성(엑셀 업로드)",
|
summary = "사용자 일괄 생성(엑셀 업로드)",
|
||||||
description = "성공하면 JSON, 실패가 있으면 실패 내역 엑셀(xlsx) 반환"
|
description = "성공하면 JSON, 실패가 있으면 실패 내역 엑셀(xlsx) 반환"
|
||||||
@@ -75,7 +86,7 @@ public class UserController {
|
|||||||
|
|
||||||
ExcelUploadResultDto result = userService.createUsersFromExcel(userRole, file, regId, now);
|
ExcelUploadResultDto result = userService.createUsersFromExcel(userRole, file, regId, now);
|
||||||
|
|
||||||
systemEventLogService.writeUploadUserLog(regId, now, clientIp, UploadContentDto.from(file));
|
systemEventLogService.writeUploadUserLog(regId, now, clientIp, UploadContentDto.from(file, regId));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.kri.gwcf.review.back.dto.assign;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AssignUserCountDto {
|
||||||
|
|
||||||
|
@Schema(description = "배정 사용자 ID")
|
||||||
|
private String assignUser;
|
||||||
|
|
||||||
|
@Schema(description = "배정 건수")
|
||||||
|
private Long assignCount;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.kri.gwcf.review.back.dto.assign;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class MonitoringAssignSaveRequestDto {
|
||||||
|
|
||||||
|
@Schema(description = "공연 ID")
|
||||||
|
private Integer performanceId;
|
||||||
|
|
||||||
|
@Schema(description = "모니터링 요원 사용자 ID 목록")
|
||||||
|
private List<String> userIds;
|
||||||
|
}
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
package com.kri.gwcf.review.back.dto.excel;
|
|
||||||
|
|
||||||
import com.kri.common.feature.excel.ExcelColumn;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class PerformanceUploadDto {
|
|
||||||
|
|
||||||
@ExcelColumn(header = "연번", order = 0, width = 10)
|
|
||||||
@Schema(description = "연번")
|
|
||||||
private String performanceId;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "사업유형", order = 1, width = 10)
|
|
||||||
@Schema(description = "사업유형")
|
|
||||||
private String businessType;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "분야(장르)", order = 2, width = 10)
|
|
||||||
@Schema(description = "분야(장르)")
|
|
||||||
private String genre;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "지역", order = 3, width = 10)
|
|
||||||
@Schema(description = "지역")
|
|
||||||
private String performanceArea;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "단체(인) 명", order = 4, width = 11)
|
|
||||||
@Schema(description = "단체(인) 명")
|
|
||||||
private String artistName;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "사업 명", order = 5, width = 10)
|
|
||||||
@Schema(description = "사업 명")
|
|
||||||
private String performanceName;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "사업 수행 월", order = 6, width = 12)
|
|
||||||
@Schema(description = "사업 수행 월")
|
|
||||||
private String performanceStartMonth;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "사업 일정", order = 7, width = 10)
|
|
||||||
@Schema(description = "사업 일정")
|
|
||||||
private String performanceDtInfo;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "운영 시간", order = 8, width = 10)
|
|
||||||
@Schema(description = "운영 시간")
|
|
||||||
private String performanceTimeInfo;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "티켓 예약", order = 9, width = 10)
|
|
||||||
@Schema(description = "티켓 예약")
|
|
||||||
private String ticketReservationStatus;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "티켓 비고", order = 10, width = 10)
|
|
||||||
@Schema(description = "티켓 비고")
|
|
||||||
private String ticketReservationMemo;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "모니터링 일정", order = 11, width = 14)
|
|
||||||
@Schema(description = "모니터링 일정")
|
|
||||||
private String monitoringDate;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "모니터링 시간", order = 12, width = 14)
|
|
||||||
@Schema(description = "모니터링 시간")
|
|
||||||
private String monitoringTimeInfo;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "모니터링 방문 장소", order = 13, width = 18)
|
|
||||||
@Schema(description = "모니터링 방문 장소")
|
|
||||||
private String monitoringAddress;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "대표자 명", order = 14, width = 10)
|
|
||||||
@Schema(description = "대표자 명")
|
|
||||||
private String ownStaffName;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "대표자 연락처1", order = 15, width = 14)
|
|
||||||
@Schema(description = "대표자 연락처1")
|
|
||||||
private String ownStaffTel1;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "대표자 연락처2", order = 16, width = 14)
|
|
||||||
@Schema(description = "대표자 연락처2")
|
|
||||||
private String ownStaffTel2;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "대표자 이메일", order = 17, width = 14)
|
|
||||||
@Schema(description = "대표자 이메일")
|
|
||||||
private String ownStaffEmail;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "실무자 명", order = 18, width = 10)
|
|
||||||
@Schema(description = "실무자 명")
|
|
||||||
private String contactStaffName;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "실무자 연락처1", order = 19, width = 14)
|
|
||||||
@Schema(description = "실무자 연락처1")
|
|
||||||
private String contactStaffTel1;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "실무자 연락처2", order = 20, width = 14)
|
|
||||||
@Schema(description = "실무자 연락처2")
|
|
||||||
private String contactStaffTel2;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "실무자 이메일", order = 21, width = 14)
|
|
||||||
@Schema(description = "실무자 이메일")
|
|
||||||
private String contactStaffEmail;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "메모", order = 22, width = 10)
|
|
||||||
@Schema(description = "메모")
|
|
||||||
private String performanceMemo;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "요원 비용지급일", order = 23, width = 16)
|
|
||||||
@Schema(description = "요원 비용지급일")
|
|
||||||
private String monitoringPaymentDate;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.kri.gwcf.review.back.dto.excel.performance;
|
||||||
|
|
||||||
|
import com.kri.common.feature.excel.ExcelColumn;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PerformanceDownloadDto extends PerformanceUploadDto {
|
||||||
|
|
||||||
|
@ExcelColumn(header = "지자체 평가자", order = 32, width = 16)
|
||||||
|
@Schema(description = "지자체 평가자")
|
||||||
|
private String localReviewUser;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "지자체 평가 상태", order = 33, width = 16)
|
||||||
|
@Schema(description = "지자체 평가 상태")
|
||||||
|
private String localReviewStatus;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "지자체 평가 일시", order = 34, width = 16)
|
||||||
|
@Schema(description = "지자체 평가 일시")
|
||||||
|
private String localReviewDt;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "모니터링1 평가자", order = 35, width = 16)
|
||||||
|
@Schema(description = "모니터링1 평가자")
|
||||||
|
private String monitoringReviewUser1;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "모니터링1 평가 상태", order = 36, width = 16)
|
||||||
|
@Schema(description = "모니터링1 평가 상태")
|
||||||
|
private String monitoringReviewStatus1;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "모니터링1 평가 일시", order = 37, width = 16)
|
||||||
|
@Schema(description = "모니터링1 평가 일시")
|
||||||
|
private String monitoringReviewDt1;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "모니터링2 평가자", order = 38, width = 16)
|
||||||
|
@Schema(description = "모니터링2 평가자")
|
||||||
|
private String monitoringReviewUser2;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "모니터링2 평가 상태", order = 39, width = 16)
|
||||||
|
@Schema(description = "모니터링2 평가 상태")
|
||||||
|
private String monitoringReviewStatus2;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "모니터링2 평가 일시", order = 40, width = 16)
|
||||||
|
@Schema(description = "모니터링2 평가 일시")
|
||||||
|
private String monitoringReviewDt2;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "서면 평가 위원", order = 41, width = 16)
|
||||||
|
@Schema(description = "서면 평가 위원")
|
||||||
|
private String writtenReviewUser;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "서면 평가 상태", order = 42, width = 16)
|
||||||
|
@Schema(description = "서면 평가 상태")
|
||||||
|
private String writtenReviewStatus;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "서면 평가 일시", order = 43, width = 16)
|
||||||
|
@Schema(description = "서면 평가 일시")
|
||||||
|
private String writtenReviewDt;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "변경 사항", order = 44, width = 20)
|
||||||
|
private String updateNoticeTarget;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "변경 내용", order = 45, width = 40)
|
||||||
|
private String updateNoticeMemo;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "변경 일시", order = 46, width = 26)
|
||||||
|
private String updateNoticeDt;
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package com.kri.gwcf.review.back.dto.excel.performance;
|
||||||
|
|
||||||
|
import com.kri.common.feature.excel.ExcelColumn;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PerformanceUploadDto {
|
||||||
|
|
||||||
|
@ExcelColumn(header = "NO", order = 0, width = 10)
|
||||||
|
@Schema(description = "NO")
|
||||||
|
private String performanceNo;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "연번", order = 1, width = 10)
|
||||||
|
@Schema(description = "연번")
|
||||||
|
private String performanceId;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "관리번호", order = 2, width = 18)
|
||||||
|
@Schema(description = "숫자로 구성된 관리번호")
|
||||||
|
private String ncas;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "사업유형", order = 3, width = 10)
|
||||||
|
@Schema(description = "사업유형")
|
||||||
|
private String businessType;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "분야(장르)", order = 4, width = 10)
|
||||||
|
@Schema(description = "분야(장르)")
|
||||||
|
private String genre;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "지역", order = 5, width = 10)
|
||||||
|
@Schema(description = "지역")
|
||||||
|
private String performanceArea;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "지역 세부", order = 6, width = 10)
|
||||||
|
@Schema(description = "지역 세부")
|
||||||
|
private String performanceAreaDetail;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "단체(인) 명", order = 7, width = 11)
|
||||||
|
@Schema(description = "단체(인) 명")
|
||||||
|
private String artistName;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "사업 명", order = 8, width = 10)
|
||||||
|
@Schema(description = "사업 명")
|
||||||
|
private String performanceName;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "사업 수행 월", order = 9, width = 12)
|
||||||
|
@Schema(description = "사업 수행 월")
|
||||||
|
private String performanceStartMonth;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "사업 일정", order = 10, width = 10)
|
||||||
|
@Schema(description = "사업 일정")
|
||||||
|
private String performanceDtInfo;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "운영 시간", order = 11, width = 10)
|
||||||
|
@Schema(description = "운영 시간")
|
||||||
|
private String performanceTimeInfo;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "티켓 예약", order = 12, width = 10)
|
||||||
|
@Schema(description = "티켓 예약")
|
||||||
|
private String ticketReservationStatus;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "티켓 비고", order = 13, width = 10)
|
||||||
|
@Schema(description = "티켓 비고")
|
||||||
|
private String ticketReservationMemo;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "모니터링 일정", order = 14, width = 14)
|
||||||
|
@Schema(description = "모니터링 일정")
|
||||||
|
private String monitoringDate;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "모니터링 시간", order = 15, width = 14)
|
||||||
|
@Schema(description = "모니터링 시간")
|
||||||
|
private String monitoringTimeInfo;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "모니터링 필요여부", order = 16, width = 14)
|
||||||
|
@Schema(description = "모니터링 필요여부")
|
||||||
|
private String needMonitoring;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "서면평가 필요여부", order = 17, width = 14)
|
||||||
|
@Schema(description = "서면평가 필요여부")
|
||||||
|
private String needWrittenReview;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "교부여부", order = 18, width = 14)
|
||||||
|
@Schema(description = "교부여부")
|
||||||
|
private String checkDeliver;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "타임트리 확인일시", order = 19, width = 14)
|
||||||
|
@Schema(description = "타임트리 확인일시")
|
||||||
|
private String timeTreeCheckDt;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "모니터링 방문 장소", order = 20, width = 18)
|
||||||
|
@Schema(description = "모니터링 방문 장소")
|
||||||
|
private String monitoringAddress;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "메모", order = 21, width = 10)
|
||||||
|
@Schema(description = "메모")
|
||||||
|
private String performanceMemo;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "보고서 확인여부", order = 22, width = 10)
|
||||||
|
@Schema(description = "보고서 확인여부")
|
||||||
|
private String checkReport;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "요원 비용지급일", order = 23, width = 16)
|
||||||
|
@Schema(description = "요원 비용지급일")
|
||||||
|
private String monitoringPaymentDate;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "대표자 명", order = 24, width = 10)
|
||||||
|
@Schema(description = "대표자 명")
|
||||||
|
private String ownStaffName;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "대표자 연락처1", order = 25, width = 14)
|
||||||
|
@Schema(description = "대표자 연락처1")
|
||||||
|
private String ownStaffTel1;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "대표자 연락처2", order = 26, width = 14)
|
||||||
|
@Schema(description = "대표자 연락처2")
|
||||||
|
private String ownStaffTel2;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "대표자 이메일", order = 27, width = 14)
|
||||||
|
@Schema(description = "대표자 이메일")
|
||||||
|
private String ownStaffEmail;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "실무자 명", order = 28, width = 10)
|
||||||
|
@Schema(description = "실무자 명")
|
||||||
|
private String contactStaffName;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "실무자 연락처1", order = 29, width = 14)
|
||||||
|
@Schema(description = "실무자 연락처1")
|
||||||
|
private String contactStaffTel1;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "실무자 연락처2", order = 30, width = 14)
|
||||||
|
@Schema(description = "실무자 연락처2")
|
||||||
|
private String contactStaffTel2;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "실무자 이메일", order = 31, width = 14)
|
||||||
|
@Schema(description = "실무자 이메일")
|
||||||
|
private String contactStaffEmail;
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.kri.gwcf.review.back.dto.excel;
|
package com.kri.gwcf.review.back.dto.excel.user;
|
||||||
|
|
||||||
import com.kri.common.feature.excel.ExcelColumn;
|
import com.kri.common.feature.excel.ExcelColumn;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.kri.gwcf.review.back.dto.excel;
|
package com.kri.gwcf.review.back.dto.excel.user;
|
||||||
|
|
||||||
public interface UserUploadBaseDto {
|
public interface UserUploadBaseDto {
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.kri.gwcf.review.back.dto.excel.user;
|
||||||
|
|
||||||
|
import com.kri.common.feature.excel.ExcelColumn;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class WrittenUserAssignDto {
|
||||||
|
|
||||||
|
@ExcelColumn(header = "사용자 ID", order = 0, width = 11)
|
||||||
|
@Schema(description = "사용자 ID")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "사업 연번", order = 1, width = 10)
|
||||||
|
@Schema(description = "사업 연번")
|
||||||
|
private String performanceId;
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.kri.gwcf.review.back.dto.excel;
|
package com.kri.gwcf.review.back.dto.excel.user;
|
||||||
|
|
||||||
import com.kri.common.feature.excel.ExcelColumn;
|
import com.kri.common.feature.excel.ExcelColumn;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.kri.gwcf.review.back.dto.kon;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Schema(description = "KON 공연 신청 수")
|
||||||
|
public class PerformanceApplyCountDto {
|
||||||
|
|
||||||
|
@Schema(description = "공연 ID")
|
||||||
|
private String performanceId;
|
||||||
|
|
||||||
|
@Schema(description = "신청 수")
|
||||||
|
private Long applyCnt;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.kri.gwcf.review.back.dto.kon;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Schema(description = "KON 공연 신청 자")
|
||||||
|
public class PerformanceApplyUserDto {
|
||||||
|
|
||||||
|
@Schema(description = "공연 ID")
|
||||||
|
private String performanceId;
|
||||||
|
|
||||||
|
@Schema(description = "신청자 ID")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.kri.gwcf.review.back.dto.monitoring;
|
||||||
|
|
||||||
|
import com.kri.gwcf.review.back.dto.user.UserCompactDto;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Builder
|
||||||
|
@Schema(description = "모니터링 신청자")
|
||||||
|
public class MonitoringApplyUserDto {
|
||||||
|
|
||||||
|
@Schema(description = "공연 ID")
|
||||||
|
private Integer performanceId;
|
||||||
|
|
||||||
|
@Schema(description = "신청자 ID")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@Schema(description = "서비스 DB 사용자 정보")
|
||||||
|
private UserCompactDto user;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.kri.gwcf.review.back.dto.monitoring;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Map;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Schema(description = "모니터링 GPS 정보")
|
||||||
|
public class MonitoringGpsRequestDto {
|
||||||
|
|
||||||
|
@Schema(description = "GPS 위도")
|
||||||
|
private BigDecimal gpsLatitude;
|
||||||
|
|
||||||
|
@Schema(description = "GPS 경도")
|
||||||
|
private BigDecimal gpsLongitude;
|
||||||
|
|
||||||
|
@Schema(description = "GPS 신뢰 반경(m)")
|
||||||
|
private BigDecimal gpsAccuracyM;
|
||||||
|
|
||||||
|
@Schema(description = "GPS Raw Data")
|
||||||
|
private Map<String, Object> gpsRaw;
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ public class PerformanceAssignDto {
|
|||||||
private String assignUser;
|
private String assignUser;
|
||||||
|
|
||||||
@Schema(description = "사용자 컨펌 여부")
|
@Schema(description = "사용자 컨펌 여부")
|
||||||
private Boolean assignConfirm;
|
private Short assignStatus;
|
||||||
|
|
||||||
public static PerformanceAssignDto from(TPerformanceAssignEntity entity) {
|
public static PerformanceAssignDto from(TPerformanceAssignEntity entity) {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
@@ -45,7 +45,7 @@ public class PerformanceAssignDto {
|
|||||||
.assignType(entity.getAssignType())
|
.assignType(entity.getAssignType())
|
||||||
.assignOrder(entity.getAssignOrder())
|
.assignOrder(entity.getAssignOrder())
|
||||||
.assignUser(entity.getAssignUser())
|
.assignUser(entity.getAssignUser())
|
||||||
.assignConfirm(entity.getAssignConfirm())
|
.assignStatus(entity.getAssignStatus())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.kri.gwcf.review.back.dto.performance;
|
|||||||
|
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringVisitEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringVisitEntity;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -42,6 +43,12 @@ public class PerformanceMonitoringVisitDto {
|
|||||||
@Schema(description = "GPS Raw Data")
|
@Schema(description = "GPS Raw Data")
|
||||||
private Map<String, Object> gpsRaw;
|
private Map<String, Object> gpsRaw;
|
||||||
|
|
||||||
|
@Schema(description = "등록자")
|
||||||
|
private String regUser;
|
||||||
|
|
||||||
|
@Schema(description = "등록일시")
|
||||||
|
private LocalDateTime regDt;
|
||||||
|
|
||||||
public static PerformanceMonitoringVisitDto from(TPerformanceMonitoringVisitEntity entity) {
|
public static PerformanceMonitoringVisitDto from(TPerformanceMonitoringVisitEntity entity) {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -56,6 +63,8 @@ public class PerformanceMonitoringVisitDto {
|
|||||||
.gpsLongitude(entity.getGpsLongitude())
|
.gpsLongitude(entity.getGpsLongitude())
|
||||||
.gpsAccuracyM(entity.getGpsAccuracyM())
|
.gpsAccuracyM(entity.getGpsAccuracyM())
|
||||||
.gpsRaw(entity.getGpsRaw())
|
.gpsRaw(entity.getGpsRaw())
|
||||||
|
.regUser(entity.getRegUser())
|
||||||
|
.regDt(entity.getRegDt())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.kri.gwcf.review.back.dto.performance;
|
|||||||
|
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceReviewEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceReviewEntity;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -22,6 +23,12 @@ public class PerformanceReviewDto {
|
|||||||
@Schema(description = "평가 타입")
|
@Schema(description = "평가 타입")
|
||||||
private Integer reviewType;
|
private Integer reviewType;
|
||||||
|
|
||||||
|
@Schema(description = "등록 사용자")
|
||||||
|
private String regUser;
|
||||||
|
|
||||||
|
@Schema(description = "평가 일시")
|
||||||
|
private LocalDateTime reviewDt;
|
||||||
|
|
||||||
@Schema(description = "평가 상태")
|
@Schema(description = "평가 상태")
|
||||||
private Integer reviewStatus;
|
private Integer reviewStatus;
|
||||||
|
|
||||||
@@ -29,7 +36,7 @@ public class PerformanceReviewDto {
|
|||||||
private String uploadFileName;
|
private String uploadFileName;
|
||||||
|
|
||||||
@Schema(description = "pdf로 변환성공 여부")
|
@Schema(description = "pdf로 변환성공 여부")
|
||||||
private Boolean pdfConvert;
|
private Short pdfConvert;
|
||||||
|
|
||||||
@Schema(description = "pdf로 변환된 파일명")
|
@Schema(description = "pdf로 변환된 파일명")
|
||||||
private String pdfFileName;
|
private String pdfFileName;
|
||||||
@@ -39,9 +46,13 @@ public class PerformanceReviewDto {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocalDateTime reviewDt = entity.getModDt() != null ? entity.getModDt() : entity.getRegDt();
|
||||||
|
|
||||||
return PerformanceReviewDto.builder()
|
return PerformanceReviewDto.builder()
|
||||||
.performanceId(entity.getPerformanceId())
|
.performanceId(entity.getPerformanceId())
|
||||||
.reviewType(entity.getReviewType())
|
.reviewType(entity.getReviewType())
|
||||||
|
.regUser(entity.getRegUser())
|
||||||
|
.reviewDt(reviewDt)
|
||||||
.reviewStatus(entity.getReviewStatus())
|
.reviewStatus(entity.getReviewStatus())
|
||||||
.uploadFileName(entity.getUploadFileName())
|
.uploadFileName(entity.getUploadFileName())
|
||||||
.pdfConvert(entity.getPdfConvert())
|
.pdfConvert(entity.getPdfConvert())
|
||||||
|
|||||||
@@ -16,12 +16,14 @@ public class UploadContentDto {
|
|||||||
String fileName;
|
String fileName;
|
||||||
String fileType;
|
String fileType;
|
||||||
Long fileSize;
|
Long fileSize;
|
||||||
|
String uploadUserId;
|
||||||
|
|
||||||
public static UploadContentDto from(MultipartFile file){
|
public static UploadContentDto from(MultipartFile file, String uploadUserId){
|
||||||
return UploadContentDto.builder()
|
return UploadContentDto.builder()
|
||||||
.fileName(file.getOriginalFilename())
|
.fileName(file.getOriginalFilename())
|
||||||
.fileType(file.getContentType())
|
.fileType(file.getContentType())
|
||||||
.fileSize(file.getSize())
|
.fileSize(file.getSize())
|
||||||
|
.uploadUserId(uploadUserId)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.kri.gwcf.review.back.dto.user;
|
|||||||
|
|
||||||
import static com.kri.gwcf.review.back.common.util.MakeExtraFieldMap.toExtraFieldMap;
|
import static com.kri.gwcf.review.back.common.util.MakeExtraFieldMap.toExtraFieldMap;
|
||||||
|
|
||||||
import com.kri.gwcf.review.back.dto.excel.UserUploadBaseDto;
|
import com.kri.gwcf.review.back.dto.excel.user.UserUploadBaseDto;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TUserEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TUserEntity;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public class TPerformanceAssignEntity {
|
|||||||
private String assignUser;
|
private String assignUser;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Column(name = "is_assign_confirm", nullable = false)
|
@Column(name = "assign_status", nullable = false)
|
||||||
private Boolean assignConfirm;
|
private Short assignStatus;
|
||||||
|
|
||||||
@Size(max = 32)
|
@Size(max = 32)
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -67,7 +67,7 @@ public class TPerformanceAssignEntity {
|
|||||||
entity.setAssignType(dto.getAssignType());
|
entity.setAssignType(dto.getAssignType());
|
||||||
entity.setAssignOrder(dto.getAssignOrder());
|
entity.setAssignOrder(dto.getAssignOrder());
|
||||||
entity.setAssignUser(dto.getAssignUser());
|
entity.setAssignUser(dto.getAssignUser());
|
||||||
entity.setAssignConfirm(dto.getAssignConfirm());
|
entity.setAssignStatus(dto.getAssignStatus());
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ public class TPerformanceMonitoringScheduleEntity {
|
|||||||
@Column(name = "performance_id", nullable = false)
|
@Column(name = "performance_id", nullable = false)
|
||||||
private Integer performanceId;
|
private Integer performanceId;
|
||||||
|
|
||||||
@NotNull
|
@Column(name = "monitoring_date")
|
||||||
@Column(name = "monitoring_date", nullable = false)
|
|
||||||
private LocalDate monitoringDate;
|
private LocalDate monitoringDate;
|
||||||
|
|
||||||
@Size(max = 256)
|
@Size(max = 256)
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ public class TPerformanceMonitoringVisitEntity {
|
|||||||
entity.setGpsLongitude(dto.getGpsLongitude());
|
entity.setGpsLongitude(dto.getGpsLongitude());
|
||||||
entity.setGpsAccuracyM(dto.getGpsAccuracyM());
|
entity.setGpsAccuracyM(dto.getGpsAccuracyM());
|
||||||
entity.setGpsRaw(dto.getGpsRaw());
|
entity.setGpsRaw(dto.getGpsRaw());
|
||||||
|
entity.setRegUser(dto.getRegUser());
|
||||||
|
entity.setRegDt(dto.getRegDt());
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,24 +30,20 @@ public class TPerformanceReviewEntity {
|
|||||||
@Column(name = "review_status", nullable = false)
|
@Column(name = "review_status", nullable = false)
|
||||||
private Integer reviewStatus;
|
private Integer reviewStatus;
|
||||||
|
|
||||||
@Size(max = 512)
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Column(name = "upload_file_name", nullable = false, length = 512)
|
@Column(name = "upload_file_name", nullable = false, length = 512)
|
||||||
private String uploadFileName;
|
private String uploadFileName;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Column(name = "is_pdf_convert", nullable = false)
|
@Column(name = "is_pdf_convert", nullable = false)
|
||||||
private Boolean pdfConvert;
|
private Short pdfConvert;
|
||||||
|
|
||||||
@Size(max = 512)
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Column(name = "pdf_file_name", nullable = false, length = 512)
|
@Column(name = "pdf_file_name", nullable = false, length = 512)
|
||||||
private String pdfFileName;
|
private String pdfFileName;
|
||||||
|
|
||||||
@Size(max = 32)
|
@Column(name = "pdf_convert_dt", insertable = false)
|
||||||
@NotNull
|
private LocalDateTime pdfConvertDt;
|
||||||
@Column(name = "reg_user", nullable = false, length = 32, updatable = false)
|
|
||||||
private String regUser;
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ColumnDefault("CURRENT_TIMESTAMP")
|
@ColumnDefault("CURRENT_TIMESTAMP")
|
||||||
@@ -69,6 +65,17 @@ public class TPerformanceReviewEntity {
|
|||||||
return id.getReviewType();
|
return id.getReviewType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getRegUser() {
|
||||||
|
return id == null ? null : id.getRegUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegUser(String regUser) {
|
||||||
|
if (id == null) {
|
||||||
|
id = new TPerformanceReviewEntityId();
|
||||||
|
}
|
||||||
|
id.setRegUser(regUser);
|
||||||
|
}
|
||||||
|
|
||||||
public static TPerformanceReviewEntity from(PerformanceReviewDto dto) {
|
public static TPerformanceReviewEntity from(PerformanceReviewDto dto) {
|
||||||
if (dto == null) {
|
if (dto == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -78,6 +85,7 @@ public class TPerformanceReviewEntity {
|
|||||||
entity.setId(TPerformanceReviewEntityId.builder()
|
entity.setId(TPerformanceReviewEntityId.builder()
|
||||||
.performanceId(dto.getPerformanceId())
|
.performanceId(dto.getPerformanceId())
|
||||||
.reviewType(dto.getReviewType())
|
.reviewType(dto.getReviewType())
|
||||||
|
.regUser(dto.getRegUser())
|
||||||
.build());
|
.build());
|
||||||
entity.setReviewStatus(dto.getReviewStatus());
|
entity.setReviewStatus(dto.getReviewStatus());
|
||||||
entity.setUploadFileName(dto.getUploadFileName());
|
entity.setUploadFileName(dto.getUploadFileName());
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ public class TUserDetailEntity {
|
|||||||
.userDetailKey(userDetailKey)
|
.userDetailKey(userDetailKey)
|
||||||
.build())
|
.build())
|
||||||
.userDetailValue(userDetailValue)
|
.userDetailValue(userDetailValue)
|
||||||
|
.regUser(modUser)
|
||||||
|
.regDt(modDt)
|
||||||
.modUser(modUser)
|
.modUser(modUser)
|
||||||
.modDt(modDt)
|
.modDt(modDt)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.kri.gwcf.review.back.persistence.entity.id;
|
|||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Embeddable;
|
import jakarta.persistence.Embeddable;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
@@ -27,5 +28,8 @@ public class TPerformanceReviewEntityId implements Serializable {
|
|||||||
@Column(name = "review_type", nullable = false, updatable = false)
|
@Column(name = "review_type", nullable = false, updatable = false)
|
||||||
private Integer reviewType;
|
private Integer reviewType;
|
||||||
|
|
||||||
|
@Size(max = 32)
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "reg_user", nullable = false, length = 32, updatable = false)
|
||||||
|
private String regUser;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.kri.gwcf.review.back.persistence.mapper.kon;
|
||||||
|
|
||||||
|
import com.kri.gwcf.review.back.dto.kon.PerformanceApplyCountDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.kon.PerformanceApplyUserDto;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface KonMapper {
|
||||||
|
|
||||||
|
List<PerformanceApplyCountDto> findPerformanceApplyCount(
|
||||||
|
@Param("surveyType") String surveyType
|
||||||
|
);
|
||||||
|
|
||||||
|
List<PerformanceApplyUserDto> findPerformanceApplyUser(
|
||||||
|
@Param("surveyType") String surveyType,
|
||||||
|
@Param("performanceId") String performanceId
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.kri.gwcf.review.back.persistence.repository;
|
package com.kri.gwcf.review.back.persistence.repository;
|
||||||
|
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceAssignEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceAssignEntity;
|
||||||
|
import com.kri.gwcf.review.back.dto.assign.AssignUserCountDto;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
public interface PerformanceAssignRepository extends JpaRepository<TPerformanceAssignEntity, Long> {
|
public interface PerformanceAssignRepository extends JpaRepository<TPerformanceAssignEntity, Long> {
|
||||||
|
|
||||||
@@ -11,4 +13,42 @@ public interface PerformanceAssignRepository extends JpaRepository<TPerformanceA
|
|||||||
boolean existsByPerformanceId(Integer performanceId);
|
boolean existsByPerformanceId(Integer performanceId);
|
||||||
|
|
||||||
List<TPerformanceAssignEntity> findByPerformanceId(Integer performanceId);
|
List<TPerformanceAssignEntity> findByPerformanceId(Integer performanceId);
|
||||||
|
|
||||||
|
boolean existsByPerformanceIdAndAssignUser(Integer performanceId, String assignUser);
|
||||||
|
|
||||||
|
boolean existsByAssignUserAndPerformanceIdNot(String assignUser, Integer performanceId);
|
||||||
|
|
||||||
|
long countByPerformanceIdAndAssignType(Integer performanceId, Integer assignType);
|
||||||
|
|
||||||
|
long countByPerformanceIdAndAssignTypeAndAssignStatus(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer assignType,
|
||||||
|
Short assignStatus
|
||||||
|
);
|
||||||
|
|
||||||
|
List<TPerformanceAssignEntity> findByPerformanceIdAndAssignUser(
|
||||||
|
Integer performanceId,
|
||||||
|
String assignUser
|
||||||
|
);
|
||||||
|
|
||||||
|
List<TPerformanceAssignEntity> findByPerformanceIdAndAssignUserAndAssignType(
|
||||||
|
Integer performanceId,
|
||||||
|
String assignUser,
|
||||||
|
Integer assignType
|
||||||
|
);
|
||||||
|
|
||||||
|
List<TPerformanceAssignEntity> findByPerformanceIdAndAssignType(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer assignType
|
||||||
|
);
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
select new com.kri.gwcf.review.back.dto.assign.AssignUserCountDto(
|
||||||
|
assign.assignUser,
|
||||||
|
count(assign)
|
||||||
|
)
|
||||||
|
from TPerformanceAssignEntity assign
|
||||||
|
group by assign.assignUser
|
||||||
|
""")
|
||||||
|
List<AssignUserCountDto> countGroupByAssignUser();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,14 @@ public interface PerformanceMonitoringVisitRepository extends JpaRepository<TPer
|
|||||||
boolean existsByPerformanceId(Integer performanceId);
|
boolean existsByPerformanceId(Integer performanceId);
|
||||||
|
|
||||||
List<TPerformanceMonitoringVisitEntity> findByPerformanceId(Integer performanceId);
|
List<TPerformanceMonitoringVisitEntity> findByPerformanceId(Integer performanceId);
|
||||||
|
|
||||||
|
List<TPerformanceMonitoringVisitEntity> findByPerformanceIdAndRegUser(
|
||||||
|
Integer performanceId,
|
||||||
|
String regUser
|
||||||
|
);
|
||||||
|
|
||||||
|
void deleteByPerformanceIdAndRegUser(
|
||||||
|
Integer performanceId,
|
||||||
|
String regUser
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,33 @@ package com.kri.gwcf.review.back.persistence.repository;
|
|||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceReviewEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceReviewEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.id.TPerformanceReviewEntityId;
|
import com.kri.gwcf.review.back.persistence.entity.id.TPerformanceReviewEntityId;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface PerformanceReviewRepository extends JpaRepository<TPerformanceReviewEntity, TPerformanceReviewEntityId> {
|
public interface PerformanceReviewRepository extends JpaRepository<TPerformanceReviewEntity, TPerformanceReviewEntityId> {
|
||||||
|
|
||||||
boolean existsByRegUserOrModUser(String regUser, String modUser);
|
boolean existsByIdRegUserOrModUser(String regUser, String modUser);
|
||||||
|
|
||||||
boolean existsByIdPerformanceId(Integer performanceId);
|
boolean existsByIdPerformanceId(Integer performanceId);
|
||||||
|
|
||||||
List<TPerformanceReviewEntity> findByIdPerformanceId(Integer performanceId);
|
List<TPerformanceReviewEntity> findByIdPerformanceId(Integer performanceId);
|
||||||
|
|
||||||
|
Optional<TPerformanceReviewEntity> findByIdPerformanceIdAndIdReviewTypeAndIdRegUser(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer reviewType,
|
||||||
|
String regUser
|
||||||
|
);
|
||||||
|
|
||||||
|
Optional<TPerformanceReviewEntity> findByIdPerformanceIdAndIdReviewTypeAndIdRegUserAndReviewStatusIn(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer reviewType,
|
||||||
|
String regUser,
|
||||||
|
List<Integer> reviewStatuses
|
||||||
|
);
|
||||||
|
|
||||||
|
boolean existsByIdPerformanceIdAndIdReviewTypeAndIdRegUser(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer reviewType,
|
||||||
|
String regUser
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,63 @@
|
|||||||
package com.kri.gwcf.review.back.service;
|
package com.kri.gwcf.review.back.service;
|
||||||
|
|
||||||
|
import static com.kri.gwcf.review.back.common.consts.GwcfConstant.REJECT_ASSIGN_ORDER;
|
||||||
|
|
||||||
|
import com.kri.common.feature.excel.ExcelMapper;
|
||||||
|
import com.kri.common.feature.util.NumericUtil;
|
||||||
|
import com.kri.common.feature.util.StringUtil;
|
||||||
|
import com.kri.gwcf.review.back.common.util.ExcelUploadResultUtil;
|
||||||
|
import com.kri.gwcf.review.back.common.enums.AssignConfirmStatus;
|
||||||
|
import com.kri.gwcf.review.back.dto.assign.AssignUserCountDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.excel.ExcelErrorDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.excel.ExcelUploadResultDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.excel.user.WrittenUserAssignDto;
|
||||||
|
import com.kri.common.feature.web.BusinessException;
|
||||||
|
import com.kri.gwcf.review.back.dto.kon.PerformanceApplyCountDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.kon.PerformanceApplyUserDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.monitoring.MonitoringApplyUserDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceAssignDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceAssignDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.user.UserCompactDto;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceAssignEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TUserDetailEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TUserEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.mapper.kon.KonMapper;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceAssignRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceAssignRepository;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceRepository;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceReviewRepository;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.UserDetailRepository;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.UserRepository;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AssignService {
|
public class AssignService {
|
||||||
|
|
||||||
private final PerformanceAssignRepository performanceAssignRepository;
|
private final PerformanceAssignRepository performanceAssignRepository;
|
||||||
|
private final PerformanceReviewRepository performanceReviewRepository;
|
||||||
|
private final KonMapper konMapper;
|
||||||
|
private final PerformanceRepository performanceRepository;
|
||||||
|
private final UserRepository userRepository;
|
||||||
|
private final UserDetailRepository userDetailRepository;
|
||||||
|
|
||||||
|
@Value("${kon.survey-type:LIST}")
|
||||||
|
private String surveyType;
|
||||||
|
|
||||||
public boolean hasAssignWithUser(String userId) {
|
public boolean hasAssignWithUser(String userId) {
|
||||||
return performanceAssignRepository.existsByAssignUser(userId);
|
return performanceAssignRepository.existsByAssignUser(userId);
|
||||||
@@ -25,4 +72,443 @@ public class AssignService {
|
|||||||
.map(PerformanceAssignDto::from)
|
.map(PerformanceAssignDto::from)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AssignUserCountDto> findAssignUserCounts() {
|
||||||
|
return performanceAssignRepository.countGroupByAssignUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true, transactionManager = "konTransactionManager")
|
||||||
|
public List<PerformanceApplyUserDto> findKonPerformanceApplyUser(Integer performanceId) {
|
||||||
|
return konMapper.findPerformanceApplyUser(surveyType, String.valueOf(performanceId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PerformanceApplyCountDto> findMonitoringApplyUsersCount() {
|
||||||
|
return konMapper.findPerformanceApplyCount(surveyType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MonitoringApplyUserDto> findMonitoringApplyUsers(Integer performanceId) {
|
||||||
|
List<PerformanceApplyUserDto> applyUsers = findKonPerformanceApplyUser(performanceId);
|
||||||
|
if (applyUsers.isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> userIds = applyUsers.stream()
|
||||||
|
.map(PerformanceApplyUserDto::getUserId)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
Set<String> userIdSet = Set.copyOf(userIds);
|
||||||
|
|
||||||
|
Map<String, TUserEntity> userMap = userRepository.findAllById(userIds).stream()
|
||||||
|
.collect(Collectors.toMap(TUserEntity::getUserId, Function.identity()));
|
||||||
|
|
||||||
|
Map<String, Map<String, String>> userDetailMap = userDetailRepository.findAll().stream()
|
||||||
|
.filter(detail -> userIdSet.contains(detail.getUserId()))
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TUserDetailEntity::getUserId,
|
||||||
|
Collectors.toMap(
|
||||||
|
TUserDetailEntity::getUserDetailKey,
|
||||||
|
TUserDetailEntity::getUserDetailValue,
|
||||||
|
(left, right) -> right
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
return applyUsers.stream()
|
||||||
|
.map(applyUser -> {
|
||||||
|
TUserEntity user = userMap.get(applyUser.getUserId());
|
||||||
|
return MonitoringApplyUserDto.builder()
|
||||||
|
.performanceId(performanceId)
|
||||||
|
.userId(applyUser.getUserId())
|
||||||
|
.user(user == null
|
||||||
|
? null
|
||||||
|
: UserCompactDto.from(
|
||||||
|
user,
|
||||||
|
userDetailMap.getOrDefault(applyUser.getUserId(), Collections.emptyMap())
|
||||||
|
))
|
||||||
|
.build();
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public PerformanceAssignDto saveMonitoringAssign(
|
||||||
|
Integer performanceId,
|
||||||
|
String assignUser,
|
||||||
|
String regUser,
|
||||||
|
LocalDateTime regDt
|
||||||
|
) {
|
||||||
|
if (performanceAssignRepository.existsByAssignUser(assignUser)) {
|
||||||
|
throw BusinessException.conflict("ASSIGN_ALREADY_EXISTS", "이미 배정된 사용자입니다.")
|
||||||
|
.with("performanceId", performanceId)
|
||||||
|
.with("assignUser", assignUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
long currentCount = performanceAssignRepository.countByPerformanceIdAndAssignType(performanceId, 1);
|
||||||
|
TPerformanceAssignEntity entity = new TPerformanceAssignEntity();
|
||||||
|
entity.setPerformanceId(performanceId);
|
||||||
|
entity.setAssignType(1);
|
||||||
|
entity.setAssignOrder((short) (currentCount + 1));
|
||||||
|
entity.setAssignUser(assignUser);
|
||||||
|
entity.setAssignStatus(AssignConfirmStatus.REQUESTED.getCode());
|
||||||
|
entity.setRegUser(regUser);
|
||||||
|
entity.setRegDt(regDt);
|
||||||
|
|
||||||
|
return PerformanceAssignDto.from(performanceAssignRepository.save(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public List<PerformanceAssignDto> saveMonitoringAssign(
|
||||||
|
Integer performanceId,
|
||||||
|
List<String> assignUsers,
|
||||||
|
String regUser,
|
||||||
|
LocalDateTime regDt
|
||||||
|
) {
|
||||||
|
if (performanceId == null) {
|
||||||
|
throw BusinessException.badRequest("EMPTY_PERFORMANCE_ID", "공연 ID가 없습니다.");
|
||||||
|
}
|
||||||
|
if (!performanceRepository.existsById(performanceId)) {
|
||||||
|
throw BusinessException.notFound("PERFORMANCE_NOT_FOUND", "존재하지 않는 공연입니다.")
|
||||||
|
.with("performanceId", performanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> normalizedAssignUsers = normalizeUserIds(assignUsers);
|
||||||
|
if (normalizedAssignUsers.size() > 2) {
|
||||||
|
throw BusinessException.badRequest("MONITORING_ASSIGN_LIMIT", "모니터링 요원은 최대 2명까지 배정할 수 있습니다.")
|
||||||
|
.with("performanceId", performanceId)
|
||||||
|
.with("assignUsers", normalizedAssignUsers);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String assignUser : normalizedAssignUsers) {
|
||||||
|
validateAssignableUser(performanceId, assignUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TPerformanceAssignEntity> currentAssigns =
|
||||||
|
performanceAssignRepository.findByPerformanceIdAndAssignType(performanceId, 1);
|
||||||
|
Set<String> requestedUserSet = Set.copyOf(normalizedAssignUsers);
|
||||||
|
List<TPerformanceAssignEntity> deleteTargets = currentAssigns.stream()
|
||||||
|
.filter(assign -> {
|
||||||
|
boolean requested = requestedUserSet.contains(assign.getAssignUser());
|
||||||
|
boolean rejected = AssignConfirmStatus.REJECTED.getCode().equals(assign.getAssignStatus());
|
||||||
|
return (requested && rejected) || (!requested && !rejected);
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
for (TPerformanceAssignEntity deleteTarget : deleteTargets) {
|
||||||
|
validateNoReviewBeforeAssignRemove(deleteTarget);
|
||||||
|
}
|
||||||
|
performanceAssignRepository.deleteAll(deleteTargets);
|
||||||
|
|
||||||
|
Set<String> currentUserSet = currentAssigns.stream()
|
||||||
|
.filter(assign -> requestedUserSet.contains(assign.getAssignUser()))
|
||||||
|
.filter(assign -> !AssignConfirmStatus.REJECTED.getCode().equals(assign.getAssignStatus()))
|
||||||
|
.map(TPerformanceAssignEntity::getAssignUser)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Set<Short> usedAssignOrders = currentAssigns.stream()
|
||||||
|
.filter(assign -> requestedUserSet.contains(assign.getAssignUser()))
|
||||||
|
.filter(assign -> !AssignConfirmStatus.REJECTED.getCode().equals(assign.getAssignStatus()))
|
||||||
|
.map(TPerformanceAssignEntity::getAssignOrder)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
for (String assignUser : normalizedAssignUsers) {
|
||||||
|
if (!currentUserSet.contains(assignUser)) {
|
||||||
|
short assignOrder = findAvailableAssignOrder(usedAssignOrders);
|
||||||
|
TPerformanceAssignEntity entity = new TPerformanceAssignEntity();
|
||||||
|
entity.setPerformanceId(performanceId);
|
||||||
|
entity.setAssignType(1);
|
||||||
|
entity.setAssignOrder(assignOrder);
|
||||||
|
entity.setAssignUser(assignUser);
|
||||||
|
entity.setAssignStatus(AssignConfirmStatus.REQUESTED.getCode());
|
||||||
|
entity.setRegUser(regUser);
|
||||||
|
entity.setRegDt(regDt);
|
||||||
|
performanceAssignRepository.save(entity);
|
||||||
|
usedAssignOrders.add(assignOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return performanceAssignRepository.findByPerformanceIdAndAssignType(performanceId, 1).stream()
|
||||||
|
.map(PerformanceAssignDto::from)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] exportAssignTemplate() {
|
||||||
|
try (Workbook workbook =
|
||||||
|
ExcelMapper.writeToWorkbook(Collections.emptyList(), WrittenUserAssignDto.class);
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||||
|
workbook.write(out);
|
||||||
|
return out.toByteArray();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw BusinessException.internalError("사용자 배정 템플릿 엑셀 생성 중 오류");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ExcelUploadResultDto createWrittenAssignsFromExcel(
|
||||||
|
MultipartFile file,
|
||||||
|
String regUser,
|
||||||
|
LocalDateTime regDt
|
||||||
|
) {
|
||||||
|
if (file == null || file.isEmpty()) {
|
||||||
|
throw BusinessException.badRequest("EMPTY_FILE", "업로드된 파일이 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
String fileName = file.getOriginalFilename();
|
||||||
|
String errorFileName = fileName != null && fileName.endsWith(".xlsx")
|
||||||
|
? fileName.substring(0, fileName.length() - 5) + "_error.xlsx"
|
||||||
|
: fileName + "_error.xlsx";
|
||||||
|
|
||||||
|
List<WrittenUserAssignDto> rows;
|
||||||
|
try (Workbook workbook = WorkbookFactory.create(file.getInputStream())) {
|
||||||
|
rows = ExcelMapper.readFromWorkbook(workbook, WrittenUserAssignDto.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw BusinessException.badRequest("INVALID_EXCEL", "엑셀 파일을 읽는 중 오류가 발생했습니다.")
|
||||||
|
.with("fileName", fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalCount = rows.size();
|
||||||
|
int successCount = 0;
|
||||||
|
List<ExcelErrorDto> errorList = new ArrayList<>();
|
||||||
|
Set<Integer> uploadedPerformanceIds = new java.util.HashSet<>();
|
||||||
|
Set<Integer> existingPerformanceIds = performanceRepository.findAll().stream()
|
||||||
|
.map(TPerformanceEntity::getId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Set<String> existingUserIds = userRepository.findAll().stream()
|
||||||
|
.map(TUserEntity::getUserId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Map<Integer, List<TPerformanceAssignEntity>> currentWrittenAssignMap =
|
||||||
|
performanceAssignRepository.findAll().stream()
|
||||||
|
.filter(assign -> Objects.equals(assign.getAssignType(), 2))
|
||||||
|
.collect(Collectors.groupingBy(TPerformanceAssignEntity::getPerformanceId));
|
||||||
|
Set<String> reviewedAssignKeys = performanceReviewRepository.findAll().stream()
|
||||||
|
.map(review -> reviewKey(review.getPerformanceId(), review.getReviewType(), review.getRegUser()))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
for (int i = 0; i < rows.size(); i++) {
|
||||||
|
WrittenUserAssignDto row = rows.get(i);
|
||||||
|
int rowNumber = i + 2;
|
||||||
|
|
||||||
|
List<ExcelErrorDto> rowErrors = validateWrittenAssignRow(
|
||||||
|
row,
|
||||||
|
rowNumber,
|
||||||
|
existingPerformanceIds,
|
||||||
|
existingUserIds
|
||||||
|
);
|
||||||
|
if (!rowErrors.isEmpty()) {
|
||||||
|
errorList.addAll(rowErrors);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
||||||
|
if (performanceId == null) {
|
||||||
|
errorList.add(ExcelErrorDto.of(rowNumber, "사업 연번", "사업 연번은 숫자로 입력해야 합니다."));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (performanceId % 100 != 1) {
|
||||||
|
errorList.add(ExcelErrorDto.of(rowNumber, "사업 연번", "사업 연번의 끝은 01로 끝나야 합니다."));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!uploadedPerformanceIds.add(performanceId)) {
|
||||||
|
errorList.add(ExcelErrorDto.of(rowNumber, "사업 연번", "하나의 사업에는 서면평가위원을 1명만 배정할 수 있습니다."));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TPerformanceAssignEntity> currentAssigns =
|
||||||
|
currentWrittenAssignMap.getOrDefault(performanceId, Collections.emptyList());
|
||||||
|
boolean sameAssignExists = currentAssigns.size() == 1
|
||||||
|
&& Objects.equals(currentAssigns.get(0).getAssignUser(), row.getUserId());
|
||||||
|
if (!sameAssignExists && currentAssigns.stream()
|
||||||
|
.anyMatch(assign -> reviewedAssignKeys.contains(reviewKey(assign)))) {
|
||||||
|
errorList.add(ExcelErrorDto.of(rowNumber, "사업 연번", "리뷰가 있는 배정은 변경할 수 없습니다."));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sameAssignExists) {
|
||||||
|
successCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
performanceAssignRepository.deleteAll(currentAssigns);
|
||||||
|
|
||||||
|
TPerformanceAssignEntity entity = new TPerformanceAssignEntity();
|
||||||
|
entity.setPerformanceId(performanceId);
|
||||||
|
entity.setAssignType(2);
|
||||||
|
entity.setAssignOrder((short) 1);
|
||||||
|
entity.setAssignUser(row.getUserId());
|
||||||
|
entity.setAssignStatus(AssignConfirmStatus.CONFIRMED.getCode());
|
||||||
|
entity.setRegUser(regUser);
|
||||||
|
entity.setRegDt(regDt);
|
||||||
|
performanceAssignRepository.save(entity);
|
||||||
|
successCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int failCount = errorList.stream()
|
||||||
|
.map(ExcelErrorDto::getRowNumber)
|
||||||
|
.distinct()
|
||||||
|
.toList()
|
||||||
|
.size();
|
||||||
|
|
||||||
|
return ExcelUploadResultUtil.buildUploadResult(
|
||||||
|
totalCount,
|
||||||
|
successCount,
|
||||||
|
failCount,
|
||||||
|
errorList,
|
||||||
|
ExcelErrorDto.class,
|
||||||
|
errorFileName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ExcelErrorDto> validateWrittenAssignRow(
|
||||||
|
WrittenUserAssignDto row,
|
||||||
|
int rowNumber,
|
||||||
|
Set<Integer> existingPerformanceIds,
|
||||||
|
Set<String> existingUserIds
|
||||||
|
) {
|
||||||
|
List<ExcelErrorDto> errors = new ArrayList<>();
|
||||||
|
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
||||||
|
String userId = row.getUserId();
|
||||||
|
|
||||||
|
if (performanceId == null) {
|
||||||
|
errors.add(ExcelErrorDto.of(rowNumber, "사업 연번", "사업 연번은 숫자여야 합니다."));
|
||||||
|
} else if (!existingPerformanceIds.contains(performanceId)) {
|
||||||
|
errors.add(ExcelErrorDto.of(rowNumber, "사업 연번", "존재하지 않는 사업 연번입니다."));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtil.isNullOrBlank(userId)) {
|
||||||
|
errors.add(ExcelErrorDto.of(rowNumber, "사용자 ID", "사용자 ID가 비어 있습니다."));
|
||||||
|
} else if (!existingUserIds.contains(userId)) {
|
||||||
|
errors.add(ExcelErrorDto.of(rowNumber, "사용자 ID", "존재하지 않는 사용자 ID입니다."));
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> normalizeUserIds(List<String> userIds) {
|
||||||
|
if (userIds == null) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
return userIds.stream()
|
||||||
|
.filter(StringUtil::hasText)
|
||||||
|
.map(String::trim)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private short findAvailableAssignOrder(Set<Short> usedAssignOrders) {
|
||||||
|
short assignOrder = 1;
|
||||||
|
while (usedAssignOrders.contains(assignOrder)) {
|
||||||
|
assignOrder++;
|
||||||
|
}
|
||||||
|
return assignOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateAssignableUser(Integer performanceId, String userId) {
|
||||||
|
if (StringUtil.isNullOrBlank(userId)) {
|
||||||
|
throw BusinessException.badRequest("EMPTY_USER_ID", "사용자 ID가 없습니다.");
|
||||||
|
}
|
||||||
|
if (!userRepository.existsByUserId(userId)) {
|
||||||
|
throw BusinessException.notFound("USER_NOT_FOUND", "존재하지 않는 사용자 ID입니다.")
|
||||||
|
.with("userId", userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasReview(TPerformanceAssignEntity assign) {
|
||||||
|
return performanceReviewRepository.existsByIdPerformanceIdAndIdReviewTypeAndIdRegUser(
|
||||||
|
assign.getPerformanceId(),
|
||||||
|
assign.getAssignType(),
|
||||||
|
assign.getAssignUser()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String reviewKey(TPerformanceAssignEntity assign) {
|
||||||
|
return reviewKey(assign.getPerformanceId(), assign.getAssignType(), assign.getAssignUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
private String reviewKey(Integer performanceId, Integer reviewType, String regUser) {
|
||||||
|
return performanceId + "|" + reviewType + "|" + regUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateNoReviewBeforeAssignRemove(TPerformanceAssignEntity assign) {
|
||||||
|
if (hasReview(assign)) {
|
||||||
|
throw BusinessException.conflict("ASSIGN_HAS_REVIEW", "리뷰가 있는 배정은 해제하거나 삭제할 수 없습니다.")
|
||||||
|
.with("performanceId", assign.getPerformanceId())
|
||||||
|
.with("assignType", assign.getAssignType())
|
||||||
|
.with("assignUser", assign.getAssignUser());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public String confirmMonitoringAssignByUser(Integer performanceId, String assignUser, boolean confirm) {
|
||||||
|
String assignText = confirm ? "승인" : "거절";
|
||||||
|
AssignConfirmStatus assignStatus = confirm ? AssignConfirmStatus.CONFIRMED : AssignConfirmStatus.REJECTED;
|
||||||
|
|
||||||
|
List<TPerformanceAssignEntity> assigns =
|
||||||
|
performanceAssignRepository.findByPerformanceIdAndAssignUserAndAssignType(
|
||||||
|
performanceId,
|
||||||
|
assignUser,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
boolean hasRequested = assigns.stream()
|
||||||
|
.anyMatch(assign -> AssignConfirmStatus.REQUESTED.getCode().equals(assign.getAssignStatus()));
|
||||||
|
if (!hasRequested) {
|
||||||
|
return assignText + " 가능한 내용이 없습니다.";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(confirm){
|
||||||
|
long confirmedCount = performanceAssignRepository
|
||||||
|
.countByPerformanceIdAndAssignTypeAndAssignStatus(
|
||||||
|
performanceId,
|
||||||
|
1,
|
||||||
|
AssignConfirmStatus.CONFIRMED.getCode()
|
||||||
|
);
|
||||||
|
if (confirmedCount >= 2) {
|
||||||
|
return "이미 배정이 종료된 공연입니다.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assigns.stream()
|
||||||
|
.filter(assign -> AssignConfirmStatus.REQUESTED.getCode().equals(assign.getAssignStatus()))
|
||||||
|
.forEach(assign -> {
|
||||||
|
assign.setAssignStatus(assignStatus.getCode());
|
||||||
|
if(!confirm) {
|
||||||
|
assign.setAssignOrder(REJECT_ASSIGN_ORDER);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return assignText + " 처리 됐습니다.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void confirmAssign(Integer performanceId, String assignUser, boolean confirm) {
|
||||||
|
List<TPerformanceAssignEntity> assigns =
|
||||||
|
performanceAssignRepository.findByPerformanceIdAndAssignUser(performanceId, assignUser);
|
||||||
|
if (assigns.isEmpty()) {
|
||||||
|
throw BusinessException.notFound("ASSIGN_NOT_FOUND", "배정 정보를 찾을 수 없습니다.")
|
||||||
|
.with("performanceId", performanceId)
|
||||||
|
.with("assignUser", assignUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TPerformanceAssignEntity assign : assigns) {
|
||||||
|
if (!confirm && hasReview(assign)) {
|
||||||
|
throw BusinessException.conflict("ASSIGN_HAS_REVIEW", "리뷰가 있는 배정은 해제하거나 삭제할 수 없습니다.")
|
||||||
|
.with("performanceId", performanceId)
|
||||||
|
.with("assignType", assign.getAssignType())
|
||||||
|
.with("assignUser", assignUser);
|
||||||
|
}
|
||||||
|
if (confirm && !AssignConfirmStatus.CONFIRMED.getCode().equals(assign.getAssignStatus())) {
|
||||||
|
long confirmedCount = performanceAssignRepository
|
||||||
|
.countByPerformanceIdAndAssignTypeAndAssignStatus(
|
||||||
|
performanceId,
|
||||||
|
assign.getAssignType(),
|
||||||
|
AssignConfirmStatus.CONFIRMED.getCode()
|
||||||
|
);
|
||||||
|
if (assign.getAssignType() == 1 && confirmedCount >= 2) {
|
||||||
|
throw BusinessException.conflict("MONITORING_ASSIGN_CONFIRM_LIMIT", "확정된 모니터링 요원은 최대 2명입니다.")
|
||||||
|
.with("performanceId", performanceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assign.setAssignStatus(confirm
|
||||||
|
? AssignConfirmStatus.CONFIRMED.getCode()
|
||||||
|
: AssignConfirmStatus.REQUESTED.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,31 +13,48 @@ import com.kri.gwcf.review.back.common.util.TelUtil;
|
|||||||
import com.kri.gwcf.review.back.dto.common.CodeDto;
|
import com.kri.gwcf.review.back.dto.common.CodeDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.ExcelErrorDto;
|
import com.kri.gwcf.review.back.dto.excel.ExcelErrorDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.ExcelUploadResultDto;
|
import com.kri.gwcf.review.back.dto.excel.ExcelUploadResultDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.PerformanceUploadDto;
|
import com.kri.gwcf.review.back.dto.excel.performance.PerformanceDownloadDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.excel.performance.PerformanceUploadDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.kon.PerformanceApplyCountDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceCompactDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceCompactDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.performance.PerformanceAssignDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceFullDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceFullDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceMonitoringScheduleDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceMonitoringScheduleDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.performance.PerformanceMonitoringVisitDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.performance.PerformanceReviewDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceStaffDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceStaffDto;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceAssignEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceDetailEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceDetailEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringScheduleEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringScheduleEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringVisitEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceReviewEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceStaffEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceStaffEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.mapper.kon.KonMapper;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceAssignRepository;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceDetailRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceDetailRepository;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceMonitoringScheduleRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceMonitoringScheduleRepository;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceMonitoringVisitRepository;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceRepository;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceReviewRepository;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceStaffRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceStaffRepository;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -46,29 +63,53 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PerformanceService {
|
public class PerformanceService {
|
||||||
|
|
||||||
|
private static final DateTimeFormatter EXCEL_DT_FORMATTER =
|
||||||
|
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
private final KonMapper konMapper;
|
||||||
private final PerformanceRepository performanceRepository;
|
private final PerformanceRepository performanceRepository;
|
||||||
private final PerformanceDetailRepository performanceDetailRepository;
|
private final PerformanceDetailRepository performanceDetailRepository;
|
||||||
private final PerformanceStaffRepository performanceStaffRepository;
|
private final PerformanceStaffRepository performanceStaffRepository;
|
||||||
private final PerformanceMonitoringScheduleRepository performanceMonitoringScheduleRepository;
|
private final PerformanceMonitoringScheduleRepository performanceMonitoringScheduleRepository;
|
||||||
|
private final PerformanceAssignRepository performanceAssignRepository;
|
||||||
|
private final PerformanceMonitoringVisitRepository performanceMonitoringVisitRepository;
|
||||||
|
private final PerformanceReviewRepository performanceReviewRepository;
|
||||||
private final CodeService codeService;
|
private final CodeService codeService;
|
||||||
private final AssignService assignService;
|
private final AssignService assignService;
|
||||||
private final ReviewService reviewService;
|
private final ReviewService reviewService;
|
||||||
private final VisitService visitService;
|
private final VisitService visitService;
|
||||||
|
|
||||||
|
@Value("${kon.survey-type:LIST}")
|
||||||
|
private String surveyType;
|
||||||
|
|
||||||
public PerformanceFullDto getPerformance(Integer performanceId) {
|
public PerformanceFullDto getPerformance(Integer performanceId) {
|
||||||
TPerformanceEntity performance = getPerformanceEntity(performanceId);
|
TPerformanceEntity performance = getPerformanceEntity(performanceId);
|
||||||
return toFullDto(performance);
|
return toFullDto(performance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PerformanceFullDto> getPerformanceList() {
|
public List<PerformanceFullDto> getPerformanceList() {
|
||||||
return performanceRepository.findAll().stream()
|
List<TPerformanceEntity> performances = performanceRepository.findAll();
|
||||||
.map(this::toFullDto)
|
PerformanceFullLookup lookup = buildPerformanceFullLookup();
|
||||||
|
|
||||||
|
return performances.stream()
|
||||||
|
.map(performance -> toFullDto(performance, lookup))
|
||||||
|
.sorted(Comparator.comparing(
|
||||||
|
this::getPerformanceNoForSort,
|
||||||
|
Comparator.nullsLast(Integer::compareTo)
|
||||||
|
))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PerformanceCompactDto> getPerformanceCompactList() {
|
public List<PerformanceCompactDto> getPerformanceCompactList() {
|
||||||
return performanceRepository.findAll().stream()
|
List<TPerformanceEntity> performances = performanceRepository.findAll();
|
||||||
.map(this::toCompactDto)
|
PerformanceCompactLookup lookup = buildPerformanceCompactLookup();
|
||||||
|
|
||||||
|
return performances.stream()
|
||||||
|
.map(performance -> toCompactDto(performance, lookup))
|
||||||
|
.sorted(Comparator.comparing(
|
||||||
|
this::getPerformanceNoForSort,
|
||||||
|
Comparator.nullsLast(Integer::compareTo)
|
||||||
|
))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +145,9 @@ public class PerformanceService {
|
|||||||
int totalCount = rows.size();
|
int totalCount = rows.size();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
List<ExcelErrorDto> errorList = new ArrayList<>();
|
List<ExcelErrorDto> errorList = new ArrayList<>();
|
||||||
|
Set<Integer> existingPerformanceIds = performanceRepository.findAll().stream()
|
||||||
|
.map(TPerformanceEntity::getId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
for (int i = 0; i < rows.size(); i++) {
|
for (int i = 0; i < rows.size(); i++) {
|
||||||
PerformanceUploadDto row = rows.get(i);
|
PerformanceUploadDto row = rows.get(i);
|
||||||
@@ -115,7 +159,8 @@ public class PerformanceService {
|
|||||||
businessTypeList,
|
businessTypeList,
|
||||||
genreList,
|
genreList,
|
||||||
areaList,
|
areaList,
|
||||||
ticketReservationStatusList
|
ticketReservationStatusList,
|
||||||
|
existingPerformanceIds
|
||||||
);
|
);
|
||||||
if (!rowErrors.isEmpty()) {
|
if (!rowErrors.isEmpty()) {
|
||||||
errorList.addAll(rowErrors);
|
errorList.addAll(rowErrors);
|
||||||
@@ -124,6 +169,7 @@ public class PerformanceService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
createPerformanceInternal(row, regUser, regDt);
|
createPerformanceInternal(row, regUser, regDt);
|
||||||
|
existingPerformanceIds.add(NumericUtil.parseOnlyInteger(row.getPerformanceId()));
|
||||||
successCount++;
|
successCount++;
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
errorList.add(ExcelErrorDto.of(rowNumber, "SYSTEM", e.getMessage()));
|
errorList.add(ExcelErrorDto.of(rowNumber, "SYSTEM", e.getMessage()));
|
||||||
@@ -200,6 +246,224 @@ public class PerformanceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] exportPerformance(String[] performanceIds) {
|
||||||
|
Map<String, String> updateNoticeTargetLabels = codeService
|
||||||
|
.findByCodeGroup("update_notice_target").stream()
|
||||||
|
.collect(toMap(code -> code.getCodeValue().toString(), CodeDto::getCodeLabel));
|
||||||
|
Set<String> selectedPerformanceIds = performanceIds == null
|
||||||
|
? Collections.emptySet()
|
||||||
|
: Arrays.stream(performanceIds).collect(Collectors.toSet());
|
||||||
|
List<PerformanceDownloadDto> performanceList = getPerformanceList().stream()
|
||||||
|
.filter(performance -> selectedPerformanceIds.contains(String.valueOf(performance.getId())))
|
||||||
|
.map(performance -> toPerformanceDownloadRow(performance, updateNoticeTargetLabels))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
List<CodeDto> businessTypeList = codeService.findByCodeGroup("business_type");
|
||||||
|
List<CodeDto> genreList = codeService.findByCodeGroup("genre");
|
||||||
|
List<CodeDto> areaList = codeService.findByCodeGroup("area");
|
||||||
|
List<CodeDto> ticketReservationStatusList =
|
||||||
|
codeService.findByCodeGroup("ticket_reservation_status");
|
||||||
|
List<CodeDto> reviewStatusList = codeService.findByCodeGroup("review_status");
|
||||||
|
|
||||||
|
try (Workbook workbook =
|
||||||
|
ExcelMapper.writeToWorkbook(performanceList, PerformanceDownloadDto.class);
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||||
|
|
||||||
|
appendCodeSheet(workbook, businessTypeList, "사업유형");
|
||||||
|
appendCodeSheet(workbook, genreList, "장르");
|
||||||
|
appendCodeSheet(workbook, areaList, "지역");
|
||||||
|
appendCodeSheet(workbook, ticketReservationStatusList, "티켓 예약");
|
||||||
|
appendCodeSheet(workbook, reviewStatusList, "평가 상태");
|
||||||
|
|
||||||
|
workbook.write(out);
|
||||||
|
return out.toByteArray();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw BusinessException.internalError("공연 엑셀 생성 중 오류");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PerformanceDownloadDto toPerformanceDownloadRow(
|
||||||
|
PerformanceFullDto performance,
|
||||||
|
Map<String, String> updateNoticeTargetLabels
|
||||||
|
) {
|
||||||
|
Map<String, String> detail = performance.getPerformanceDetail() == null
|
||||||
|
? Collections.emptyMap()
|
||||||
|
: performance.getPerformanceDetail();
|
||||||
|
PerformanceMonitoringScheduleDto schedule = performance.getPerformanceMonitoringSchedule();
|
||||||
|
PerformanceStaffDto ownStaff = findStaff(performance, 1);
|
||||||
|
PerformanceStaffDto contactStaff = findStaff(performance, 2);
|
||||||
|
PerformanceAssignDto monitoringAssign1 = findAssign(performance, 1, (short) 1);
|
||||||
|
PerformanceAssignDto monitoringAssign2 = findAssign(performance, 1, (short) 2);
|
||||||
|
PerformanceAssignDto writtenAssign = findFirstAssign(performance, 2);
|
||||||
|
|
||||||
|
PerformanceReviewDto localReview = findFirstReview(performance, 3);
|
||||||
|
PerformanceReviewDto monitoringReview1 = findReview(
|
||||||
|
performance,
|
||||||
|
1,
|
||||||
|
monitoringAssign1 == null ? null : monitoringAssign1.getAssignUser()
|
||||||
|
);
|
||||||
|
PerformanceReviewDto monitoringReview2 = findReview(
|
||||||
|
performance,
|
||||||
|
1,
|
||||||
|
monitoringAssign2 == null ? null : monitoringAssign2.getAssignUser()
|
||||||
|
);
|
||||||
|
PerformanceReviewDto writtenReview = findReview(
|
||||||
|
performance,
|
||||||
|
2,
|
||||||
|
writtenAssign == null ? null : writtenAssign.getAssignUser()
|
||||||
|
);
|
||||||
|
|
||||||
|
return PerformanceDownloadDto.builder()
|
||||||
|
.ncas(detail.get("NCAS"))
|
||||||
|
.updateNoticeTarget(updateNoticeTargetLabels.getOrDefault(
|
||||||
|
detail.get("UpdateNoticeTarget"),
|
||||||
|
detail.get("UpdateNoticeTarget")))
|
||||||
|
.updateNoticeMemo(detail.get("UpdateNoticeMemo"))
|
||||||
|
.updateNoticeDt(formatUpdateNoticeDt(detail.get("UpdateNoticeDt")))
|
||||||
|
.performanceId(toStringValue(performance.getId()))
|
||||||
|
.businessType(toStringValue(performance.getBusinessType()))
|
||||||
|
.genre(toStringValue(performance.getPerformanceGenre()))
|
||||||
|
.performanceArea(toStringValue(performance.getPerformanceArea()))
|
||||||
|
.artistName(performance.getArtistName())
|
||||||
|
.performanceName(performance.getPerformanceName())
|
||||||
|
.performanceStartMonth(toStringValue(performance.getPerformanceStartMonth()))
|
||||||
|
.performanceDtInfo(performance.getPerformanceDtInfo())
|
||||||
|
.performanceTimeInfo(performance.getPerformanceTimeInfo())
|
||||||
|
.ticketReservationStatus(toStringValue(performance.getTicketReservationStatus()))
|
||||||
|
.ticketReservationMemo(performance.getTicketReservationMemo())
|
||||||
|
.monitoringDate(schedule == null ? null : toStringValue(schedule.getMonitoringDate()))
|
||||||
|
.monitoringTimeInfo(schedule == null ? null : schedule.getMonitoringTimeInfo())
|
||||||
|
.monitoringAddress(schedule == null ? null : schedule.getMonitoringAddress())
|
||||||
|
.ownStaffName(ownStaff == null ? null : ownStaff.getStaffName())
|
||||||
|
.ownStaffTel1(ownStaff == null ? null : ownStaff.getStaffTel1())
|
||||||
|
.ownStaffTel2(ownStaff == null ? null : ownStaff.getStaffTel2())
|
||||||
|
.ownStaffEmail(ownStaff == null ? null : ownStaff.getStaffEmail())
|
||||||
|
.contactStaffName(contactStaff == null ? null : contactStaff.getStaffName())
|
||||||
|
.contactStaffTel1(contactStaff == null ? null : contactStaff.getStaffTel1())
|
||||||
|
.contactStaffTel2(contactStaff == null ? null : contactStaff.getStaffTel2())
|
||||||
|
.contactStaffEmail(contactStaff == null ? null : contactStaff.getStaffEmail())
|
||||||
|
.performanceMemo(performance.getPerformanceMemo())
|
||||||
|
.monitoringPaymentDate(detail.get("monitoringPaymentDate"))
|
||||||
|
.localReviewUser(localReview == null ? null : localReview.getRegUser())
|
||||||
|
.localReviewStatus(localReview == null ? null : toStringValue(localReview.getReviewStatus()))
|
||||||
|
.localReviewDt(formatReviewDt(localReview))
|
||||||
|
.monitoringReviewUser1(monitoringAssign1 == null ? null : monitoringAssign1.getAssignUser())
|
||||||
|
.monitoringReviewStatus1(monitoringReview1 == null ? null : toStringValue(monitoringReview1.getReviewStatus()))
|
||||||
|
.monitoringReviewDt1(formatReviewDt(monitoringReview1))
|
||||||
|
.monitoringReviewUser2(monitoringAssign2 == null ? null : monitoringAssign2.getAssignUser())
|
||||||
|
.monitoringReviewStatus2(monitoringReview2 == null ? null : toStringValue(monitoringReview2.getReviewStatus()))
|
||||||
|
.monitoringReviewDt2(formatReviewDt(monitoringReview2))
|
||||||
|
.writtenReviewUser(writtenAssign == null ? null : writtenAssign.getAssignUser())
|
||||||
|
.writtenReviewStatus(writtenReview == null ? null : toStringValue(writtenReview.getReviewStatus()))
|
||||||
|
.writtenReviewDt(formatReviewDt(writtenReview))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private PerformanceStaffDto findStaff(PerformanceFullDto performance, Integer staffType) {
|
||||||
|
if (performance.getPerformanceStaff() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return performance.getPerformanceStaff().stream()
|
||||||
|
.filter(staff -> Objects.equals(staff.getStaffType(), staffType))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PerformanceAssignDto findAssign(
|
||||||
|
PerformanceFullDto performance,
|
||||||
|
Integer assignType,
|
||||||
|
Short assignOrder
|
||||||
|
) {
|
||||||
|
if (performance.getPerformanceAssignList() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return performance.getPerformanceAssignList().stream()
|
||||||
|
.filter(assign -> Objects.equals(assign.getAssignType(), assignType))
|
||||||
|
.filter(assign -> Objects.equals(assign.getAssignOrder(), assignOrder))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PerformanceAssignDto findFirstAssign(PerformanceFullDto performance, Integer assignType) {
|
||||||
|
if (performance.getPerformanceAssignList() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return performance.getPerformanceAssignList().stream()
|
||||||
|
.filter(assign -> Objects.equals(assign.getAssignType(), assignType))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PerformanceReviewDto findFirstReview(PerformanceFullDto performance, Integer reviewType) {
|
||||||
|
if (performance.getPerformanceReviewMap() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return performance.getPerformanceReviewMap().values().stream()
|
||||||
|
.flatMap(List::stream)
|
||||||
|
.filter(review -> Objects.equals(review.getReviewType(), reviewType))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PerformanceReviewDto findReview(
|
||||||
|
PerformanceFullDto performance,
|
||||||
|
Integer reviewType,
|
||||||
|
String regUser
|
||||||
|
) {
|
||||||
|
if (StringUtil.isNullOrBlank(regUser) || performance.getPerformanceReviewMap() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return performance.getPerformanceReviewMap()
|
||||||
|
.getOrDefault(regUser, Collections.emptyList())
|
||||||
|
.stream()
|
||||||
|
.filter(review -> Objects.equals(review.getReviewType(), reviewType))
|
||||||
|
.filter(review -> Objects.equals(review.getRegUser(), regUser))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatReviewDt(PerformanceReviewDto review) {
|
||||||
|
return review == null || review.getReviewDt() == null
|
||||||
|
? null
|
||||||
|
: review.getReviewDt().format(EXCEL_DT_FORMATTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatUpdateNoticeDt(String value) {
|
||||||
|
return StringUtil.isNullOrBlank(value)
|
||||||
|
? null
|
||||||
|
: LocalDateTime.parse(value).format(EXCEL_DT_FORMATTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String toStringValue(Object value) {
|
||||||
|
return value == null ? null : String.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer getPerformanceNoForSort(PerformanceFullDto performance) {
|
||||||
|
if (performance == null || performance.getPerformanceDetail() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NumericUtil.parseOnlyInteger(performance.getPerformanceDetail().get("performanceNo"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer getPerformanceNoForSort(PerformanceCompactDto performance) {
|
||||||
|
if (performance == null || performance.getPerformanceDetail() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NumericUtil.parseOnlyInteger(performance.getPerformanceDetail().get("performanceNo"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true, transactionManager = "konTransactionManager")
|
||||||
|
public List<PerformanceApplyCountDto> findPerformanceApplyCount() {
|
||||||
|
return konMapper.findPerformanceApplyCount(surveyType);
|
||||||
|
}
|
||||||
|
|
||||||
private PerformanceFullDto toFullDto(TPerformanceEntity performance) {
|
private PerformanceFullDto toFullDto(TPerformanceEntity performance) {
|
||||||
Integer performanceId = performance.getId();
|
Integer performanceId = performance.getId();
|
||||||
|
|
||||||
@@ -214,6 +478,20 @@ public class PerformanceService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PerformanceFullDto toFullDto(TPerformanceEntity performance, PerformanceFullLookup lookup) {
|
||||||
|
Integer performanceId = performance.getId();
|
||||||
|
|
||||||
|
return PerformanceFullDto.from(
|
||||||
|
performance,
|
||||||
|
lookup.performanceDetailMap().getOrDefault(performanceId, Collections.emptyMap()),
|
||||||
|
lookup.performanceStaffMap().getOrDefault(performanceId, Collections.emptyList()),
|
||||||
|
lookup.performanceMonitoringScheduleMap().get(performanceId),
|
||||||
|
lookup.performanceAssignMap().getOrDefault(performanceId, Collections.emptyList()),
|
||||||
|
lookup.performanceMonitoringVisitMap().getOrDefault(performanceId, Collections.emptyMap()),
|
||||||
|
lookup.performanceReviewMap().getOrDefault(performanceId, Collections.emptyMap())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private PerformanceCompactDto toCompactDto(TPerformanceEntity performance) {
|
private PerformanceCompactDto toCompactDto(TPerformanceEntity performance) {
|
||||||
Integer performanceId = performance.getId();
|
Integer performanceId = performance.getId();
|
||||||
|
|
||||||
@@ -226,20 +504,131 @@ public class PerformanceService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PerformanceCompactDto toCompactDto(
|
||||||
|
TPerformanceEntity performance,
|
||||||
|
PerformanceCompactLookup lookup
|
||||||
|
) {
|
||||||
|
Integer performanceId = performance.getId();
|
||||||
|
|
||||||
|
return PerformanceCompactDto.from(
|
||||||
|
performance,
|
||||||
|
lookup.performanceDetailMap().getOrDefault(performanceId, Collections.emptyMap()),
|
||||||
|
lookup.performanceStaffMap().getOrDefault(performanceId, Collections.emptyList()),
|
||||||
|
lookup.performanceMonitoringScheduleMap().get(performanceId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PerformanceFullLookup buildPerformanceFullLookup() {
|
||||||
|
PerformanceCompactLookup compactLookup = buildPerformanceCompactLookup();
|
||||||
|
Map<Integer, List<PerformanceAssignDto>> assignMap = performanceAssignRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TPerformanceAssignEntity::getPerformanceId,
|
||||||
|
Collectors.mapping(PerformanceAssignDto::from, Collectors.toList())
|
||||||
|
));
|
||||||
|
Map<Integer, Map<String, List<PerformanceMonitoringVisitDto>>> visitMap =
|
||||||
|
performanceMonitoringVisitRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TPerformanceMonitoringVisitEntity::getPerformanceId,
|
||||||
|
Collectors.groupingBy(
|
||||||
|
TPerformanceMonitoringVisitEntity::getRegUser,
|
||||||
|
Collectors.mapping(PerformanceMonitoringVisitDto::from, Collectors.toList())
|
||||||
|
)
|
||||||
|
));
|
||||||
|
Map<Integer, Map<String, List<PerformanceReviewDto>>> reviewMap =
|
||||||
|
performanceReviewRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TPerformanceReviewEntity::getPerformanceId,
|
||||||
|
Collectors.groupingBy(
|
||||||
|
TPerformanceReviewEntity::getRegUser,
|
||||||
|
Collectors.mapping(PerformanceReviewDto::from, Collectors.toList())
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
return new PerformanceFullLookup(
|
||||||
|
compactLookup.performanceDetailMap(),
|
||||||
|
compactLookup.performanceStaffMap(),
|
||||||
|
compactLookup.performanceMonitoringScheduleMap(),
|
||||||
|
assignMap,
|
||||||
|
visitMap,
|
||||||
|
reviewMap
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PerformanceCompactLookup buildPerformanceCompactLookup() {
|
||||||
|
Map<Integer, Map<String, String>> detailMap = performanceDetailRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TPerformanceDetailEntity::getPerformanceId,
|
||||||
|
toMap(
|
||||||
|
TPerformanceDetailEntity::getPerformanceDetailKey,
|
||||||
|
TPerformanceDetailEntity::getPerformanceDetailValue,
|
||||||
|
(left, right) -> right,
|
||||||
|
LinkedHashMap::new
|
||||||
|
)
|
||||||
|
));
|
||||||
|
Map<Integer, List<PerformanceStaffDto>> staffMap = performanceStaffRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TPerformanceStaffEntity::getPerformanceId,
|
||||||
|
Collectors.mapping(PerformanceStaffDto::from, Collectors.toList())
|
||||||
|
));
|
||||||
|
Map<Integer, PerformanceMonitoringScheduleDto> scheduleMap =
|
||||||
|
performanceMonitoringScheduleRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(toMap(
|
||||||
|
TPerformanceMonitoringScheduleEntity::getPerformanceId,
|
||||||
|
PerformanceMonitoringScheduleDto::from,
|
||||||
|
(first, ignored) -> first
|
||||||
|
));
|
||||||
|
|
||||||
|
return new PerformanceCompactLookup(detailMap, staffMap, scheduleMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
private record PerformanceCompactLookup(
|
||||||
|
Map<Integer, Map<String, String>> performanceDetailMap,
|
||||||
|
Map<Integer, List<PerformanceStaffDto>> performanceStaffMap,
|
||||||
|
Map<Integer, PerformanceMonitoringScheduleDto> performanceMonitoringScheduleMap
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
private record PerformanceFullLookup(
|
||||||
|
Map<Integer, Map<String, String>> performanceDetailMap,
|
||||||
|
Map<Integer, List<PerformanceStaffDto>> performanceStaffMap,
|
||||||
|
Map<Integer, PerformanceMonitoringScheduleDto> performanceMonitoringScheduleMap,
|
||||||
|
Map<Integer, List<PerformanceAssignDto>> performanceAssignMap,
|
||||||
|
Map<Integer, Map<String, List<PerformanceMonitoringVisitDto>>> performanceMonitoringVisitMap,
|
||||||
|
Map<Integer, Map<String, List<PerformanceReviewDto>>> performanceReviewMap
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
private List<ExcelErrorDto> validatePerformanceUploadRow(
|
private List<ExcelErrorDto> validatePerformanceUploadRow(
|
||||||
PerformanceUploadDto row,
|
PerformanceUploadDto row,
|
||||||
int rowNumber,
|
int rowNumber,
|
||||||
List<CodeDto> businessTypeList,
|
List<CodeDto> businessTypeList,
|
||||||
List<CodeDto> genreList,
|
List<CodeDto> genreList,
|
||||||
List<CodeDto> areaList,
|
List<CodeDto> areaList,
|
||||||
List<CodeDto> ticketReservationStatusList
|
List<CodeDto> ticketReservationStatusList,
|
||||||
|
Set<Integer> existingPerformanceIds
|
||||||
) {
|
) {
|
||||||
List<ExcelErrorDto> errors = new ArrayList<>();
|
List<ExcelErrorDto> errors = new ArrayList<>();
|
||||||
|
|
||||||
|
String ncas = Objects.toString(row.getNcas(), "");
|
||||||
|
if (!ncas.matches("[0-9]*") || ncas.length() > 2048) {
|
||||||
|
errors.add(ExcelErrorDto.of(rowNumber, "관리번호", "관리번호는 2048자 이내의 숫자만 입력할 수 있습니다."));
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer performanceNo = NumericUtil.parseOnlyInteger(row.getPerformanceNo());
|
||||||
|
if (performanceNo == null) {
|
||||||
|
errors.add(ExcelErrorDto.of(rowNumber, "No", "No는 숫자여야 합니다."));
|
||||||
|
}
|
||||||
|
|
||||||
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
||||||
if (performanceId == null) {
|
if (performanceId == null) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "연번", "연번은 숫자여야 합니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "연번", "연번은 숫자여야 합니다."));
|
||||||
} else if (performanceRepository.existsById(performanceId)) {
|
} else if (existingPerformanceIds.contains(performanceId)) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "연번", "이미 등록된 공연 ID입니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "연번", "이미 등록된 공연 ID입니다."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,20 +644,25 @@ public class PerformanceService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Integer performanceStartMonth = NumericUtil.parseOnlyInteger(row.getPerformanceStartMonth());
|
Integer performanceStartMonth = NumericUtil.parseOnlyInteger(row.getPerformanceStartMonth());
|
||||||
if (performanceStartMonth == null || performanceStartMonth < 1 || performanceStartMonth > 12) {
|
if(performanceStartMonth == null){
|
||||||
|
performanceStartMonth = 0;
|
||||||
|
}
|
||||||
|
else if (performanceStartMonth < 1 || performanceStartMonth > 12) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "사업 수행 월", "사업 수행 월은 1~12 사이 숫자여야 합니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "사업 수행 월", "사업 수행 월은 1~12 사이 숫자여야 합니다."));
|
||||||
}
|
}
|
||||||
|
|
||||||
String md = row.getMonitoringDate();
|
String monitoringDate = row.getMonitoringDate();
|
||||||
if (DateTimeUtil.parseLocalDate(row.getMonitoringDate()) == null) {
|
if (!StringUtil.isNullOrBlank(monitoringDate) && DateTimeUtil.parseLocalDate(monitoringDate) == null) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "모니터링 일정", "모니터링 일정은 yyyy-MM-dd 형식이어야 합니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "모니터링 일정", "모니터링 일정은 yyyy-MM-dd 형식이어야 합니다."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String timeTreeCheckDt = row.getTimeTreeCheckDt();
|
||||||
|
if (!StringUtil.isNullOrBlank(timeTreeCheckDt) && DateTimeUtil.parseLocalDate(timeTreeCheckDt) == null) {
|
||||||
|
errors.add(ExcelErrorDto.of(rowNumber, "타임트리 확인일시", "타임트리 확인일시는 yyyy-MM-dd 형식이어야 합니다."));
|
||||||
|
}
|
||||||
|
|
||||||
validateRequired(errors, rowNumber, "단체(인) 명", row.getArtistName());
|
validateRequired(errors, rowNumber, "단체(인) 명", row.getArtistName());
|
||||||
validateRequired(errors, rowNumber, "사업 명", row.getPerformanceName());
|
validateRequired(errors, rowNumber, "사업 명", row.getPerformanceName());
|
||||||
validateRequired(errors, rowNumber, "사업 일정", row.getPerformanceDtInfo());
|
|
||||||
validateRequired(errors, rowNumber, "운영 시간", row.getPerformanceTimeInfo());
|
|
||||||
validateRequired(errors, rowNumber, "모니터링 시간", row.getMonitoringTimeInfo());
|
|
||||||
validateRequired(errors, rowNumber, "모니터링 방문 장소", row.getMonitoringAddress());
|
validateRequired(errors, rowNumber, "모니터링 방문 장소", row.getMonitoringAddress());
|
||||||
|
|
||||||
validateStaff(errors, rowNumber, "대표자", row.getOwnStaffName(),
|
validateStaff(errors, rowNumber, "대표자", row.getOwnStaffName(),
|
||||||
@@ -286,6 +680,11 @@ public class PerformanceService {
|
|||||||
) {
|
) {
|
||||||
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
||||||
|
|
||||||
|
Integer performanceStartMonth = NumericUtil.parseOnlyInteger(row.getPerformanceStartMonth());
|
||||||
|
if(performanceStartMonth == null){
|
||||||
|
performanceStartMonth = 0;
|
||||||
|
}
|
||||||
|
|
||||||
TPerformanceEntity performance = TPerformanceEntity.builder()
|
TPerformanceEntity performance = TPerformanceEntity.builder()
|
||||||
.id(performanceId)
|
.id(performanceId)
|
||||||
.businessType(NumericUtil.parseOnlyInteger(row.getBusinessType()))
|
.businessType(NumericUtil.parseOnlyInteger(row.getBusinessType()))
|
||||||
@@ -293,7 +692,7 @@ public class PerformanceService {
|
|||||||
.performanceArea(NumericUtil.parseOnlyInteger(row.getPerformanceArea()))
|
.performanceArea(NumericUtil.parseOnlyInteger(row.getPerformanceArea()))
|
||||||
.artistName(Objects.toString(StringUtil.normalizeBlank(row.getArtistName()), ""))
|
.artistName(Objects.toString(StringUtil.normalizeBlank(row.getArtistName()), ""))
|
||||||
.performanceName(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceName()), ""))
|
.performanceName(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceName()), ""))
|
||||||
.performanceStartMonth(NumericUtil.parseOnlyInteger(row.getPerformanceStartMonth()))
|
.performanceStartMonth(performanceStartMonth)
|
||||||
.performanceDtInfo(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceDtInfo()), ""))
|
.performanceDtInfo(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceDtInfo()), ""))
|
||||||
.performanceTimeInfo(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceTimeInfo()), ""))
|
.performanceTimeInfo(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceTimeInfo()), ""))
|
||||||
.ticketReservationStatus(NumericUtil.parseOnlyInteger(row.getTicketReservationStatus()))
|
.ticketReservationStatus(NumericUtil.parseOnlyInteger(row.getTicketReservationStatus()))
|
||||||
@@ -316,8 +715,18 @@ public class PerformanceService {
|
|||||||
LocalDateTime regDt
|
LocalDateTime regDt
|
||||||
) {
|
) {
|
||||||
Map<String, String> detail = new LinkedHashMap<>();
|
Map<String, String> detail = new LinkedHashMap<>();
|
||||||
|
detail.put("NCAS", Objects.toString(row.getNcas(), ""));
|
||||||
detail.put("monitoringPaymentDate", Objects.toString(StringUtil.normalizeBlank(row.getMonitoringPaymentDate()), ""));
|
detail.put("monitoringPaymentDate", Objects.toString(StringUtil.normalizeBlank(row.getMonitoringPaymentDate()), ""));
|
||||||
|
|
||||||
|
detail.put("performanceNo", Objects.toString(StringUtil.normalizeBlank(row.getPerformanceNo()), ""));
|
||||||
|
detail.put("performanceAreaDetail", Objects.toString(StringUtil.normalizeBlank(row.getPerformanceAreaDetail()), ""));
|
||||||
|
detail.put("needMonitoring", Objects.toString(StringUtil.normalizeBlank(row.getNeedMonitoring()), ""));
|
||||||
|
detail.put("needWrittenReview", Objects.toString(StringUtil.normalizeBlank(row.getNeedWrittenReview()), ""));
|
||||||
|
detail.put("checkDeliver", Objects.toString(StringUtil.normalizeBlank(row.getCheckDeliver()), ""));
|
||||||
|
detail.put("timeTreeCheckDt", Objects.toString(StringUtil.normalizeBlank(row.getTimeTreeCheckDt()), ""));
|
||||||
|
detail.put("checkReport", Objects.toString(StringUtil.normalizeBlank(row.getCheckReport()), ""));
|
||||||
|
|
||||||
|
|
||||||
List<TPerformanceDetailEntity> detailEntities = detail.entrySet().stream()
|
List<TPerformanceDetailEntity> detailEntities = detail.entrySet().stream()
|
||||||
.map(entry -> TPerformanceDetailEntity.update(
|
.map(entry -> TPerformanceDetailEntity.update(
|
||||||
performanceId,
|
performanceId,
|
||||||
@@ -498,9 +907,7 @@ public class PerformanceService {
|
|||||||
String modUser,
|
String modUser,
|
||||||
LocalDateTime modDt
|
LocalDateTime modDt
|
||||||
) {
|
) {
|
||||||
Map<String, String> detail = performanceDetail == null
|
Map<String, String> detail = preparePerformanceDetail(performanceId, performanceDetail, modDt);
|
||||||
? Collections.emptyMap()
|
|
||||||
: performanceDetail;
|
|
||||||
|
|
||||||
List<TPerformanceDetailEntity> detailEntities = detail.entrySet().stream()
|
List<TPerformanceDetailEntity> detailEntities = detail.entrySet().stream()
|
||||||
.map(entry -> TPerformanceDetailEntity.update(
|
.map(entry -> TPerformanceDetailEntity.update(
|
||||||
@@ -515,6 +922,56 @@ public class PerformanceService {
|
|||||||
performanceDetailRepository.saveAll(detailEntities);
|
performanceDetailRepository.saveAll(detailEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, String> preparePerformanceDetail(
|
||||||
|
Integer performanceId,
|
||||||
|
Map<String, String> performanceDetail,
|
||||||
|
LocalDateTime modDt
|
||||||
|
) {
|
||||||
|
Map<String, String> detail = performanceDetail == null
|
||||||
|
? new LinkedHashMap<>() : new LinkedHashMap<>(performanceDetail);
|
||||||
|
// 변경 일시는 클라이언트 값으로 수정할 수 없다.
|
||||||
|
detail.remove("UpdateNoticeDt");
|
||||||
|
if (detail.containsKey("NCAS")) {
|
||||||
|
String ncas = Objects.toString(detail.get("NCAS"), "");
|
||||||
|
if (!ncas.matches("[0-9]*") || ncas.length() > 2048) {
|
||||||
|
throw BusinessException.badRequest("INVALID_NCAS", "관리번호는 2048자 이내의 숫자만 입력할 수 있습니다.");
|
||||||
|
}
|
||||||
|
detail.put("NCAS", ncas);
|
||||||
|
}
|
||||||
|
if (!detail.containsKey("UpdateNoticeTarget")
|
||||||
|
&& !detail.containsKey("UpdateNoticeMemo")) {
|
||||||
|
return detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> existing = getPerformanceDetailMap(performanceId);
|
||||||
|
String target = Objects.toString(detail.getOrDefault("UpdateNoticeTarget",
|
||||||
|
existing.get("UpdateNoticeTarget")), "");
|
||||||
|
String memo = Objects.toString(detail.getOrDefault("UpdateNoticeMemo",
|
||||||
|
existing.get("UpdateNoticeMemo")), "");
|
||||||
|
if (!target.isEmpty()) {
|
||||||
|
boolean valid = codeService.findByCodeGroup("update_notice_target").stream()
|
||||||
|
.anyMatch(code -> code.getCodeValue().toString().equals(target));
|
||||||
|
if (!valid) {
|
||||||
|
throw BusinessException.badRequest("INVALID_UPDATE_NOTICE_TARGET", "변경 사항 코드가 유효하지 않습니다.");
|
||||||
|
}
|
||||||
|
if (memo.isBlank()) {
|
||||||
|
throw BusinessException.badRequest("EMPTY_UPDATE_NOTICE_MEMO", "변경 사항 저장 시 변경 내용은 필수입니다.");
|
||||||
|
}
|
||||||
|
} else if (!memo.isBlank()) {
|
||||||
|
throw BusinessException.badRequest("EMPTY_UPDATE_NOTICE_TARGET", "변경 내용을 저장하려면 변경 사항을 선택해야 합니다.");
|
||||||
|
}
|
||||||
|
if (memo.length() > 2048) {
|
||||||
|
throw BusinessException.badRequest("INVALID_UPDATE_NOTICE_MEMO", "변경 내용은 2048자 이내로 입력해야 합니다.");
|
||||||
|
}
|
||||||
|
detail.put("UpdateNoticeTarget", target);
|
||||||
|
detail.put("UpdateNoticeMemo", memo);
|
||||||
|
if (!Objects.equals(target, Objects.toString(existing.get("UpdateNoticeTarget"), ""))
|
||||||
|
|| !Objects.equals(memo, Objects.toString(existing.get("UpdateNoticeMemo"), ""))) {
|
||||||
|
detail.put("UpdateNoticeDt", target.isEmpty() ? "" : modDt.toString());
|
||||||
|
}
|
||||||
|
return detail;
|
||||||
|
}
|
||||||
|
|
||||||
private void updatePerformanceStaff(
|
private void updatePerformanceStaff(
|
||||||
Integer performanceId,
|
Integer performanceId,
|
||||||
List<PerformanceStaffDto> performanceStaff,
|
List<PerformanceStaffDto> performanceStaff,
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.kri.gwcf.review.back.service;
|
||||||
|
|
||||||
|
import com.kri.common.feature.util.StringUtil;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceReviewEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceReviewRepository;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ReviewPdfConvertService {
|
||||||
|
|
||||||
|
private static final short PDF_CONVERT_COMPLETE = 1;
|
||||||
|
private static final short PDF_CONVERT_FAILED = 9;
|
||||||
|
|
||||||
|
private final PerformanceReviewRepository performanceReviewRepository;
|
||||||
|
|
||||||
|
@Value("${kri.file.pdf-converter-command:soffice}")
|
||||||
|
private String pdfConverterCommand;
|
||||||
|
|
||||||
|
public void convertReviewFileToPdf(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer reviewType,
|
||||||
|
String userId,
|
||||||
|
String uploadFileName,
|
||||||
|
Path source,
|
||||||
|
Path dir
|
||||||
|
) {
|
||||||
|
String pdfFileName = convertToPdfIfPossible(source, dir);
|
||||||
|
if (StringUtil.isNullOrBlank(pdfFileName)) {
|
||||||
|
updatePdfConvertFailure(performanceId, reviewType, userId, uploadFileName);
|
||||||
|
log.warn(
|
||||||
|
"Review PDF conversion failed. performanceId={}, reviewType={}, userId={}, uploadFileName={}",
|
||||||
|
performanceId,
|
||||||
|
reviewType,
|
||||||
|
userId,
|
||||||
|
uploadFileName
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
performanceReviewRepository
|
||||||
|
.findByIdPerformanceIdAndIdReviewTypeAndIdRegUser(performanceId, reviewType, userId)
|
||||||
|
.filter(entity -> uploadFileName.equals(entity.getUploadFileName()))
|
||||||
|
.ifPresentOrElse(
|
||||||
|
entity -> updatePdfConvertResult(entity, pdfFileName),
|
||||||
|
() -> log.info(
|
||||||
|
"Skipped stale review PDF conversion result. performanceId={}, reviewType={}, userId={}, uploadFileName={}, pdfFileName={}",
|
||||||
|
performanceId,
|
||||||
|
reviewType,
|
||||||
|
userId,
|
||||||
|
uploadFileName,
|
||||||
|
pdfFileName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updatePdfConvertResult(TPerformanceReviewEntity entity, String pdfFileName) {
|
||||||
|
entity.setPdfConvert(PDF_CONVERT_COMPLETE);
|
||||||
|
entity.setPdfFileName(pdfFileName);
|
||||||
|
entity.setPdfConvertDt(LocalDateTime.now());
|
||||||
|
performanceReviewRepository.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updatePdfConvertFailure(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer reviewType,
|
||||||
|
String userId,
|
||||||
|
String uploadFileName
|
||||||
|
) {
|
||||||
|
performanceReviewRepository
|
||||||
|
.findByIdPerformanceIdAndIdReviewTypeAndIdRegUser(performanceId, reviewType, userId)
|
||||||
|
.filter(entity -> uploadFileName.equals(entity.getUploadFileName()))
|
||||||
|
.ifPresent(entity -> {
|
||||||
|
entity.setPdfConvert(PDF_CONVERT_FAILED);
|
||||||
|
entity.setPdfFileName("");
|
||||||
|
entity.setPdfConvertDt(LocalDateTime.now());
|
||||||
|
performanceReviewRepository.save(entity);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private String convertToPdfIfPossible(Path source, Path dir) {
|
||||||
|
String extension = extractExtension(source.getFileName().toString()).toLowerCase();
|
||||||
|
Set<String> targets = new HashSet<>(Set.of(".docx", ".hwpx", ".hwp", ".pptx", ".xlsx"));
|
||||||
|
if (!targets.contains(extension)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Process process = new ProcessBuilder(
|
||||||
|
pdfConverterCommand,
|
||||||
|
"--headless",
|
||||||
|
"--convert-to",
|
||||||
|
"pdf",
|
||||||
|
"--outdir",
|
||||||
|
dir.toString(),
|
||||||
|
source.toString()
|
||||||
|
).redirectErrorStream(true).start();
|
||||||
|
|
||||||
|
boolean finished = process.waitFor(300, TimeUnit.SECONDS);
|
||||||
|
if (!finished || process.exitValue() != 0) {
|
||||||
|
process.destroyForcibly();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
String baseName = stripExtension(source.getFileName().toString());
|
||||||
|
Path pdf = dir.resolve(baseName + ".pdf").normalize();
|
||||||
|
return Files.exists(pdf) ? pdf.getFileName().toString() : "";
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Review PDF conversion error. source={}", source, e);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String stripExtension(String fileName) {
|
||||||
|
int dot = fileName.lastIndexOf('.');
|
||||||
|
return dot > 0 ? fileName.substring(0, dot) : fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String extractExtension(String fileName) {
|
||||||
|
int dot = fileName.lastIndexOf('.');
|
||||||
|
return dot >= 0 ? fileName.substring(dot) : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,22 +1,66 @@
|
|||||||
package com.kri.gwcf.review.back.service;
|
package com.kri.gwcf.review.back.service;
|
||||||
|
|
||||||
|
import com.kri.common.feature.util.StringUtil;
|
||||||
|
import com.kri.common.feature.web.BusinessException;
|
||||||
|
import com.kri.gwcf.review.back.config.FileStorageProperties;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceReviewDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceReviewDto;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceReviewEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceReviewEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.id.TPerformanceReviewEntityId;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceReviewRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceReviewRepository;
|
||||||
|
import com.kri.gwcf.review.back.service.file.AbstractFileService;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import lombok.RequiredArgsConstructor;
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.core.io.PathResource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.support.TransactionSynchronization;
|
||||||
|
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
public class ReviewService extends AbstractFileService {
|
||||||
public class ReviewService {
|
|
||||||
|
private static final short PDF_CONVERT_PENDING = 0;
|
||||||
|
private static final short PDF_CONVERT_COMPLETE = 1;
|
||||||
|
private static final short PDF_CONVERT_NOT_TARGET = 8;
|
||||||
|
|
||||||
private final PerformanceReviewRepository performanceReviewRepository;
|
private final PerformanceReviewRepository performanceReviewRepository;
|
||||||
|
private final FileStorageProperties fileStorageProperties;
|
||||||
|
private final ReviewPdfConvertService reviewPdfConvertService;
|
||||||
|
private final Executor pdfConvertTaskExecutor;
|
||||||
|
|
||||||
|
public ReviewService(
|
||||||
|
PerformanceReviewRepository performanceReviewRepository,
|
||||||
|
FileStorageProperties fileStorageProperties,
|
||||||
|
ReviewPdfConvertService reviewPdfConvertService,
|
||||||
|
@Qualifier("pdfConvertTaskExecutor") Executor pdfConvertTaskExecutor
|
||||||
|
) {
|
||||||
|
this.performanceReviewRepository = performanceReviewRepository;
|
||||||
|
this.fileStorageProperties = fileStorageProperties;
|
||||||
|
this.reviewPdfConvertService = reviewPdfConvertService;
|
||||||
|
this.pdfConvertTaskExecutor = pdfConvertTaskExecutor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Path getBaseDir() {
|
||||||
|
return Path.of(fileStorageProperties.getReviewBaseDir())
|
||||||
|
.toAbsolutePath()
|
||||||
|
.normalize();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasReviewWithUser(String userId) {
|
public boolean hasReviewWithUser(String userId) {
|
||||||
return performanceReviewRepository.existsByRegUserOrModUser(userId, userId);
|
return performanceReviewRepository.existsByIdRegUserOrModUser(userId, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasReviewWithPerformance(Integer performanceId) {
|
public boolean hasReviewWithPerformance(Integer performanceId) {
|
||||||
@@ -30,4 +74,312 @@ public class ReviewService {
|
|||||||
Collectors.mapping(PerformanceReviewDto::from, Collectors.toList())
|
Collectors.mapping(PerformanceReviewDto::from, Collectors.toList())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public PerformanceReviewDto saveWrittenReviewStatus(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer reviewStatus,
|
||||||
|
String userId,
|
||||||
|
LocalDateTime now
|
||||||
|
) {
|
||||||
|
TPerformanceReviewEntity entity = performanceReviewRepository
|
||||||
|
.findByIdPerformanceIdAndIdReviewTypeAndIdRegUser(performanceId, 2, userId)
|
||||||
|
.orElseGet(() -> TPerformanceReviewEntity.builder()
|
||||||
|
.id(TPerformanceReviewEntityId.builder()
|
||||||
|
.performanceId(performanceId)
|
||||||
|
.reviewType(2)
|
||||||
|
.regUser(userId)
|
||||||
|
.build())
|
||||||
|
.uploadFileName("")
|
||||||
|
.pdfConvert(PDF_CONVERT_NOT_TARGET)
|
||||||
|
.pdfFileName("")
|
||||||
|
.regDt(now)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
entity.setReviewStatus(reviewStatus);
|
||||||
|
if (entity.getRegUser() == null) {
|
||||||
|
entity.setRegUser(userId);
|
||||||
|
entity.setRegDt(now);
|
||||||
|
} else {
|
||||||
|
entity.setModUser(userId);
|
||||||
|
entity.setModDt(now);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PerformanceReviewDto.from(performanceReviewRepository.save(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public PerformanceReviewDto saveMonitoringReviewStatus(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer reviewStatus,
|
||||||
|
String userId,
|
||||||
|
LocalDateTime now
|
||||||
|
) {
|
||||||
|
TPerformanceReviewEntity entity = performanceReviewRepository
|
||||||
|
.findByIdPerformanceIdAndIdReviewTypeAndIdRegUser(performanceId, 1, userId)
|
||||||
|
.orElseGet(() -> TPerformanceReviewEntity.builder()
|
||||||
|
.id(TPerformanceReviewEntityId.builder()
|
||||||
|
.performanceId(performanceId)
|
||||||
|
.reviewType(1)
|
||||||
|
.regUser(userId)
|
||||||
|
.build())
|
||||||
|
.uploadFileName("")
|
||||||
|
.pdfConvert(PDF_CONVERT_NOT_TARGET)
|
||||||
|
.pdfFileName("")
|
||||||
|
.regDt(now)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
entity.setReviewStatus(reviewStatus);
|
||||||
|
entity.setModUser(userId);
|
||||||
|
entity.setModDt(now);
|
||||||
|
|
||||||
|
return PerformanceReviewDto.from(performanceReviewRepository.save(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public PerformanceReviewDto uploadReviewFile(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer reviewType,
|
||||||
|
MultipartFile file,
|
||||||
|
String userId,
|
||||||
|
LocalDateTime now
|
||||||
|
) {
|
||||||
|
if (file == null || file.isEmpty()) {
|
||||||
|
throw BusinessException.badRequest("EMPTY_FILE", "업로드할 파일이 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Path dir = reviewDir(performanceId, reviewType);
|
||||||
|
String uploadFileName = buildFileNameWithTime(file, now);
|
||||||
|
saveFile(dir, file, uploadFileName);
|
||||||
|
Path uploadPath = dir.resolve(uploadFileName).normalize();
|
||||||
|
|
||||||
|
boolean pdfFile = isPdf(uploadFileName);
|
||||||
|
boolean pdfConvertTarget = isPdfConvertTarget(uploadFileName);
|
||||||
|
String pdfFileName = pdfFile ? uploadFileName : "";
|
||||||
|
Short pdfConvert = resolveInitialPdfConvertStatus(pdfFile, pdfConvertTarget);
|
||||||
|
|
||||||
|
TPerformanceReviewEntity entity = performanceReviewRepository
|
||||||
|
.findByIdPerformanceIdAndIdReviewTypeAndIdRegUser(performanceId, reviewType, userId)
|
||||||
|
.orElseGet(() -> TPerformanceReviewEntity.builder()
|
||||||
|
.id(TPerformanceReviewEntityId.builder()
|
||||||
|
.performanceId(performanceId)
|
||||||
|
.reviewType(reviewType)
|
||||||
|
.regUser(userId)
|
||||||
|
.build())
|
||||||
|
.regDt(now)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
entity.setReviewStatus(10);
|
||||||
|
entity.setUploadFileName(uploadFileName);
|
||||||
|
entity.setPdfConvert(pdfConvert);
|
||||||
|
entity.setPdfFileName(pdfFileName);
|
||||||
|
entity.setPdfConvertDt(null);
|
||||||
|
if (entity.getRegUser() == null) {
|
||||||
|
entity.setRegUser(userId);
|
||||||
|
entity.setRegDt(now);
|
||||||
|
} else {
|
||||||
|
entity.setModUser(userId);
|
||||||
|
entity.setModDt(now);
|
||||||
|
}
|
||||||
|
|
||||||
|
TPerformanceReviewEntity saved = performanceReviewRepository.save(entity);
|
||||||
|
if (pdfConvert == PDF_CONVERT_PENDING) {
|
||||||
|
convertPdfAfterCommit(performanceId, reviewType, userId, uploadFileName, uploadPath, dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PerformanceReviewDto.from(saved);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw BusinessException.internalError("REVIEW_FILE_SAVE_FAILED", "평가/모니터링 파일 저장 중 오류가 발생했습니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PerformanceReviewDto getReviewFile(Integer performanceId, Integer reviewType, String userId) {
|
||||||
|
return PerformanceReviewDto.from(getReviewEntity(performanceId, reviewType, userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void convertPdfAfterCommit(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer reviewType,
|
||||||
|
String userId,
|
||||||
|
String uploadFileName,
|
||||||
|
Path uploadPath,
|
||||||
|
Path dir
|
||||||
|
) {
|
||||||
|
Runnable task = () -> reviewPdfConvertService.convertReviewFileToPdf(
|
||||||
|
performanceId,
|
||||||
|
reviewType,
|
||||||
|
userId,
|
||||||
|
uploadFileName,
|
||||||
|
uploadPath,
|
||||||
|
dir
|
||||||
|
);
|
||||||
|
|
||||||
|
if (TransactionSynchronizationManager.isSynchronizationActive()) {
|
||||||
|
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||||
|
@Override
|
||||||
|
public void afterCommit() {
|
||||||
|
pdfConvertTaskExecutor.execute(task);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pdfConvertTaskExecutor.execute(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PathResource getOriginalFileResource(Integer performanceId, Integer reviewType, String userId) {
|
||||||
|
TPerformanceReviewEntity entity = getReviewEntity(performanceId, reviewType, userId);
|
||||||
|
return toResource(reviewDir(performanceId, reviewType).resolve(entity.getUploadFileName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public PathResource getOriginalFileZipResource(Integer performanceId, Integer reviewType) {
|
||||||
|
List<TPerformanceReviewEntity> reviews = performanceReviewRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.filter(review -> isSamePerformanceGroup(performanceId, review.getPerformanceId()))
|
||||||
|
.filter(review -> Integer.valueOf(reviewType).equals(review.getReviewType()))
|
||||||
|
.filter(review -> StringUtil.hasText(review.getUploadFileName()))
|
||||||
|
.toList();
|
||||||
|
if (reviews.isEmpty()) {
|
||||||
|
throw BusinessException.notFound("REVIEW_FILE_NOT_FOUND", "평가/모니터링 파일이 없습니다.")
|
||||||
|
.with("performanceId", performanceId)
|
||||||
|
.with("reviewType", reviewType);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Path zip = Files.createTempFile(getOriginalFileZipBaseName(performanceId, reviewType), ".zip");
|
||||||
|
int entryCount = 0;
|
||||||
|
try (ZipOutputStream out = new ZipOutputStream(Files.newOutputStream(zip))) {
|
||||||
|
Set<String> entryNames = new HashSet<>();
|
||||||
|
for (TPerformanceReviewEntity review : reviews) {
|
||||||
|
Path sourceDir = reviewDir(review.getPerformanceId(), reviewType);
|
||||||
|
Path source = sourceDir.resolve(review.getUploadFileName()).normalize();
|
||||||
|
if (!source.startsWith(sourceDir) || !Files.exists(source) || !Files.isRegularFile(source)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String entryName = buildZipEntryName(review, entryNames);
|
||||||
|
out.putNextEntry(new ZipEntry(entryName));
|
||||||
|
Files.copy(source, out);
|
||||||
|
out.closeEntry();
|
||||||
|
entryCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entryCount == 0) {
|
||||||
|
Files.deleteIfExists(zip);
|
||||||
|
throw BusinessException.notFound("REVIEW_FILE_NOT_FOUND", "평가/모니터링 파일이 없습니다.")
|
||||||
|
.with("performanceId", performanceId)
|
||||||
|
.with("reviewType", reviewType);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PathResource(zip);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw BusinessException.internalError("REVIEW_FILE_ZIP_FAILED", "평가/모니터링 파일 압축 중 오류가 발생했습니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildZipEntryName(TPerformanceReviewEntity review, Set<String> entryNames) {
|
||||||
|
String userId = StringUtil.isNullOrBlank(review.getRegUser()) ? "user" : review.getRegUser();
|
||||||
|
String fileName = removeTimestampPrefix(review.getUploadFileName());
|
||||||
|
String entryName = sanitizeZipEntryName(review.getPerformanceId() + "_" + userId + "_" + fileName);
|
||||||
|
if (entryNames.add(entryName)) {
|
||||||
|
return entryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
String baseName = stripExtension(entryName);
|
||||||
|
String extension = extractExtension(entryName);
|
||||||
|
int index = 2;
|
||||||
|
while (true) {
|
||||||
|
String candidate = baseName + "_" + index + extension;
|
||||||
|
if (entryNames.add(candidate)) {
|
||||||
|
return candidate;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String sanitizeZipEntryName(String fileName) {
|
||||||
|
String sanitized = Path.of(fileName).getFileName().toString()
|
||||||
|
.replace('\\', '_')
|
||||||
|
.replace('/', '_');
|
||||||
|
return StringUtil.isNullOrBlank(sanitized) ? "review-file" : sanitized;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getOriginalFileZipBaseName(Integer performanceId, Integer reviewType) {
|
||||||
|
return "review_" + performanceId + "_" + reviewType;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isSamePerformanceGroup(Integer requestedPerformanceId, Integer targetPerformanceId) {
|
||||||
|
if (requestedPerformanceId == null || targetPerformanceId == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return requestedPerformanceId / 100 == targetPerformanceId / 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PathResource getPdfOrOriginalFileResource(Integer performanceId, Integer reviewType, String userId) {
|
||||||
|
TPerformanceReviewEntity entity = getReviewEntity(performanceId, reviewType, userId);
|
||||||
|
String fileName = StringUtil.isNullOrBlank(entity.getPdfFileName())
|
||||||
|
? entity.getUploadFileName()
|
||||||
|
: entity.getPdfFileName();
|
||||||
|
return toResource(reviewDir(performanceId, reviewType).resolve(fileName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private TPerformanceReviewEntity getReviewEntity(Integer performanceId, Integer reviewType, String userId) {
|
||||||
|
return performanceReviewRepository.findByIdPerformanceIdAndIdReviewTypeAndIdRegUser(
|
||||||
|
performanceId,
|
||||||
|
reviewType,
|
||||||
|
userId
|
||||||
|
)
|
||||||
|
.orElseThrow(() -> BusinessException.notFound("REVIEW_FILE_NOT_FOUND", "평가/모니터링 파일이 없습니다.")
|
||||||
|
.with("performanceId", performanceId)
|
||||||
|
.with("reviewType", reviewType)
|
||||||
|
.with("userId", userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
private PathResource toResource(Path path) {
|
||||||
|
Path normalized = path.toAbsolutePath().normalize();
|
||||||
|
if (!Files.exists(normalized)) {
|
||||||
|
throw BusinessException.notFound("FILE_NOT_FOUND", "파일이 없습니다.");
|
||||||
|
}
|
||||||
|
return new PathResource(normalized);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Path reviewDir(Integer performanceId, Integer reviewType) {
|
||||||
|
return getBaseDir()
|
||||||
|
.resolve(String.valueOf(performanceId))
|
||||||
|
.resolve(String.valueOf(reviewType))
|
||||||
|
.toAbsolutePath()
|
||||||
|
.normalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String stripExtension(String fileName) {
|
||||||
|
int dot = fileName.lastIndexOf('.');
|
||||||
|
return dot > 0 ? fileName.substring(0, dot) : fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isPdf(String fileName) {
|
||||||
|
return ".pdf".equalsIgnoreCase(extractExtension(fileName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Short resolveInitialPdfConvertStatus(boolean pdfFile, boolean pdfConvertTarget) {
|
||||||
|
if (pdfFile) {
|
||||||
|
return PDF_CONVERT_COMPLETE;
|
||||||
|
}
|
||||||
|
return pdfConvertTarget ? PDF_CONVERT_PENDING : PDF_CONVERT_NOT_TARGET;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isPdfConvertTarget(String fileName) {
|
||||||
|
String extension = extractExtension(fileName).toLowerCase();
|
||||||
|
return Set.of(".docx", ".hwpx", ".hwp", ".pptx", ".xlsx").contains(extension);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String removeTimestampPrefix(String fileName) {
|
||||||
|
if (StringUtil.isNullOrBlank(fileName)) {
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileName.replaceFirst("^\\d{4}-\\d{2}-\\d{2}_\\d{6}_", "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,176 @@
|
|||||||
|
package com.kri.gwcf.review.back.service;
|
||||||
|
|
||||||
|
import static com.kri.gwcf.review.back.common.consts.GwcfConstant.REVIEW_CLASSIFICATION;
|
||||||
|
import static com.kri.gwcf.review.back.common.consts.GwcfConstant.REVIEW_TYPE;
|
||||||
|
|
||||||
|
import com.kri.common.feature.util.StringUtil;
|
||||||
|
import com.kri.common.feature.web.BusinessException;
|
||||||
|
import com.kri.gwcf.review.back.config.FileStorageProperties;
|
||||||
|
import com.kri.gwcf.review.back.service.file.AbstractFileService;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.core.io.PathResource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ReviewTemplateService extends AbstractFileService {
|
||||||
|
|
||||||
|
private final FileStorageProperties fileStorageProperties;
|
||||||
|
|
||||||
|
@Value("${kri.file.pdf-converter-command:soffice}")
|
||||||
|
private String pdfConverterCommand;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Path getBaseDir() {
|
||||||
|
return Path.of(fileStorageProperties.getReviewTemplateBaseDir())
|
||||||
|
.toAbsolutePath()
|
||||||
|
.normalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String uploadReviewTemplate(Integer reviewType, Integer classification, MultipartFile file) {
|
||||||
|
validateReviewTemplateType(reviewType);
|
||||||
|
validateReviewTemplateClassification(classification);
|
||||||
|
if (file == null || file.isEmpty()) {
|
||||||
|
throw BusinessException.badRequest("EMPTY_FILE", "업로드된 파일이 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
String fileName = sanitizeFileName(file.getOriginalFilename());
|
||||||
|
Path dir = templateDir(reviewType, classification);
|
||||||
|
|
||||||
|
try {
|
||||||
|
deleteExistingFiles(dir);
|
||||||
|
saveFile(dir, file, fileName);
|
||||||
|
Path uploadPath = dir.resolve(fileName).normalize();
|
||||||
|
convertToPdfIfPossible(uploadPath, dir);
|
||||||
|
return fileName;
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw BusinessException.internalError("REVIEW_TEMPLATE_SAVE_FAILED", "평가양식 파일 저장 중 오류가 발생했습니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PathResource getReviewTemplateResource(Integer reviewType, Integer classification) {
|
||||||
|
Path file = findReviewTemplateFile(reviewType, classification, false);
|
||||||
|
return new PathResource(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PathResource getReviewTemplatePdfResource(Integer reviewType, Integer classification) {
|
||||||
|
Path file = findReviewTemplateFile(reviewType, classification, true);
|
||||||
|
return new PathResource(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Path findReviewTemplateFile(Integer reviewType, Integer classification, boolean pdf) {
|
||||||
|
validateReviewTemplateType(reviewType);
|
||||||
|
validateReviewTemplateClassification(classification);
|
||||||
|
|
||||||
|
Path dir = templateDir(reviewType, classification);
|
||||||
|
if (!Files.isDirectory(dir)) {
|
||||||
|
throw BusinessException.notFound("REVIEW_TEMPLATE_NOT_FOUND", "평가양식 파일이 없습니다.")
|
||||||
|
.with("reviewType", reviewType);
|
||||||
|
}
|
||||||
|
|
||||||
|
try (var files = Files.list(dir)) {
|
||||||
|
return files
|
||||||
|
.filter(Files::isRegularFile)
|
||||||
|
.filter(path -> pdf == isPdf(path.getFileName().toString()))
|
||||||
|
.sorted(Comparator.comparing(path -> path.getFileName().toString()))
|
||||||
|
.findFirst()
|
||||||
|
.orElseThrow(() -> BusinessException.notFound("REVIEW_TEMPLATE_NOT_FOUND", "평가양식 파일이 없습니다.")
|
||||||
|
.with("reviewType", reviewType));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw BusinessException.internalError("REVIEW_TEMPLATE_READ_FAILED", "평가양식 파일 조회 중 오류가 발생했습니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteExistingFiles(Path dir) throws IOException {
|
||||||
|
if (!Files.isDirectory(dir)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try (var files = Files.list(dir)) {
|
||||||
|
for (Path file : files.filter(Files::isRegularFile).toList()) {
|
||||||
|
Files.deleteIfExists(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String convertToPdfIfPossible(Path source, Path dir) {
|
||||||
|
String extension = extractExtension(source.getFileName().toString()).toLowerCase();
|
||||||
|
Set<String> targets = new HashSet<>(Set.of(".docx", ".hwpx", ".hwp", ".pptx", ".xlsx"));
|
||||||
|
if (isPdf(source.getFileName().toString()) || !targets.contains(extension)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Process process = new ProcessBuilder(
|
||||||
|
pdfConverterCommand,
|
||||||
|
"--headless",
|
||||||
|
"--convert-to",
|
||||||
|
"pdf",
|
||||||
|
"--outdir",
|
||||||
|
dir.toString(),
|
||||||
|
source.toString()
|
||||||
|
).redirectErrorStream(true).start();
|
||||||
|
|
||||||
|
boolean finished = process.waitFor(60, TimeUnit.SECONDS);
|
||||||
|
if (!finished || process.exitValue() != 0) {
|
||||||
|
process.destroyForcibly();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
String baseName = stripExtension(source.getFileName().toString());
|
||||||
|
Path pdf = dir.resolve(baseName + ".pdf").normalize();
|
||||||
|
return Files.exists(pdf) ? pdf.getFileName().toString() : "";
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String stripExtension(String fileName) {
|
||||||
|
int dot = fileName.lastIndexOf('.');
|
||||||
|
return dot > 0 ? fileName.substring(0, dot) : fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isPdf(String fileName) {
|
||||||
|
return ".pdf".equalsIgnoreCase(extractExtension(fileName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Path templateDir(Integer reviewType, Integer classification) {
|
||||||
|
return getBaseDir()
|
||||||
|
.resolve(String.valueOf(reviewType))
|
||||||
|
.resolve(String.valueOf(classification))
|
||||||
|
.toAbsolutePath()
|
||||||
|
.normalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateReviewTemplateType(Integer reviewType) {
|
||||||
|
if (!REVIEW_TYPE.contains(reviewType)) {
|
||||||
|
throw BusinessException.badRequest("INVALID_REVIEW_TEMPLATE_TYPE", "유효하지 않은 평가양식 타입입니다.")
|
||||||
|
.with("reviewType", reviewType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateReviewTemplateClassification(Integer classification) {
|
||||||
|
if (!REVIEW_CLASSIFICATION.contains(classification)) {
|
||||||
|
throw BusinessException.badRequest("INVALID_REVIEW_TEMPLATE_CLASSIFICATION", "유효하지 않은 평가양식 분류입니다.")
|
||||||
|
.with("classification", classification);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String sanitizeFileName(String originalFileName) {
|
||||||
|
if (StringUtil.isNullOrBlank(originalFileName)) {
|
||||||
|
return "review-template";
|
||||||
|
}
|
||||||
|
|
||||||
|
return Path.of(originalFileName).getFileName().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,9 +16,9 @@ import com.kri.gwcf.review.back.dto.common.CodeDto;
|
|||||||
import com.kri.gwcf.review.back.dto.common.DataVerificationDto;
|
import com.kri.gwcf.review.back.dto.common.DataVerificationDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.ExcelErrorDto;
|
import com.kri.gwcf.review.back.dto.excel.ExcelErrorDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.ExcelUploadResultDto;
|
import com.kri.gwcf.review.back.dto.excel.ExcelUploadResultDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.MonitoringUserUploadDto;
|
import com.kri.gwcf.review.back.dto.excel.user.MonitoringUserUploadDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.UserUploadBaseDto;
|
import com.kri.gwcf.review.back.dto.excel.user.UserUploadBaseDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.WrittenUserUploadDto;
|
import com.kri.gwcf.review.back.dto.excel.user.WrittenUserUploadDto;
|
||||||
import com.kri.gwcf.review.back.dto.user.UserCompactDto;
|
import com.kri.gwcf.review.back.dto.user.UserCompactDto;
|
||||||
import com.kri.gwcf.review.back.dto.user.UserFullDto;
|
import com.kri.gwcf.review.back.dto.user.UserFullDto;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TUserDetailEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TUserDetailEntity;
|
||||||
@@ -28,10 +28,12 @@ import com.kri.gwcf.review.back.persistence.repository.UserRepository;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -99,6 +101,11 @@ public class UserService {
|
|||||||
return exportUserTemplate(userRole, getUserUploadClass(userRole));
|
return exportUserTemplate(userRole, getUserUploadClass(userRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] exportUser(Integer userRole, String[] userIds) {
|
||||||
|
validateUserRole(userRole);
|
||||||
|
return exportUser(userRole, getUserUploadClass(userRole), userIds);
|
||||||
|
}
|
||||||
|
|
||||||
private Class<? extends UserUploadBaseDto> getUserUploadClass(Integer userRole) {
|
private Class<? extends UserUploadBaseDto> getUserUploadClass(Integer userRole) {
|
||||||
if (Objects.equals(userRole, MONITORING_USER_ROLE)) {
|
if (Objects.equals(userRole, MONITORING_USER_ROLE)) {
|
||||||
return MonitoringUserUploadDto.class;
|
return MonitoringUserUploadDto.class;
|
||||||
@@ -132,6 +139,77 @@ public class UserService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private <T extends UserUploadBaseDto> byte[] exportUser(Integer userRole, Class<T> clazz, String[] userIds) {
|
||||||
|
Set<String> selectedUserIds = userIds == null
|
||||||
|
? Collections.emptySet()
|
||||||
|
: Arrays.stream(userIds).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
List<UserFullDto> userList = getUserList(userRole).stream()
|
||||||
|
.filter(user -> selectedUserIds.contains(user.getUserId()))
|
||||||
|
.toList();
|
||||||
|
List<T> exportRows = userList.stream()
|
||||||
|
.map(user -> toUserUploadRow(clazz, user))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
List<CodeDto> genreList = codeService.findByCodeGroup("genre");
|
||||||
|
List<CodeDto> areaList = codeService.findByCodeGroup("area");
|
||||||
|
List<CodeDto> genderList = codeService.findByCodeGroup("gender");
|
||||||
|
List<CodeDto> hasCarList = codeService.findByCodeGroup("has_car");
|
||||||
|
|
||||||
|
try (Workbook workbook =
|
||||||
|
ExcelMapper.writeToWorkbook(exportRows, clazz);
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||||
|
|
||||||
|
if (Objects.equals(userRole, MONITORING_USER_ROLE)) {
|
||||||
|
appendCodeSheet(workbook, areaList, "지역");
|
||||||
|
appendCodeSheet(workbook, genderList, "성별");
|
||||||
|
appendCodeSheet(workbook, hasCarList, "자차유무");
|
||||||
|
} else {
|
||||||
|
appendCodeSheet(workbook, genreList, "장르");
|
||||||
|
}
|
||||||
|
|
||||||
|
workbook.write(out);
|
||||||
|
return out.toByteArray();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw BusinessException.internalError("사용자 엑셀 생성 중 오류");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T extends UserUploadBaseDto> T toUserUploadRow(Class<T> clazz, UserFullDto user) {
|
||||||
|
if (clazz == MonitoringUserUploadDto.class) {
|
||||||
|
return clazz.cast(MonitoringUserUploadDto.builder()
|
||||||
|
.userId(user.getUserId())
|
||||||
|
.userPw(user.getUserPw())
|
||||||
|
.userName(user.getUserName())
|
||||||
|
.userArea(getUserDetailValue(user, "userArea"))
|
||||||
|
.userGender(getUserDetailValue(user, "userGender"))
|
||||||
|
.userAge(getUserDetailValue(user, "userAge"))
|
||||||
|
.userTel(getUserDetailValue(user, "userTel"))
|
||||||
|
.userEmail(getUserDetailValue(user, "userEmail"))
|
||||||
|
.userHasCar(getUserDetailValue(user, "userHasCar"))
|
||||||
|
.memo(user.getMemo())
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clazz == WrittenUserUploadDto.class) {
|
||||||
|
return clazz.cast(WrittenUserUploadDto.builder()
|
||||||
|
.userId(user.getUserId())
|
||||||
|
.userPw(user.getUserPw())
|
||||||
|
.userName(user.getUserName())
|
||||||
|
.userGenre(getUserDetailValue(user, "userGenre"))
|
||||||
|
.userTel(getUserDetailValue(user, "userTel"))
|
||||||
|
.userEmail(getUserDetailValue(user, "userEmail"))
|
||||||
|
.memo(user.getMemo())
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
throw BusinessException.internalError("지원하지 않는 사용자 엑셀 형식입니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getUserDetailValue(UserFullDto user, String key) {
|
||||||
|
return getUserDetail(user).get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private <T extends UserUploadBaseDto> List<T> readUserUploadRows(
|
private <T extends UserUploadBaseDto> List<T> readUserUploadRows(
|
||||||
|
|||||||
@@ -1,19 +1,51 @@
|
|||||||
package com.kri.gwcf.review.back.service;
|
package com.kri.gwcf.review.back.service;
|
||||||
|
|
||||||
|
import static com.kri.gwcf.review.back.common.consts.GwcfConstant.MONITORING_REVIEW_TYPE;
|
||||||
|
import static com.kri.gwcf.review.back.common.consts.GwcfConstant.MONITORING_VISIT_ARRIVAL_STATUS;
|
||||||
|
import static com.kri.gwcf.review.back.common.consts.GwcfConstant.MONITORING_VISIT_DEPARTURE_STATUS;
|
||||||
|
import static com.kri.gwcf.review.back.common.consts.GwcfConstant.MONITORING_VISIT_RESETTABLE_REVIEW_STATUS;
|
||||||
|
|
||||||
|
import com.kri.common.feature.util.StringUtil;
|
||||||
|
import com.kri.common.feature.web.BusinessException;
|
||||||
|
import com.kri.gwcf.review.back.config.FileStorageProperties;
|
||||||
|
import com.kri.gwcf.review.back.dto.monitoring.MonitoringGpsRequestDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceMonitoringVisitDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceMonitoringVisitDto;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringVisitEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringVisitEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceReviewEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceMonitoringVisitRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceMonitoringVisitRepository;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceReviewRepository;
|
||||||
|
import com.kri.gwcf.review.back.service.file.AbstractFileService;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class VisitService {
|
public class VisitService extends AbstractFileService {
|
||||||
|
|
||||||
private final PerformanceMonitoringVisitRepository performanceMonitoringVisitRepository;
|
private final PerformanceMonitoringVisitRepository performanceMonitoringVisitRepository;
|
||||||
|
private final PerformanceReviewRepository performanceReviewRepository;
|
||||||
|
private final FileStorageProperties fileStorageProperties;
|
||||||
|
private final ReviewService reviewService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Path getBaseDir() {
|
||||||
|
return Path.of(fileStorageProperties.getVisitBaseDir())
|
||||||
|
.toAbsolutePath()
|
||||||
|
.normalize();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasVisitWithUser(String userId) {
|
public boolean hasVisitWithUser(String userId) {
|
||||||
return performanceMonitoringVisitRepository.existsByRegUser(userId);
|
return performanceMonitoringVisitRepository.existsByRegUser(userId);
|
||||||
@@ -30,4 +62,171 @@ public class VisitService {
|
|||||||
Collectors.mapping(PerformanceMonitoringVisitDto::from, Collectors.toList())
|
Collectors.mapping(PerformanceMonitoringVisitDto::from, Collectors.toList())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public PerformanceMonitoringVisitDto saveDeparture(
|
||||||
|
Integer performanceId,
|
||||||
|
MonitoringGpsRequestDto gps,
|
||||||
|
String regUser,
|
||||||
|
LocalDateTime regDt
|
||||||
|
) {
|
||||||
|
//validateGps(gps);
|
||||||
|
TPerformanceMonitoringVisitEntity entity = saveVisit(
|
||||||
|
performanceId,
|
||||||
|
MONITORING_VISIT_DEPARTURE_STATUS,
|
||||||
|
"",
|
||||||
|
gps,
|
||||||
|
regUser,
|
||||||
|
regDt
|
||||||
|
);
|
||||||
|
reviewService.saveMonitoringReviewStatus(performanceId, MONITORING_VISIT_DEPARTURE_STATUS, regUser, regDt);
|
||||||
|
return PerformanceMonitoringVisitDto.from(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public PerformanceMonitoringVisitDto saveArrival(
|
||||||
|
Integer performanceId,
|
||||||
|
MonitoringGpsRequestDto gps,
|
||||||
|
List<MultipartFile> files,
|
||||||
|
String regUser,
|
||||||
|
LocalDateTime regDt
|
||||||
|
) {
|
||||||
|
//validateGps(gps);
|
||||||
|
String evidenceImg = String.join("|", saveEvidenceFiles(performanceId, regUser, files));
|
||||||
|
|
||||||
|
TPerformanceMonitoringVisitEntity entity = saveVisit(
|
||||||
|
performanceId,
|
||||||
|
MONITORING_VISIT_ARRIVAL_STATUS,
|
||||||
|
evidenceImg,
|
||||||
|
gps,
|
||||||
|
regUser,
|
||||||
|
regDt
|
||||||
|
);
|
||||||
|
reviewService.saveMonitoringReviewStatus(performanceId, MONITORING_VISIT_ARRIVAL_STATUS, regUser, regDt);
|
||||||
|
return PerformanceMonitoringVisitDto.from(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void reset(Integer performanceId, String userId) {
|
||||||
|
TPerformanceReviewEntity review = performanceReviewRepository
|
||||||
|
.findByIdPerformanceIdAndIdReviewTypeAndIdRegUserAndReviewStatusIn(
|
||||||
|
performanceId,
|
||||||
|
MONITORING_REVIEW_TYPE,
|
||||||
|
userId,
|
||||||
|
MONITORING_VISIT_RESETTABLE_REVIEW_STATUS
|
||||||
|
)
|
||||||
|
.orElseThrow(() -> BusinessException.badRequest(
|
||||||
|
"MONITORING_VISIT_RESET_NOT_ALLOWED",
|
||||||
|
"출발 또는 도착 상태의 모니터링 방문만 초기화할 수 있습니다."
|
||||||
|
)
|
||||||
|
.with("performanceId", performanceId)
|
||||||
|
.with("userId", userId));
|
||||||
|
|
||||||
|
performanceMonitoringVisitRepository.deleteByPerformanceIdAndRegUser(performanceId, userId);
|
||||||
|
performanceReviewRepository.delete(review);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PerformanceMonitoringVisitDto> findEvidence(Integer performanceId, String userId) {
|
||||||
|
return performanceMonitoringVisitRepository.findByPerformanceIdAndRegUser(performanceId, userId)
|
||||||
|
.stream()
|
||||||
|
.map(PerformanceMonitoringVisitDto::from)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] downloadEvidenceZip(Integer performanceId, String userId) {
|
||||||
|
List<String> fileNames = performanceMonitoringVisitRepository
|
||||||
|
.findByPerformanceIdAndRegUser(performanceId, userId)
|
||||||
|
.stream()
|
||||||
|
.flatMap(visit -> List.of(visit.getEvidenceImg().split("\\|")).stream())
|
||||||
|
.filter(StringUtil::hasText)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
try (
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
ZipOutputStream zip = new ZipOutputStream(out)
|
||||||
|
) {
|
||||||
|
Path dir = evidenceDir(performanceId, userId);
|
||||||
|
for (String fileName : fileNames) {
|
||||||
|
Path file = dir.resolve(fileName).normalize();
|
||||||
|
if (!file.startsWith(dir) || !Files.exists(file)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
zip.putNextEntry(new ZipEntry(fileName));
|
||||||
|
Files.copy(file, zip);
|
||||||
|
zip.closeEntry();
|
||||||
|
}
|
||||||
|
zip.finish();
|
||||||
|
return out.toByteArray();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw BusinessException.internalError("EVIDENCE_ZIP_FAILED", "증빙 사진 ZIP 생성 중 오류가 발생했습니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private TPerformanceMonitoringVisitEntity saveVisit(
|
||||||
|
Integer performanceId,
|
||||||
|
Integer status,
|
||||||
|
String evidenceImg,
|
||||||
|
MonitoringGpsRequestDto gps,
|
||||||
|
String regUser,
|
||||||
|
LocalDateTime regDt
|
||||||
|
) {
|
||||||
|
TPerformanceMonitoringVisitEntity entity = TPerformanceMonitoringVisitEntity.builder()
|
||||||
|
.performanceId(performanceId)
|
||||||
|
.monitoringVisitStatus(status)
|
||||||
|
.evidenceImg(evidenceImg)
|
||||||
|
.gpsLatitude(gps.getGpsLatitude())
|
||||||
|
.gpsLongitude(gps.getGpsLongitude())
|
||||||
|
.gpsAccuracyM(gps.getGpsAccuracyM())
|
||||||
|
.gpsRaw(gps.getGpsRaw())
|
||||||
|
.regUser(regUser)
|
||||||
|
.regDt(regDt)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return performanceMonitoringVisitRepository.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> saveEvidenceFiles(
|
||||||
|
Integer performanceId,
|
||||||
|
String userId,
|
||||||
|
List<MultipartFile> files
|
||||||
|
) {
|
||||||
|
if (files == null || files.isEmpty()) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Path dir = evidenceDir(performanceId, userId);
|
||||||
|
List<String> fileNames = new ArrayList<>();
|
||||||
|
for (MultipartFile file : files) {
|
||||||
|
if (file == null || file.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String fileName = saveFile(dir, file);
|
||||||
|
fileNames.add(fileName);
|
||||||
|
}
|
||||||
|
return fileNames;
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw BusinessException.internalError("EVIDENCE_SAVE_FAILED", "증빙 사진 저장 중 오류가 발생했습니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Path evidenceDir(Integer performanceId, String userId) {
|
||||||
|
return getBaseDir()
|
||||||
|
.resolve(String.valueOf(performanceId))
|
||||||
|
.resolve(userId)
|
||||||
|
.toAbsolutePath()
|
||||||
|
.normalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateGps(MonitoringGpsRequestDto gps) {
|
||||||
|
// GPS 필수 정책을 해제해야 하면 아래 if 블록만 주석 처리.
|
||||||
|
if (gps == null
|
||||||
|
|| gps.getGpsLatitude() == null
|
||||||
|
|| gps.getGpsLongitude() == null
|
||||||
|
|| gps.getGpsAccuracyM() == null
|
||||||
|
|| gps.getGpsRaw() == null
|
||||||
|
|| gps.getGpsRaw().isEmpty()) {
|
||||||
|
throw BusinessException.badRequest("EMPTY_GPS_INFO", "GPS 정보가 없습니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.kri.gwcf.review.back.dto.user.UserFullDto;
|
|||||||
import com.kri.gwcf.review.back.persistence.entity.TSysEventLogEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TSysEventLogEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.SysEventLogRepository;
|
import com.kri.gwcf.review.back.persistence.repository.SysEventLogRepository;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -118,15 +119,215 @@ public class SystemEventLogService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeAssignConfirmLog(String userId, LocalDateTime regDt, String clientIp) {
|
public void writeAssignConfirmLog(String userId, LocalDateTime regDt, String clientIp, String performanceId) {
|
||||||
writeSystemLog(
|
writeSystemLog(
|
||||||
SystemEventType.ASSIGN_PERFORMANCE_CONFIRM,
|
SystemEventType.ASSIGN_PERFORMANCE_CONFIRM,
|
||||||
"Assign Confirm",
|
"Assign Confirm",
|
||||||
userId,
|
userId,
|
||||||
regDt,
|
regDt,
|
||||||
clientIp,
|
clientIp,
|
||||||
"userId",
|
"performanceId",
|
||||||
userId
|
performanceId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeAssignRejectLog(String userId, LocalDateTime regDt, String clientIp, String performanceId) {
|
||||||
|
writeSystemLog(
|
||||||
|
SystemEventType.ASSIGN_PERFORMANCE_REJECT,
|
||||||
|
"Assign Reject",
|
||||||
|
userId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
"performanceId",
|
||||||
|
performanceId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeVisitStartLog(String regId, LocalDateTime regDt, String clientIp, Integer performanceId) {
|
||||||
|
writeSystemLog(
|
||||||
|
SystemEventType.VISIT_START,
|
||||||
|
"Visit Start",
|
||||||
|
regId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
"performanceId",
|
||||||
|
performanceId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeVisitEndLog(
|
||||||
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
|
String clientIp,
|
||||||
|
Integer performanceId,
|
||||||
|
Integer evidenceFileCount
|
||||||
|
) {
|
||||||
|
saveLog(
|
||||||
|
SystemEventType.VISIT_END,
|
||||||
|
"Visit End",
|
||||||
|
regId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
Map.of(
|
||||||
|
"performanceId", performanceId,
|
||||||
|
"evidenceFileCount", evidenceFileCount
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeVisitResetLog(
|
||||||
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
|
String clientIp,
|
||||||
|
Integer performanceId,
|
||||||
|
String userId
|
||||||
|
) {
|
||||||
|
saveLog(
|
||||||
|
SystemEventType.VISIT_RESET,
|
||||||
|
"Visit Reset",
|
||||||
|
regId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
Map.of(
|
||||||
|
"performanceId", performanceId,
|
||||||
|
"userId", userId
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeStartWrittenReviewLog(
|
||||||
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
|
String clientIp,
|
||||||
|
Integer performanceId
|
||||||
|
) {
|
||||||
|
writeSystemLog(
|
||||||
|
SystemEventType.START_WRITTEN_REVIEW,
|
||||||
|
"Start Written Review",
|
||||||
|
regId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
"performanceId",
|
||||||
|
performanceId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeEndWrittenReviewLog(
|
||||||
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
|
String clientIp,
|
||||||
|
Integer performanceId
|
||||||
|
) {
|
||||||
|
writeSystemLog(
|
||||||
|
SystemEventType.END_WRITTEN_REVIEW,
|
||||||
|
"End Written Review",
|
||||||
|
regId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
"performanceId",
|
||||||
|
performanceId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeUploadReviewFileLog(
|
||||||
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
|
String clientIp,
|
||||||
|
Integer performanceId,
|
||||||
|
Integer reviewType,
|
||||||
|
UploadContentDto content
|
||||||
|
) {
|
||||||
|
SystemEventType eventType = Integer.valueOf(1).equals(reviewType)
|
||||||
|
? SystemEventType.UPLOAD_MONITORING_REVIEW
|
||||||
|
: SystemEventType.UPLOAD_LOCAL_GOV_REVIEW;
|
||||||
|
|
||||||
|
saveLog(
|
||||||
|
eventType,
|
||||||
|
"Upload Review File",
|
||||||
|
regId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
Map.of(
|
||||||
|
"performanceId", performanceId,
|
||||||
|
"reviewType", reviewType,
|
||||||
|
"file", content
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeAssignPerformanceRequestLog(
|
||||||
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
|
String clientIp,
|
||||||
|
Integer performanceId,
|
||||||
|
List<String> assignUsers
|
||||||
|
) {
|
||||||
|
saveLog(
|
||||||
|
SystemEventType.ASSIGN_PERFORMANCE_REQUEST,
|
||||||
|
"Assign Performance Request",
|
||||||
|
regId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
Map.of(
|
||||||
|
"performanceId", performanceId,
|
||||||
|
"assignUsers", assignUsers
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeAssignConfirmByAdminLog(
|
||||||
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
|
String clientIp,
|
||||||
|
Integer performanceId,
|
||||||
|
String assignUser
|
||||||
|
) {
|
||||||
|
saveLog(
|
||||||
|
SystemEventType.ASSIGN_PERFORMANCE_CONFIRM,
|
||||||
|
"Assign Confirm",
|
||||||
|
regId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
Map.of(
|
||||||
|
"performanceId", performanceId,
|
||||||
|
"assignUser", assignUser
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeUploadWrittenAssignLog(
|
||||||
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
|
String clientIp,
|
||||||
|
UploadContentDto content
|
||||||
|
) {
|
||||||
|
writeSystemLog(
|
||||||
|
SystemEventType.UPLOAD_WRITTEN_ASSIGN,
|
||||||
|
"Upload Written Assign",
|
||||||
|
regId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
content
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeAssignCancelLog(
|
||||||
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
|
String clientIp,
|
||||||
|
Integer performanceId,
|
||||||
|
String assignUser
|
||||||
|
) {
|
||||||
|
saveLog(
|
||||||
|
SystemEventType.ASSIGN_PERFORMANCE_CANCEL,
|
||||||
|
"Assign Cancel",
|
||||||
|
regId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
Map.of(
|
||||||
|
"performanceId", performanceId,
|
||||||
|
"assignUser", assignUser
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@@ -54,11 +56,20 @@ public abstract class AbstractFileService {
|
|||||||
String ext = extractExtension(original);
|
String ext = extractExtension(original);
|
||||||
|
|
||||||
String timestamp = DateTimeUtil.nowKstLocalDateTime()
|
String timestamp = DateTimeUtil.nowKstLocalDateTime()
|
||||||
.format(java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss"));
|
.format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss"));
|
||||||
|
|
||||||
return prefix + "_" + timestamp + "_" + baseName + ext;
|
return prefix + "_" + timestamp + "_" + baseName + ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String buildFileNameWithTime(MultipartFile file, LocalDateTime now) {
|
||||||
|
String original = Optional.ofNullable(file.getOriginalFilename()).orElse("file");
|
||||||
|
String baseName = extractBaseName(original);
|
||||||
|
String ext = extractExtension(original);
|
||||||
|
String timestamp = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd_hhmmss"));
|
||||||
|
|
||||||
|
return timestamp + "_" + baseName + ext;
|
||||||
|
}
|
||||||
|
|
||||||
protected Path createDirectories(Path dir) throws IOException {
|
protected Path createDirectories(Path dir) throws IOException {
|
||||||
return Files.createDirectories(dir.toAbsolutePath().normalize());
|
return Files.createDirectories(dir.toAbsolutePath().normalize());
|
||||||
}
|
}
|
||||||
@@ -92,6 +103,7 @@ public abstract class AbstractFileService {
|
|||||||
throw BusinessException.internalError("WRONG_DIRECTORY","잘못된 파일 경로입니다.");
|
throw BusinessException.internalError("WRONG_DIRECTORY","잘못된 파일 경로입니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Files.deleteIfExists(target);
|
||||||
file.transferTo(target.toFile());
|
file.transferTo(target.toFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,3 +5,10 @@ spring:
|
|||||||
username: prjct_gwcf
|
username: prjct_gwcf
|
||||||
password: gwcf#260608
|
password: gwcf#260608
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|
||||||
|
kon:
|
||||||
|
survey-type: TEST
|
||||||
|
|
||||||
|
kri:
|
||||||
|
file:
|
||||||
|
pdf-converter-command: /usr/bin/soffice
|
||||||
|
|||||||
@@ -23,3 +23,10 @@ logging:
|
|||||||
#org.hibernate.orm.jdbc.bind: TRACE
|
#org.hibernate.orm.jdbc.bind: TRACE
|
||||||
#org.hibernate.orm.jdbc.extract: TRACE
|
#org.hibernate.orm.jdbc.extract: TRACE
|
||||||
org.hibernate.engine.jdbc.batch.internal: DEBUG
|
org.hibernate.engine.jdbc.batch.internal: DEBUG
|
||||||
|
|
||||||
|
kon:
|
||||||
|
survey-type: TEST
|
||||||
|
|
||||||
|
kri:
|
||||||
|
file:
|
||||||
|
pdf-converter-command: "C:/Program Files/LibreOffice/program/soffice.exe"
|
||||||
|
|||||||
@@ -5,3 +5,10 @@ spring:
|
|||||||
username: prjct_gwcf
|
username: prjct_gwcf
|
||||||
password: gwcf#260608
|
password: gwcf#260608
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|
||||||
|
kon:
|
||||||
|
survey-type: BANNER
|
||||||
|
|
||||||
|
kri:
|
||||||
|
file:
|
||||||
|
pdf-converter-command: /usr/bin/soffice
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ server:
|
|||||||
port: 6105
|
port: 6105
|
||||||
forward-headers-strategy: framework
|
forward-headers-strategy: framework
|
||||||
tomcat:
|
tomcat:
|
||||||
max-http-form-post-size: 100MB
|
max-http-form-post-size: 500MB
|
||||||
max-swallow-size: -1
|
max-swallow-size: -1
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
@@ -22,8 +22,8 @@ spring:
|
|||||||
|
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
max-file-size: 100MB
|
max-file-size: 500MB
|
||||||
max-request-size: 100MB
|
max-request-size: 500MB
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
@@ -52,8 +52,13 @@ kri:
|
|||||||
- /ping
|
- /ping
|
||||||
- /api/v1/auth/login
|
- /api/v1/auth/login
|
||||||
- /api/v1/admin-cache/**
|
- /api/v1/admin-cache/**
|
||||||
- /api/v1/assign/confirm/*
|
- /api/v1/assign/confirm/*/*
|
||||||
|
- /api/v1/assign/reject/*/*
|
||||||
- /api/v1/performance/list/compact
|
- /api/v1/performance/list/compact
|
||||||
|
- /api/v1/performance/list
|
||||||
|
- /api/v1/review/start/**
|
||||||
|
- /api/v1/review/end/**
|
||||||
|
- /api/v1/code/*
|
||||||
|
|
||||||
swagger:
|
swagger:
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -67,6 +72,8 @@ kri:
|
|||||||
file:
|
file:
|
||||||
visit-base-dir: ./upload-file/visit
|
visit-base-dir: ./upload-file/visit
|
||||||
review-base-dir: ./upload-file/review
|
review-base-dir: ./upload-file/review
|
||||||
|
review-template-base-dir: ./upload-file/review-template
|
||||||
|
pdf-converter-command: soffice
|
||||||
|
|
||||||
web:
|
web:
|
||||||
enabled: true # 공통 Web 구성 사용 여부 (기본 true)
|
enabled: true # 공통 Web 구성 사용 여부 (기본 true)
|
||||||
|
|||||||
42
src/main/resources/mybatis/mapper/kon/KonMapper.xml
Normal file
42
src/main/resources/mybatis/mapper/kon/KonMapper.xml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.kri.gwcf.review.back.persistence.mapper.kon.KonMapper">
|
||||||
|
|
||||||
|
<sql id="BaseDataSelect">
|
||||||
|
SELECT DISTINCT
|
||||||
|
JSON_VALUE(DJ.[VALUE], '$.SC') AS IDKEY,
|
||||||
|
DV.[value] AS performance_id
|
||||||
|
FROM [DATA] DA WITH(NOLOCK)
|
||||||
|
CROSS APPLY OPENJSON([DATJSON]) DJ
|
||||||
|
CROSS APPLY OPENJSON(DJ.[value]) DV
|
||||||
|
WHERE PKEY = '2605013_B'
|
||||||
|
AND [Status] = 10
|
||||||
|
AND JSON_VALUE(DJ.[VALUE], '$.SC') IS NOT NULL
|
||||||
|
AND JSON_VALUE(DJ.[VALUE], '$.SC') != ''
|
||||||
|
AND DV.[KEY] LIKE 'Q1%'
|
||||||
|
AND [SURVEY_TYPE] = #{surveyType}
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="findPerformanceApplyCount" resultType="PerformanceApplyCountDto">
|
||||||
|
WITH Base AS (
|
||||||
|
<include refid="BaseDataSelect"/>
|
||||||
|
)
|
||||||
|
SELECT performance_id, COUNT(1) AS apply_cnt
|
||||||
|
FROM Base
|
||||||
|
GROUP BY performance_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findPerformanceApplyUser" resultType="PerformanceApplyUserDto">
|
||||||
|
WITH Base AS (
|
||||||
|
<include refid="BaseDataSelect"/>
|
||||||
|
)
|
||||||
|
SELECT performance_id, IDKEY AS user_id
|
||||||
|
FROM Base
|
||||||
|
WHERE performance_id = #{performanceId}
|
||||||
|
GROUP BY performance_id, IDKEY
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user