From 080e74ab6f7626c32112d7cd2ef18382440c38f8 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Tue, 9 Dec 2025 11:51:25 +0900 Subject: [PATCH] first commit --- .gitignore | 37 + IssueRecode.txt | 3 + README.md | 20 + build.gradle | 68 ++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 63375 bytes gradle/wrapper/gradle-wrapper.properties | 7 + gradlew | 248 ++++++ gradlew.bat | 92 ++ settings.gradle | 1 + .../IpAccessControlInterceptor.java | 27 + .../com/krt/newssak/NewssakApplication.java | 30 + .../krt/newssak/config/QueryDslConfig.java | 21 + .../krt/newssak/config/SecurityConfig.java | 70 ++ .../com/krt/newssak/config/SwaggerConfig.java | 47 + .../com/krt/newssak/config/WebConfig.java | 35 + .../krt/newssak/config/WebSocketConfig.java | 44 + .../newssak/controller/CapiController.java | 110 +++ .../controller/DataManageController.java | 69 ++ .../controller/HardCodeController.java | 38 + .../newssak/controller/KiwiController.java | 61 ++ .../newssak/controller/ListController.java | 97 +++ .../newssak/controller/MemberController.java | 47 + .../newssak/controller/ProjectController.java | 169 ++++ .../controller/QuestionController.java | 161 ++++ .../newssak/controller/QuotaController.java | 48 ++ .../controller/WebSocketController.java | 54 ++ .../autorecode/GetAutoRecodeRequestDto.java | 13 + .../autorecode/GetAutoRecodeResponseDto.java | 30 + .../autorecode/SaveAutoRecodeRequestDto.java | 18 + .../dto/capi/DeleteInterviewerRequestDto.java | 14 + .../dto/capi/DeleteSurveyDataRequestDto.java | 16 + .../capi/GetDeleteSurveyDataResponseDto.java | 17 + .../GetDeleteSurveyReqDataRequestDto.java | 12 + ...InterviewerAllocationStatusRequestDto.java | 12 + ...nterviewerAllocationStatusResponseDto.java | 24 + ...GetInterviewerAssignProjectRequestDto.java | 12 + .../capi/GetInterviewerAssignResponseDto.java | 23 + .../dto/capi/GetInterviewerResponseDto.java | 29 + .../GetInterviewerSurveyStatusRequestDto.java | 14 + ...GetInterviewerSurveyStatusResponseDto.java | 33 + .../dto/capi/GetSurveyDetailResponseDto.java | 30 + .../capi/GetSurveyStatusCountResponseDto.java | 41 + .../dto/capi/SaveAllocationRequestDto.java | 14 + .../SaveInterviewerAllocationRequestDto.java | 15 + .../dto/capi/SaveInterviewerRequestDto.java | 18 + .../SurveyDataDeleteAcceptRequestDto.java | 13 + .../newssak/dto/common/ErrorMessageDto.java | 12 + .../com/krt/newssak/dto/common/TokenInfo.java | 19 + .../newssak/dto/datamange/AnswerDataDto.java | 16 + .../dto/datamange/AnswerQuestionDto.java | 18 + .../dto/datamange/ChangeStatusRequestDto.java | 15 + .../dto/datamange/DeleteDataRequestDto.java | 18 + .../datamange/GetAnswerUserRequestDto.java | 12 + .../datamange/GetAnswerUserResponseDto.java | 18 + .../dto/datamange/GetDataRequestDto.java | 14 + .../dto/datamange/ModifyDataRequestDto.java | 19 + .../dto/datamange/SurveyDataStructureDto.java | 16 + .../dto/hardcode/HardCodeAndHistoryDto.java | 16 + .../krt/newssak/dto/hardcode/HardCodeDto.java | 34 + .../dto/hardcode/HardCodeHistoryDto.java | 42 + .../dto/hardcode/HardCodeRequestInfoDto.java | 14 + .../dto/kiwi/request/AllProjectCodeList.java | 14 + .../dto/kiwi/request/DelSurveyDataInfo.java | 14 + .../dto/kiwi/response/AllSurveyNotInKiwi.java | 14 + .../kiwi/response/GetResponseProjectInfo.java | 19 + .../dto/kiwi/response/exampleListByKpKey.java | 15 + .../dto/kiwi/response/surveyAnswerTime.java | 13 + .../dto/list/ListContentDeleteRequestDto.java | 14 + .../list/ListContentDetailSaveRequestDto.java | 31 + .../dto/list/ListContentGetRequestDto.java | 12 + .../dto/list/ListContentGetResponseDto.java | 34 + .../dto/list/ListContentModifyRequestDto.java | 16 + .../dto/list/ListContentSaveRequestDto.java | 15 + .../dto/list/ListDownloadGetRequestDto.java | 12 + .../dto/list/ListHeaderDeleteRequestDto.java | 14 + .../dto/list/ListHeaderGetRequestDto.java | 12 + .../dto/list/ListHeaderResponseDto.java | 29 + .../dto/list/ListHeaderSaveRequestDto.java | 29 + .../newssak/dto/member/CustomUserDetails.java | 52 ++ .../com/krt/newssak/dto/member/MemberDto.java | 40 + .../newssak/dto/member/MemberLoginDto.java | 21 + .../newssak/dto/member/MemberTeamInfoDto.java | 37 + .../newssak/dto/project/OptionElementDto.java | 34 + .../project/ProjectByAnswerIdByCountDto.java | 18 + .../project/ProjectByStatusByCountDto.java | 14 + .../dto/project/ProjectCopyRequestDto.java | 16 + .../newssak/dto/project/ProjectDeleteDto.java | 18 + .../krt/newssak/dto/project/ProjectDto.java | 45 + .../newssak/dto/project/ProjectInfoDto.java | 34 + .../newssak/dto/project/ProjectListDto.java | 26 + .../dto/project/ProjectManagerDto.java | 16 + .../newssak/dto/project/ProjectOptionDto.java | 21 + .../project/ProjectParameterDeleteDto.java | 18 + .../dto/project/ProjectParameterDto.java | 34 + .../dto/project/ProjectRedirectDeleteDto.java | 18 + .../dto/project/ProjectRedirectDto.java | 39 + .../newssak/dto/project/ProjectSearchDto.java | 18 + .../newssak/dto/project/ProjectStateDto.java | 21 + .../newssak/dto/project/ProjectStyleDto.java | 22 + .../newssak/dto/project/ProjectUpsertDto.java | 26 + .../dto/project/ProjectWithHashtagDto.java | 41 + .../QuestionBlockCollectResponseDto.java | 21 + .../QuestionBlockDeleteRequestDto.java | 13 + .../dto/question/QuestionBlockRequestDto.java | 21 + .../question/QuestionBlockResponseDto.java | 31 + .../newssak/dto/question/QuestionCopyDto.java | 24 + .../dto/question/QuestionDeleteDto.java | 21 + .../krt/newssak/dto/question/QuestionDto.java | 47 + .../dto/question/QuestionHardcodeDto.java | 18 + .../dto/question/QuestionLabelInfoDto.java | 29 + .../dto/question/QuestionLabelJsonDto.java | 18 + .../dto/question/QuestionLabelOptionDto.java | 15 + .../question/QuestionLabelRotationDto.java | 15 + .../dto/question/QuestionLogicDto.java | 28 + .../dto/question/QuestionLogicJsonDto.java | 13 + .../dto/question/QuestionOptionDto.java | 17 + .../question/QuestionOptionValueJsonDto.java | 14 + .../dto/question/QuestionOrderDto.java | 20 + .../dto/question/QuestionReorderDto.java | 21 + .../dto/question/QuestionUpsertDto.java | 32 + .../krt/newssak/dto/quota/QuotaCellDto.java | 35 + .../newssak/dto/quota/QuotaCellJsonDto.java | 12 + .../krt/newssak/dto/quota/QuotaDeleteDto.java | 16 + .../krt/newssak/dto/quota/QuotaListDto.java | 35 + .../krt/newssak/dto/quota/QuotaUpsertDto.java | 23 + .../dto/survey/SurveyRespondentDto.java | 31 + .../dto/websocket/QuestionSettingWSInfo.java | 33 + .../entity/autorecode/AutoRecodeEntity.java | 51 ++ .../entity/capi/InterviewerAssignEntity.java | 41 + .../capi/InterviewerDeleteRequestEntity.java | 50 ++ .../entity/capi/InterviewerInfoEntity.java | 54 ++ .../entity/hardcode/HardCodeEntity.java | 53 ++ .../hardcode/HardCodeHistoryEntity.java | 52 ++ .../entity/list/ListContentEntity.java | 40 + .../newssak/entity/list/ListHeaderEntity.java | 40 + .../newssak/entity/member/MemberEntity.java | 34 + .../member/MemberProjectManagerEntity.java | 28 + .../entity/member/MemberTeamInfoEntity.java | 34 + .../newssak/entity/project/ProjectEntity.java | 74 ++ .../entity/project/ProjectFileEntity.java | 42 + .../entity/project/ProjectHashtagEntity.java | 30 + .../project/ProjectParameterEntity.java | 45 + .../entity/project/ProjectRedirectEntity.java | 70 ++ .../entity/project/ProjectResponseEntity.java | 38 + .../entity/project/ProjectStyleEntity.java | 40 + .../question/QuestionBlockCollectEntity.java | 43 + .../entity/question/QuestionBlockEntity.java | 59 ++ .../question/QuestionBlockOptionEntity.java | 50 ++ .../entity/question/QuestionEntity.java | 87 ++ .../question/QuestionHardcodeEntity.java | 51 ++ .../QuestionHardcodeHistoryEntity.java | 51 ++ .../entity/question/QuestionLabelEntity.java | 46 + .../entity/question/QuestionLogicEntity.java | 51 ++ .../entity/question/QuestionOptionEntity.java | 50 ++ .../newssak/entity/quota/QuotaCellEntity.java | 51 ++ .../krt/newssak/entity/quota/QuotaEntity.java | 62 ++ .../entity/survey/SurveyDataEntity.java | 69 ++ .../entity/survey/SurveyRespondentEntity.java | 69 ++ .../entity_pk/hardcode/HardcodeEntityPK.java | 12 + .../project/ProjectFileEntityPK.java | 11 + .../project/ProjectParameterEntityPK.java | 11 + .../project/ProjectRedirectEntityPK.java | 11 + .../project/ProjectResponseEntityPK.java | 11 + .../project/ProjectStyleEntityPK.java | 11 + .../QuestionBlockCollectEntityPk.java | 18 + .../question/QuestionBlockEntityPk.java | 19 + .../entity_pk/question/QuestionEntityPK.java | 13 + .../question/QuestionLabelEntityPK.java | 11 + .../entity_pk/quota/QuotaEntityPK.java | 10 + .../entity_pk/survey/SurveyDataEntityPK.java | 12 + .../survey/SurveyRespondentEntityPK.java | 11 + .../newssak/enums/DefaultParameterEnum.java | 19 + .../newssak/enums/DefaultQuestionEnum.java | 27 + .../newssak/enums/DefaultRedirectEnum.java | 28 + .../newssak/enums/DefaultResponseEnum.java | 25 + .../newssak/enums/DefaultStyleOptionEnum.java | 29 + .../eventhandler/WebSocketEventListener.java | 63 ++ .../krt/newssak/exception/ApiException.java | 15 + .../newssak/exception/ApiExceptionAdvice.java | 21 + .../newssak/exception/ApiExceptionEntity.java | 21 + .../krt/newssak/exception/ExceptionEnum.java | 36 + .../newssak/jwt/JwtAuthenticationFilter.java | 50 ++ .../com/krt/newssak/jwt/JwtTokenProvider.java | 136 +++ .../autorecode/AutoRecodeRepository.java | 12 + .../repository/capi/CapiAssignRepository.java | 12 + .../repository/capi/CapiQueryRepository.java | 102 +++ .../repository/capi/CapiRepository.java | 10 + ...CapiSurveyDataDeleteRequestRepository.java | 8 + .../datamanage/DataManageRepository.java | 10 + .../hardcode/HardCodeHistoryRepository.java | 12 + .../hardcode/HardCodeRepository.java | 10 + .../repository/kiwi/KiwiQueryRepository.java | 205 +++++ .../list/ListContentRepository.java | 13 + .../repository/list/ListHeaderRepository.java | 13 + .../MemberProjectManagerRepository.java | 9 + .../repository/member/MemberRepository.java | 20 + .../project/ProjectFileRepository.java | 10 + .../project/ProjectHashTagRepository.java | 10 + .../project/ProjectParameterRepository.java | 14 + .../project/ProjectQueryRepository.java | 806 ++++++++++++++++++ .../project/ProjectRedirectRepository.java | 15 + .../repository/project/ProjectRepository.java | 17 + .../project/ProjectResponseRepository.java | 13 + .../project/ProjectStyleRepository.java | 13 + .../QuestionBlockCollectionRepository.java | 17 + .../QuestionBlockOptionRepository.java | 9 + .../question/QuestionBlockRepository.java | 17 + .../QuestionHardcodeHistoryRepository.java | 9 + .../question/QuestionHardcodeRepository.java | 9 + .../question/QuestionLabelRepository.java | 11 + .../question/QuestionLogicRepository.java | 12 + .../question/QuestionOptionRepository.java | 9 + .../question/QuestionQueryRepository.java | 242 ++++++ .../question/QuestionRepository.java | 26 + .../repository/quota/QuotaCellRepository.java | 11 + .../quota/QuotaQueryRepository.java | 24 + .../repository/quota/QuotaRepository.java | 15 + .../survey/SurveyDataRepository.java | 14 + .../survey/SurveyRespondentRepository.java | 14 + .../com/krt/newssak/service/CapiService.java | 235 +++++ .../service/CustomUserDetailsService.java | 46 + .../newssak/service/DataManageService.java | 39 + .../krt/newssak/service/HardCodeService.java | 64 ++ .../service/IpAccessControlService.java | 22 + .../com/krt/newssak/service/KiwiService.java | 63 ++ .../com/krt/newssak/service/ListService.java | 172 ++++ .../krt/newssak/service/MemberService.java | 67 ++ .../krt/newssak/service/ProjectService.java | 334 ++++++++ .../krt/newssak/service/QuestionService.java | 550 ++++++++++++ .../com/krt/newssak/service/QuotaService.java | 82 ++ .../krt/newssak/service/WebSocketService.java | 91 ++ .../java/com/krt/newssak/util/Common.java | 16 + .../java/com/krt/newssak/util/IpUtil.java | 56 ++ .../java/com/krt/newssak/util/RegexLabel.java | 136 +++ .../java/com/krt/newssak/util/RegexLogic.java | 152 ++++ .../com/krt/newssak/util/SecurityUtil.java | 64 ++ ...itional-spring-configuration-metadata.json | 9 + src/main/resources/application.properties | 41 + .../krt/newssak/NewssakApplicationTests.java | 13 + 239 files changed, 10035 insertions(+) create mode 100644 .gitignore create mode 100644 IssueRecode.txt create mode 100644 README.md create mode 100644 build.gradle create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle create mode 100644 src/main/java/com/krt/newssak/Interceptor/IpAccessControlInterceptor.java create mode 100644 src/main/java/com/krt/newssak/NewssakApplication.java create mode 100644 src/main/java/com/krt/newssak/config/QueryDslConfig.java create mode 100644 src/main/java/com/krt/newssak/config/SecurityConfig.java create mode 100644 src/main/java/com/krt/newssak/config/SwaggerConfig.java create mode 100644 src/main/java/com/krt/newssak/config/WebConfig.java create mode 100644 src/main/java/com/krt/newssak/config/WebSocketConfig.java create mode 100644 src/main/java/com/krt/newssak/controller/CapiController.java create mode 100644 src/main/java/com/krt/newssak/controller/DataManageController.java create mode 100644 src/main/java/com/krt/newssak/controller/HardCodeController.java create mode 100644 src/main/java/com/krt/newssak/controller/KiwiController.java create mode 100644 src/main/java/com/krt/newssak/controller/ListController.java create mode 100644 src/main/java/com/krt/newssak/controller/MemberController.java create mode 100644 src/main/java/com/krt/newssak/controller/ProjectController.java create mode 100644 src/main/java/com/krt/newssak/controller/QuestionController.java create mode 100644 src/main/java/com/krt/newssak/controller/QuotaController.java create mode 100644 src/main/java/com/krt/newssak/controller/WebSocketController.java create mode 100644 src/main/java/com/krt/newssak/dto/autorecode/GetAutoRecodeRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/autorecode/GetAutoRecodeResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/autorecode/SaveAutoRecodeRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/DeleteInterviewerRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/DeleteSurveyDataRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/GetDeleteSurveyDataResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/GetDeleteSurveyReqDataRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/GetInterviewerAllocationStatusRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/GetInterviewerAllocationStatusResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/GetInterviewerAssignProjectRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/GetInterviewerAssignResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/GetInterviewerResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/GetInterviewerSurveyStatusRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/GetInterviewerSurveyStatusResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/GetSurveyDetailResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/GetSurveyStatusCountResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/SaveAllocationRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/SaveInterviewerAllocationRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/SaveInterviewerRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/capi/SurveyDataDeleteAcceptRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/common/ErrorMessageDto.java create mode 100644 src/main/java/com/krt/newssak/dto/common/TokenInfo.java create mode 100644 src/main/java/com/krt/newssak/dto/datamange/AnswerDataDto.java create mode 100644 src/main/java/com/krt/newssak/dto/datamange/AnswerQuestionDto.java create mode 100644 src/main/java/com/krt/newssak/dto/datamange/ChangeStatusRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/datamange/DeleteDataRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/datamange/GetAnswerUserRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/datamange/GetAnswerUserResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/datamange/GetDataRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/datamange/ModifyDataRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/datamange/SurveyDataStructureDto.java create mode 100644 src/main/java/com/krt/newssak/dto/hardcode/HardCodeAndHistoryDto.java create mode 100644 src/main/java/com/krt/newssak/dto/hardcode/HardCodeDto.java create mode 100644 src/main/java/com/krt/newssak/dto/hardcode/HardCodeHistoryDto.java create mode 100644 src/main/java/com/krt/newssak/dto/hardcode/HardCodeRequestInfoDto.java create mode 100644 src/main/java/com/krt/newssak/dto/kiwi/request/AllProjectCodeList.java create mode 100644 src/main/java/com/krt/newssak/dto/kiwi/request/DelSurveyDataInfo.java create mode 100644 src/main/java/com/krt/newssak/dto/kiwi/response/AllSurveyNotInKiwi.java create mode 100644 src/main/java/com/krt/newssak/dto/kiwi/response/GetResponseProjectInfo.java create mode 100644 src/main/java/com/krt/newssak/dto/kiwi/response/exampleListByKpKey.java create mode 100644 src/main/java/com/krt/newssak/dto/kiwi/response/surveyAnswerTime.java create mode 100644 src/main/java/com/krt/newssak/dto/list/ListContentDeleteRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/list/ListContentDetailSaveRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/list/ListContentGetRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/list/ListContentGetResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/list/ListContentModifyRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/list/ListContentSaveRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/list/ListDownloadGetRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/list/ListHeaderDeleteRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/list/ListHeaderGetRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/list/ListHeaderResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/list/ListHeaderSaveRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/member/CustomUserDetails.java create mode 100644 src/main/java/com/krt/newssak/dto/member/MemberDto.java create mode 100644 src/main/java/com/krt/newssak/dto/member/MemberLoginDto.java create mode 100644 src/main/java/com/krt/newssak/dto/member/MemberTeamInfoDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/OptionElementDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectByAnswerIdByCountDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectByStatusByCountDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectCopyRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectDeleteDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectInfoDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectListDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectManagerDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectOptionDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectParameterDeleteDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectParameterDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectRedirectDeleteDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectRedirectDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectSearchDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectStateDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectStyleDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectUpsertDto.java create mode 100644 src/main/java/com/krt/newssak/dto/project/ProjectWithHashtagDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionBlockCollectResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionBlockDeleteRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionBlockRequestDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionBlockResponseDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionCopyDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionDeleteDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionHardcodeDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionLabelInfoDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionLabelJsonDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionLabelOptionDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionLabelRotationDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionLogicDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionLogicJsonDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionOptionDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionOptionValueJsonDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionOrderDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionReorderDto.java create mode 100644 src/main/java/com/krt/newssak/dto/question/QuestionUpsertDto.java create mode 100644 src/main/java/com/krt/newssak/dto/quota/QuotaCellDto.java create mode 100644 src/main/java/com/krt/newssak/dto/quota/QuotaCellJsonDto.java create mode 100644 src/main/java/com/krt/newssak/dto/quota/QuotaDeleteDto.java create mode 100644 src/main/java/com/krt/newssak/dto/quota/QuotaListDto.java create mode 100644 src/main/java/com/krt/newssak/dto/quota/QuotaUpsertDto.java create mode 100644 src/main/java/com/krt/newssak/dto/survey/SurveyRespondentDto.java create mode 100644 src/main/java/com/krt/newssak/dto/websocket/QuestionSettingWSInfo.java create mode 100644 src/main/java/com/krt/newssak/entity/autorecode/AutoRecodeEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/capi/InterviewerAssignEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/capi/InterviewerDeleteRequestEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/capi/InterviewerInfoEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/hardcode/HardCodeEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/hardcode/HardCodeHistoryEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/list/ListContentEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/list/ListHeaderEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/member/MemberEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/member/MemberProjectManagerEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/member/MemberTeamInfoEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/project/ProjectEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/project/ProjectFileEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/project/ProjectHashtagEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/project/ProjectParameterEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/project/ProjectRedirectEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/project/ProjectResponseEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/project/ProjectStyleEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/question/QuestionBlockCollectEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/question/QuestionBlockEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/question/QuestionBlockOptionEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/question/QuestionEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/question/QuestionHardcodeEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/question/QuestionHardcodeHistoryEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/question/QuestionLabelEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/question/QuestionLogicEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/question/QuestionOptionEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/quota/QuotaCellEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/quota/QuotaEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/survey/SurveyDataEntity.java create mode 100644 src/main/java/com/krt/newssak/entity/survey/SurveyRespondentEntity.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/hardcode/HardcodeEntityPK.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/project/ProjectFileEntityPK.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/project/ProjectParameterEntityPK.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/project/ProjectRedirectEntityPK.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/project/ProjectResponseEntityPK.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/project/ProjectStyleEntityPK.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/question/QuestionBlockCollectEntityPk.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/question/QuestionBlockEntityPk.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/question/QuestionEntityPK.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/question/QuestionLabelEntityPK.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/quota/QuotaEntityPK.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/survey/SurveyDataEntityPK.java create mode 100644 src/main/java/com/krt/newssak/entity_pk/survey/SurveyRespondentEntityPK.java create mode 100644 src/main/java/com/krt/newssak/enums/DefaultParameterEnum.java create mode 100644 src/main/java/com/krt/newssak/enums/DefaultQuestionEnum.java create mode 100644 src/main/java/com/krt/newssak/enums/DefaultRedirectEnum.java create mode 100644 src/main/java/com/krt/newssak/enums/DefaultResponseEnum.java create mode 100644 src/main/java/com/krt/newssak/enums/DefaultStyleOptionEnum.java create mode 100644 src/main/java/com/krt/newssak/eventhandler/WebSocketEventListener.java create mode 100644 src/main/java/com/krt/newssak/exception/ApiException.java create mode 100644 src/main/java/com/krt/newssak/exception/ApiExceptionAdvice.java create mode 100644 src/main/java/com/krt/newssak/exception/ApiExceptionEntity.java create mode 100644 src/main/java/com/krt/newssak/exception/ExceptionEnum.java create mode 100644 src/main/java/com/krt/newssak/jwt/JwtAuthenticationFilter.java create mode 100644 src/main/java/com/krt/newssak/jwt/JwtTokenProvider.java create mode 100644 src/main/java/com/krt/newssak/repository/autorecode/AutoRecodeRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/capi/CapiAssignRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/capi/CapiQueryRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/capi/CapiRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/capi/CapiSurveyDataDeleteRequestRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/datamanage/DataManageRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/hardcode/HardCodeHistoryRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/hardcode/HardCodeRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/kiwi/KiwiQueryRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/list/ListContentRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/list/ListHeaderRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/member/MemberProjectManagerRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/member/MemberRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/project/ProjectFileRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/project/ProjectHashTagRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/project/ProjectParameterRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/project/ProjectQueryRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/project/ProjectRedirectRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/project/ProjectRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/project/ProjectResponseRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/project/ProjectStyleRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/question/QuestionBlockCollectionRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/question/QuestionBlockOptionRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/question/QuestionBlockRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/question/QuestionHardcodeHistoryRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/question/QuestionHardcodeRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/question/QuestionLabelRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/question/QuestionLogicRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/question/QuestionOptionRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/question/QuestionQueryRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/question/QuestionRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/quota/QuotaCellRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/quota/QuotaQueryRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/quota/QuotaRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/survey/SurveyDataRepository.java create mode 100644 src/main/java/com/krt/newssak/repository/survey/SurveyRespondentRepository.java create mode 100644 src/main/java/com/krt/newssak/service/CapiService.java create mode 100644 src/main/java/com/krt/newssak/service/CustomUserDetailsService.java create mode 100644 src/main/java/com/krt/newssak/service/DataManageService.java create mode 100644 src/main/java/com/krt/newssak/service/HardCodeService.java create mode 100644 src/main/java/com/krt/newssak/service/IpAccessControlService.java create mode 100644 src/main/java/com/krt/newssak/service/KiwiService.java create mode 100644 src/main/java/com/krt/newssak/service/ListService.java create mode 100644 src/main/java/com/krt/newssak/service/MemberService.java create mode 100644 src/main/java/com/krt/newssak/service/ProjectService.java create mode 100644 src/main/java/com/krt/newssak/service/QuestionService.java create mode 100644 src/main/java/com/krt/newssak/service/QuotaService.java create mode 100644 src/main/java/com/krt/newssak/service/WebSocketService.java create mode 100644 src/main/java/com/krt/newssak/util/Common.java create mode 100644 src/main/java/com/krt/newssak/util/IpUtil.java create mode 100644 src/main/java/com/krt/newssak/util/RegexLabel.java create mode 100644 src/main/java/com/krt/newssak/util/RegexLogic.java create mode 100644 src/main/java/com/krt/newssak/util/SecurityUtil.java create mode 100644 src/main/resources/META-INF/additional-spring-configuration-metadata.json create mode 100644 src/main/resources/application.properties create mode 100644 src/test/java/com/krt/newssak/NewssakApplicationTests.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2065bc --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ diff --git a/IssueRecode.txt b/IssueRecode.txt new file mode 100644 index 0000000..f6f37fd --- /dev/null +++ b/IssueRecode.txt @@ -0,0 +1,3 @@ +Swagger 추가 시 404 에러 사항 + - Security 사용 시, Config파일에서 url 제외 시켜줘야 함 (antMatchers에서 requestMatcher로 변경됨) + - SpringBoot 3.x 버전 이상 사용 시, openapi gradle starter-webmvc-ui 붙은걸로 써야함. diff --git a/README.md b/README.md new file mode 100644 index 0000000..aad2b85 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +
+ + + +

✨ NEW SSAK TECH STACK ✨

+ + +
+ +
+ + + + + + + + + +
diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..9970fc9 --- /dev/null +++ b/build.gradle @@ -0,0 +1,68 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '3.1.2' + id 'io.spring.dependency-management' version '1.1.2' +} + +group = 'com.krt' +version = '0.0.1-SNAPSHOT' + +java { + sourceCompatibility = '17' +} + +configurations { + compileOnly { + extendsFrom annotationProcessor + } +} + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'org.springframework.boot:spring-boot-starter-web' + + //SpringBoot 3.x버전 이상에서는 gradle openapi starter-webmvc 붙은걸로 써야 함 + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' + + //jwt + implementation 'io.jsonwebtoken:jjwt-api:0.11.5' + implementation 'io.jsonwebtoken:jjwt-impl:0.11.5' + implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5' + + compileOnly 'org.projectlombok:lombok' + developmentOnly 'org.springframework.boot:spring-boot-devtools' + runtimeOnly 'com.mysql:mysql-connector-j' + annotationProcessor 'org.projectlombok:lombok' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.springframework.security:spring-security-test' + implementation 'com.google.code.gson:gson:2.10.1' + + // ⭐ Spring boot 3.x이상에서 QueryDsl 패키지를 정의하는 방법 + implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta' + annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta" + annotationProcessor "jakarta.annotation:jakarta.annotation-api" + annotationProcessor "jakarta.persistence:jakarta.persistence-api" + // -- QueryDSL --- + + //poi 엑셀 라이브러리 + implementation group: 'org.apache.poi', name: 'poi', version: '5.0.0' + implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '5.0.0' + + // -- WebSocket -- + implementation 'org.springframework.boot:spring-boot-starter-websocket' // 스프링에서 제공하는 웹소켓 +// implementation 'org.webjars:sockjs-client:1.1.2' // sockjs +// implementation 'org.webjars:stomp-websocket:2.3.3-1' // stomp +} + +tasks.named('test') { + useJUnitPlatform() +} + +clean { + delete file('src/main/generated') +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..033e24c4cdf41af1ab109bc7f253b2b887023340 GIT binary patch literal 63375 zcmb5VV{~QRw)Y#`wrv{~+qP{x72B%VwzFc}c2cp;N~)5ZbDrJayPv(!dGEd-##*zr z)#n-$y^sH|_dchh3@8{H5D*j;5D<{i*8l5IFJ|DjL!e)upfGNX(kojugZ3I`oH1PvW`wFW_ske0j@lB9bX zO;2)`y+|!@X(fZ1<2n!Qx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i9vUxa1Qtpi$buR*8cU zd4~lS1pT$L^!0=6qUKOpM+XPsy{f7W#1bjrEwaeN!Ik9(zySIT^pEHvHgJUneFN4) zk=k|$55(g8slmS|@+*4fr2urd3LwjIIZA**g+%l(SZNn4HwQ}y6o`vw>2&mR1X+&q zDa1Af0B;4rAMZMOlHbAqK|R_xuwJ7ANARtFE({-P2o{tJJR<>2KVp)ZK-M;)ejx zd*E~Mka<{OL7%CAhk4n|1qg?97-I!l0rOinjVi#arbgg4bi5;nY5oFL`UWtPk5&L#grSxv zE3!}=1px!ZTLT90aYc^s`~{VojjJml&<`@e41dFP+XU6D0AOkbn2rlI3>^LcqauG& zc$m3Z{!u8LvUrm^fT{qX5yD9{?r(CCiUdck%!T`KIZd2oQJz1joB&M(Teg_>;yS<2-5>BWfSPpG`Rt{!j6>kqMAvl^zk0JUEfy$HVJMkxP-GkwZuxL62me2#pj_5*ZIU zP~#C^OZLfl$HO)v;~~c&JHivn|1I9H5y_CDkt0JLLGKm(4*KLVhJ2jh2#vJuM6`b& zE==-lvME^Oj022xF&IV*? '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..93e3f59 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..2c3ca73 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'seed' diff --git a/src/main/java/com/krt/newssak/Interceptor/IpAccessControlInterceptor.java b/src/main/java/com/krt/newssak/Interceptor/IpAccessControlInterceptor.java new file mode 100644 index 0000000..8738167 --- /dev/null +++ b/src/main/java/com/krt/newssak/Interceptor/IpAccessControlInterceptor.java @@ -0,0 +1,27 @@ +package com.krt.newssak.Interceptor; + +import com.krt.newssak.service.IpAccessControlService; +import com.krt.newssak.util.IpUtil; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; + +@RequiredArgsConstructor +@Component +public class IpAccessControlInterceptor implements HandlerInterceptor { + private final IpAccessControlService ipAccessControlService; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + System.out.println(IpUtil.getClientIp(request)); + String clientIpAddress = IpUtil.getClientIp(request); // 추가 + if (!ipAccessControlService.isAccessible(clientIpAddress)) { + String requestURI = request.getRequestURI(); + response.sendError(HttpServletResponse.SC_FORBIDDEN); + return false; + } + return true; + } +} diff --git a/src/main/java/com/krt/newssak/NewssakApplication.java b/src/main/java/com/krt/newssak/NewssakApplication.java new file mode 100644 index 0000000..af1fe39 --- /dev/null +++ b/src/main/java/com/krt/newssak/NewssakApplication.java @@ -0,0 +1,30 @@ +package com.krt.newssak; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.web.filter.HiddenHttpMethodFilter; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +//(exclude = SecurityAutoConfiguration.class) +@SpringBootApplication +public class NewssakApplication { + public static void main(String[] args) { + SpringApplication.run(NewssakApplication.class, args); + } + @Bean + public HiddenHttpMethodFilter hiddenHttpMethodFilter() { + return new HiddenHttpMethodFilter(); + } +// @Bean +// public WebMvcConfigurer corsConfigurer() { +// return new WebMvcConfigurer() { +// @Override +// public void addCorsMappings(CorsRegistry registry) { +// registry.addMapping("/**").allowedOrigins("*"); +// } +// }; +// } +} diff --git a/src/main/java/com/krt/newssak/config/QueryDslConfig.java b/src/main/java/com/krt/newssak/config/QueryDslConfig.java new file mode 100644 index 0000000..3746433 --- /dev/null +++ b/src/main/java/com/krt/newssak/config/QueryDslConfig.java @@ -0,0 +1,21 @@ +package com.krt.newssak.config; + +import com.querydsl.jpa.impl.JPAQueryFactory; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; + +@EnableJpaAuditing +@Configuration +public class QueryDslConfig { + + @PersistenceContext + private EntityManager entityManager; + + @Bean + public JPAQueryFactory jpaQueryFactory() { + return new JPAQueryFactory(this.entityManager); + } +} diff --git a/src/main/java/com/krt/newssak/config/SecurityConfig.java b/src/main/java/com/krt/newssak/config/SecurityConfig.java new file mode 100644 index 0000000..2b714af --- /dev/null +++ b/src/main/java/com/krt/newssak/config/SecurityConfig.java @@ -0,0 +1,70 @@ +package com.krt.newssak.config; + +import com.krt.newssak.jwt.JwtAuthenticationFilter; +import com.krt.newssak.jwt.JwtTokenProvider; +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.Customizer; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.config.annotation.web.configurers.HttpBasicConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.crypto.factory.PasswordEncoderFactories; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +@Configuration +@EnableWebSecurity +@RequiredArgsConstructor +public class SecurityConfig { + + private final JwtTokenProvider jwtTokenProvider; + + @Bean + public WebSecurityCustomizer webSecurityCustomizer() { + return (web) -> web.ignoring().requestMatchers("/v2/api-docs", "/v3/api-docs/**", "/configuration/ui", + "/swagger-resources/**", "/configuration/security", + "/swagger-ui/**", "/webjars/**","/swagger/**"); + } + + @Bean + public PasswordEncoder passwordEncoder() { + return PasswordEncoderFactories.createDelegatingPasswordEncoder(); + } + + + //Security 6 이상은 꼭 커스텀해야함. 이전에 쓰던 코드들은 스프링 시큐리티 지원 중단됨. + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http + .httpBasic(HttpBasicConfigurer::disable) + .csrf(AbstractHttpConfigurer::disable) + .cors(Customizer.withDefaults()) + .sessionManagement((sessionManagement) -> + sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS) + ) + .authorizeHttpRequests((authorizeRequests) -> + authorizeRequests.requestMatchers("api/v1/member/login","files/**","ws/api/**","api/v1/list/downloadList","api/v1/kiwi/**").permitAll() + .anyRequest().authenticated() + ) + .addFilterBefore(new JwtAuthenticationFilter(jwtTokenProvider), UsernamePasswordAuthenticationFilter.class); + return http.build(); + } + +// @Bean +// public CorsConfigurationSource corsConfigurationSource() { +// CorsConfiguration configuration = new CorsConfiguration(); +// configuration.setAllowedOrigins(Arrays.asList("*")); +// configuration.setAllowedMethods(Arrays.asList("*")); +// configuration.setAllowedHeaders(Arrays.asList("Authorization", "Cache-Control", "Content-Type")); +// configuration.setAllowCredentials(true); +// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); +// source.registerCorsConfiguration("/**", configuration); +// return source; +// } + +} diff --git a/src/main/java/com/krt/newssak/config/SwaggerConfig.java b/src/main/java/com/krt/newssak/config/SwaggerConfig.java new file mode 100644 index 0000000..18bc93f --- /dev/null +++ b/src/main/java/com/krt/newssak/config/SwaggerConfig.java @@ -0,0 +1,47 @@ +package com.krt.newssak.config; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; +import io.swagger.v3.oas.models.servers.Server; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.context.SecurityContext; + +import java.util.ArrayList; +import java.util.Arrays; + +//http://localhost:7000/swagger-ui/index.html +@Configuration +public class SwaggerConfig { + + + @Bean + public OpenAPI newSsakOpenAPI() { + Info info = new Info() + .version("v1.0.0") + .title("새싹 씨앗 API") + .description("새싹 구동을 위한 세팅과 관련된 API"); + + // SecuritySecheme명 + String jwtSchemeName = "jwtAuth"; + // API 요청헤더에 인증정보 포함 + SecurityRequirement securityRequirement = new SecurityRequirement().addList(jwtSchemeName); + // SecuritySchemes 등록 + Components components = new Components() + .addSecuritySchemes(jwtSchemeName, new SecurityScheme() + .name(jwtSchemeName) + .type(SecurityScheme.Type.HTTP) // HTTP 방식 + .scheme("bearer") + .bearerFormat("JWT")); // 토큰 형식을 지정하는 임의의 문자(Optional) + + return new OpenAPI() + .info(info) + .addServersItem(new Server().url("/")) + .addSecurityItem(securityRequirement) + .components(components); + } +} diff --git a/src/main/java/com/krt/newssak/config/WebConfig.java b/src/main/java/com/krt/newssak/config/WebConfig.java new file mode 100644 index 0000000..16ec86c --- /dev/null +++ b/src/main/java/com/krt/newssak/config/WebConfig.java @@ -0,0 +1,35 @@ +package com.krt.newssak.config; + +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import com.krt.newssak.Interceptor.IpAccessControlInterceptor; + +@Configuration +@EnableWebMvc +@RequiredArgsConstructor +public class WebConfig implements WebMvcConfigurer { + private final IpAccessControlInterceptor ipAccessControlInterceptor; + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOriginPatterns("*") + .allowedMethods("*") + .allowedHeaders("*") + .allowCredentials(true) + .maxAge(3000); + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + + registry.addInterceptor(ipAccessControlInterceptor) + .order(1) + .addPathPatterns("/swagger-ui/**", "/v3/api-docs/**"); + } +} diff --git a/src/main/java/com/krt/newssak/config/WebSocketConfig.java b/src/main/java/com/krt/newssak/config/WebSocketConfig.java new file mode 100644 index 0000000..095ab4e --- /dev/null +++ b/src/main/java/com/krt/newssak/config/WebSocketConfig.java @@ -0,0 +1,44 @@ +package com.krt.newssak.config; + +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.messaging.simp.config.MessageBrokerRegistry; +import org.springframework.scheduling.TaskScheduler; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; +import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; +import org.springframework.web.socket.config.annotation.StompEndpointRegistry; +import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; + +@Configuration +@EnableWebSocketMessageBroker +@RequiredArgsConstructor +public class WebSocketConfig implements WebSocketMessageBrokerConfigurer{ + @Override + public void registerStompEndpoints(StompEndpointRegistry registry) { + //웹소켓 연결 URL + registry.addEndpoint("/ws/api") + .setAllowedOriginPatterns("*") + .withSockJS(); + } + + @Override + public void configureMessageBroker(MessageBrokerRegistry registry) { + //구독자들에게 보낼 URL + registry.setApplicationDestinationPrefixes("/pub") + //서버로 보낼 URL + .enableSimpleBroker("/sub") + //.setHeartbeatValue(new long[]{10000, 20000}) + //.setTaskScheduler(heartBeatScheduler()) + ; + } + + @Bean + public TaskScheduler heartBeatScheduler(){ + ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); + scheduler.setPoolSize(1); + scheduler.setThreadNamePrefix("websocket-heartbeat-thread-"); + scheduler.initialize(); + return scheduler; + } +} diff --git a/src/main/java/com/krt/newssak/controller/CapiController.java b/src/main/java/com/krt/newssak/controller/CapiController.java new file mode 100644 index 0000000..34bcbb5 --- /dev/null +++ b/src/main/java/com/krt/newssak/controller/CapiController.java @@ -0,0 +1,110 @@ +package com.krt.newssak.controller; + +import com.krt.newssak.dto.capi.*; +import com.krt.newssak.dto.project.ProjectDto; +import com.krt.newssak.service.CapiService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; + +@Tag(name = "CAPI", description = "면접원 API") +@RestController +@RequestMapping("api/v1/capi") +@RequiredArgsConstructor +public class CapiController { + + private final CapiService capiService; + + @Operation(summary = "프로젝트 리스트 불러오기", description = "프로젝트 리스트 불러오기") + @PostMapping("/getProjectList") + public ResponseEntity getProjectList(){ + + List projectDtoList = capiService.getProjectList(); + + return ResponseEntity.ok(projectDtoList); + } + + @Operation(summary = "면접원 저장 및 수정", description = "면접원 저장 및 수정") + @PostMapping("/saveInterviewer") + public ResponseEntity saveInterviewer(@RequestBody List saveInterviewerRequestDtos) throws Exception { + + capiService.saveInterviewer(saveInterviewerRequestDtos); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "면접원 리스트 불러오기", description = "면접원 리스트 불러오기") + @PostMapping("/getInterviewers") + public ResponseEntity saveInterviewer() throws Exception { + + return ResponseEntity.ok(capiService.getInterviewers()); + } + + @Operation(summary = "면접원 리스트 삭제하기", description = "면접원 리스트 삭제하기") + @PostMapping("/deleteInterviewers") + public ResponseEntity deleteInterviewers(@RequestBody DeleteInterviewerRequestDto deleteInterviewerRequestDto) throws Exception { + + capiService.deleteInterviewer(deleteInterviewerRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "면접원 배정 현황", description = "면접원 배정 현황") + @PostMapping("/getInterviewerAllocationStatus") + public ResponseEntity getInterviewerAllocationStatus(@RequestBody GetInterviewerAllocationStatusRequestDto getInterviewerAllocationStatusRequestDto) throws Exception { + + Map allocationStatusList = capiService.getInterviewerAllocationStatus(getInterviewerAllocationStatusRequestDto); + + return ResponseEntity.ok(allocationStatusList); + } + + @Operation(summary = "면접원 배정 저장", description = "면접원 배정 저장") + @PostMapping("/saveInterviewerAllocation") + public ResponseEntity saveInterviewerAllocation(@RequestBody SaveInterviewerAllocationRequestDto saveInterviewerAllocationRequestDto) throws Exception { + + capiService.saveInterviewerAllocation(saveInterviewerAllocationRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "면접원 현황", description = "면접원 현황") + @PostMapping("/getInterviewerSurveyStatus") + public ResponseEntity getInterviewerSurveyStatus(@RequestBody GetInterviewerSurveyStatusRequestDto getInterviewerSurveyStatusRequestDto) throws Exception { + + return ResponseEntity.ok(capiService.getInterviewerSurveyStatus(getInterviewerSurveyStatusRequestDto)); + } + + @Operation(summary = "면접원 데이터 삭제 요청 리스트 조회", description = "면접원 데이터 삭제 요청 리스트 조회") + @PostMapping("/surveyDataDeleteRequest") + public ResponseEntity getSurveyDataDeleteRequestList(@RequestBody GetDeleteSurveyReqDataRequestDto getDeleteSurveyReqDataRequestDto) throws Exception { + + return ResponseEntity.ok(capiService.getSurveyDataDeleteRequestList(getDeleteSurveyReqDataRequestDto)); + } + + @Operation(summary = "면접원 데이터 삭제 요청 승인", description = "면접원 데이터 삭제 요청 승인") + @PostMapping("/surveyDataDeleteAccept") + public ResponseEntity surveyDataDeleteAccept(@RequestBody SurveyDataDeleteAcceptRequestDto surveyDataDeleteAcceptRequestDto) throws Exception { + + capiService.surveyDataDeleteAccept(surveyDataDeleteAcceptRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "면접원 리스트 다운로드", description = "면접원 리스트 다운로드") + @PostMapping("/interviewerDownloadList") + public ResponseEntity interviewerDownloadList(HttpServletResponse response, @RequestBody GetInterviewerSurveyStatusRequestDto listDownloadGetRequestDto) throws Exception { + + capiService.interviewerDownloadList(response, listDownloadGetRequestDto); + + return ResponseEntity.ok(true); + } +} diff --git a/src/main/java/com/krt/newssak/controller/DataManageController.java b/src/main/java/com/krt/newssak/controller/DataManageController.java new file mode 100644 index 0000000..6612861 --- /dev/null +++ b/src/main/java/com/krt/newssak/controller/DataManageController.java @@ -0,0 +1,69 @@ +package com.krt.newssak.controller; + +import com.krt.newssak.dto.datamange.*; +import com.krt.newssak.service.DataManageService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Tag(name = "DataManage", description = "데이터관리 API") +@RestController +@RequestMapping("api/v1/dataManage") +@RequiredArgsConstructor +public class DataManageController { + + private final DataManageService dataManageService; + + @Operation(summary = "데이터 조회") + @PostMapping("/getData") + public ResponseEntity getData(@RequestBody GetDataRequestDto getDataRequestDto) throws Exception { + + List answerQuestionDtoList = dataManageService.getAllData(getDataRequestDto); + + return ResponseEntity.ok(answerQuestionDtoList); + } + + @Operation(summary = "데이터 수정") + @PostMapping("/modifyData") + public ResponseEntity modifyData(@RequestBody ModifyDataRequestDto modifyDataRequestDto) throws Exception { + + long result = dataManageService.modifyData(modifyDataRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "데이터 삭제") + @PostMapping("/deleteData") + public ResponseEntity deleteData(@RequestBody DeleteDataRequestDto deleteDataRequestDto) throws Exception { + + long result = dataManageService.deleteData(deleteDataRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "응답자 목록 조회") + @PostMapping("/getAnswerUser") + public ResponseEntity getAnswerUser(@RequestBody GetAnswerUserRequestDto getAnswerUserRequestDto) throws Exception { + + List getAnswerUserResponseDtoList = dataManageService.getAnswerUser(getAnswerUserRequestDto); + + return ResponseEntity.ok(getAnswerUserResponseDtoList); + } + + @Operation(summary = "응답자 데이터 상태 변경") + @PostMapping("/changeAnswerStatus") + public ResponseEntity changeAnswerStatus(@RequestBody ChangeStatusRequestDto changeStatusRequestDto) throws Exception { + + long result = dataManageService.changeAnswerStatus(changeStatusRequestDto); + + return ResponseEntity.ok(true); + } + +} diff --git a/src/main/java/com/krt/newssak/controller/HardCodeController.java b/src/main/java/com/krt/newssak/controller/HardCodeController.java new file mode 100644 index 0000000..07df1d6 --- /dev/null +++ b/src/main/java/com/krt/newssak/controller/HardCodeController.java @@ -0,0 +1,38 @@ +package com.krt.newssak.controller; + +import com.krt.newssak.dto.hardcode.HardCodeAndHistoryDto; +import com.krt.newssak.dto.hardcode.HardCodeDto; +import com.krt.newssak.dto.hardcode.HardCodeRequestInfoDto; +import com.krt.newssak.service.HardCodeService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +@Tag(name = "HardCode", description = "하드코딩 API") +@RestController +@RequestMapping("api/v1/hardcode") +@RequiredArgsConstructor +public class HardCodeController { + + private final HardCodeService hardCodeService; + + @Operation(summary = "하드코딩 저장", description = "하드코딩과 히스토리 동시 저장") + @PostMapping("/saveHardCode") + public ResponseEntity saveHardCode(@RequestBody HardCodeDto hardCodeDto) throws Exception { + + hardCodeService.saveHardCode(hardCodeDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "하드코딩과 히스토리 가져오기") + @GetMapping("/getHardCode") + public ResponseEntity getHardCode(HardCodeRequestInfoDto hardCodeRequestInfoDto) throws Exception { + + HardCodeAndHistoryDto hardCodeAndHistoryDto = hardCodeService.getHardCode(hardCodeRequestInfoDto); + + return ResponseEntity.ok(hardCodeAndHistoryDto); + } +} diff --git a/src/main/java/com/krt/newssak/controller/KiwiController.java b/src/main/java/com/krt/newssak/controller/KiwiController.java new file mode 100644 index 0000000..2a522d9 --- /dev/null +++ b/src/main/java/com/krt/newssak/controller/KiwiController.java @@ -0,0 +1,61 @@ +package com.krt.newssak.controller; + +import com.krt.newssak.dto.kiwi.request.AllProjectCodeList; +import com.krt.newssak.dto.kiwi.request.DelSurveyDataInfo; +import com.krt.newssak.dto.kiwi.response.exampleListByKpKey; +import com.krt.newssak.service.KiwiService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Tag(name = "KIWI", description = "키위 연동 API") +@RestController +@RequestMapping("api/v1/kiwi") +@RequiredArgsConstructor +public class KiwiController { + + private final KiwiService kiwiService; + + @Operation(summary = "프로젝트 전체 조회", description = "새싹 설문 프로젝트 조회") + @PostMapping("/getAllProjectList") + public ResponseEntity getAllProjectList(AllProjectCodeList allProjectCodeList) throws Exception { + + return ResponseEntity.ok(kiwiService.getAllProjectList(allProjectCodeList)); + } + + @Operation(summary = "프로젝트 정보 조회", description = "프로젝트 정보 조회") + @PostMapping("/getProjectInfo") + public ResponseEntity getProjectInfo(String pkey) throws Exception { + + return ResponseEntity.ok(kiwiService.getProjectInfo(pkey)); + } + + @Operation(summary = "문항 전체 조회", description = "문항 전체 조회") + @PostMapping("/getAllQuestionList") + public ResponseEntity getAllQuestionList(String pkey) throws Exception { + List exampleListByKpKeyList = kiwiService.getAllQuestionList(pkey); + + return ResponseEntity.ok(exampleListByKpKeyList); + } + + @Operation(summary = "설문 진행 평균 소요 시간 조회", description = "설문 진행 평균 소요 시간 조회") + @PostMapping("/getSurveyAnswerAvgTime") + public ResponseEntity getSurveyAnswerAvgTime(String pkey) throws Exception { + + return ResponseEntity.ok(kiwiService.getSurveyAnswerAvgTime(pkey)); + } + + @Operation(summary = "회원 설문 참여 데이터 삭제", description = "회원 설문 참여 데이터 삭제") + @PostMapping("/delSurveyData") + public ResponseEntity delSurveyData(@RequestBody DelSurveyDataInfo delSurveyDataInfo) throws Exception { + + return ResponseEntity.ok(kiwiService.delSurveyData(delSurveyDataInfo)); + } +} diff --git a/src/main/java/com/krt/newssak/controller/ListController.java b/src/main/java/com/krt/newssak/controller/ListController.java new file mode 100644 index 0000000..1e8579d --- /dev/null +++ b/src/main/java/com/krt/newssak/controller/ListController.java @@ -0,0 +1,97 @@ +package com.krt.newssak.controller; + +import com.krt.newssak.dto.list.*; +import com.krt.newssak.service.ListService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Tag(name = "LIST", description = "리스트 관리 API") +@RestController +@RequestMapping("api/v1/list") +@RequiredArgsConstructor +public class ListController { + + private final ListService listService; + + @Operation(summary = "리스트 헤더 저장 및 수정", description = "리스트 헤더 저장 및 수정") + @PostMapping("/saveListHeader") + public ResponseEntity saveListHeader(@RequestBody ListHeaderSaveRequestDto listHeaderSaveRequestDto) throws Exception { + + listService.saveListHeader(listHeaderSaveRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "리스트 헤더 불러오기", description = "리스트 헤더 불러오기") + @PostMapping("/getListHeader") + public ResponseEntity getListHeader(@RequestBody ListHeaderGetRequestDto listHeaderGetRequestDto) throws Exception { + + List listHeaderResponseDtoList = listService.getListHeader(listHeaderGetRequestDto); + + return ResponseEntity.ok(listHeaderResponseDtoList); + } + + @Operation(summary = "리스트 헤더 삭제", description = "리스트 헤더 삭제") + @PostMapping("/deleteHeader") + public ResponseEntity deleteHeader(@RequestBody ListHeaderDeleteRequestDto listHeaderDeleteRequestDto) throws Exception { + + listService.deleteHeader(listHeaderDeleteRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "리스트 내용 저장", description = "리스트 내용 저장") + @PostMapping("/saveListContents") + public ResponseEntity saveListContents(@RequestBody ListContentSaveRequestDto listContentSaveRequestDto) throws Exception { + + listService.saveListContents(listContentSaveRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "리스트 내용 가져오기", description = "리스트 내용 가져오기") + @PostMapping("/getListContents") + public ResponseEntity getListContents(@RequestBody ListContentGetRequestDto listContentGetRequestDto) throws Exception { + + List listContentGetResponseDtoList = listService.getListContents(listContentGetRequestDto); + + return ResponseEntity.ok(listContentGetResponseDtoList); + } + + @Operation(summary = "리스트 내용 수정", description = "리스트 내용 수정") + @PostMapping("/modifyListContents") + public ResponseEntity modifyListContents(@RequestBody ListContentModifyRequestDto listContentModifyRequestDto) throws Exception { + + listService.modifyListContents(listContentModifyRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "리스트 내용 삭제", description = "리스트 내용 삭제") + @PostMapping("/deletesListContents") + public ResponseEntity deletesListContents(@RequestBody ListContentDeleteRequestDto listContentDeleteRequestDto) throws Exception { + + listService.deleteListContents(listContentDeleteRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "리스트 다운로드", description = "리스트 다운로드") + @PostMapping("/downloadList") + public ResponseEntity downloadList(HttpServletResponse response, @RequestBody ListDownloadGetRequestDto listDownloadGetRequestDto) throws Exception { + + listService.downloadList(response, listDownloadGetRequestDto); + + return ResponseEntity.ok(true); + } + +} diff --git a/src/main/java/com/krt/newssak/controller/MemberController.java b/src/main/java/com/krt/newssak/controller/MemberController.java new file mode 100644 index 0000000..ddff3f8 --- /dev/null +++ b/src/main/java/com/krt/newssak/controller/MemberController.java @@ -0,0 +1,47 @@ +package com.krt.newssak.controller; + +import com.krt.newssak.dto.common.TokenInfo; +import com.krt.newssak.dto.member.MemberDto; +import com.krt.newssak.dto.member.MemberLoginDto; +import com.krt.newssak.service.MemberService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.security.core.Authentication; +import org.springframework.web.bind.annotation.*; + +import java.security.Principal; +import java.util.LinkedHashMap; +import java.util.List; + +@Tag(name = "Member", description = "멤버 API") +@RestController +@RequestMapping("api/v1/member") +@RequiredArgsConstructor +public class MemberController { + + private final MemberService memberService; + + @Operation(summary = "Login 요청", description = "ID와 PW로 로그인 하는 API") + @PostMapping("/login") + public ResponseEntity login(@RequestBody MemberLoginDto memberLoginDto) { + TokenInfo tokenInfo = memberService.login(memberLoginDto.getId(), memberLoginDto.getPassword()); + return ResponseEntity.ok(tokenInfo); + } + + @GetMapping("/getInfo") + public ResponseEntity getInfo(Authentication authentication) { + LinkedHashMap details = (LinkedHashMap)authentication.getDetails(); + MemberDto member = memberService.getInfoWithDetails(details); + + return ResponseEntity.ok(member); + } + + @GetMapping("/getAllList") + public ResponseEntity getAllList(){ + List memberList = memberService.getAllList(); + + return ResponseEntity.ok(memberList); + } +} diff --git a/src/main/java/com/krt/newssak/controller/ProjectController.java b/src/main/java/com/krt/newssak/controller/ProjectController.java new file mode 100644 index 0000000..6f4dcf5 --- /dev/null +++ b/src/main/java/com/krt/newssak/controller/ProjectController.java @@ -0,0 +1,169 @@ +package com.krt.newssak.controller; + +import com.krt.newssak.dto.project.*; +import com.krt.newssak.service.ProjectService; +import com.krt.newssak.util.SecurityUtil; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.web.PageableDefault; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.net.URLEncoder; +import java.util.List; + +@Tag(name = "Project", description = "프로젝트 API") +@RestController +@RequestMapping("api/v1/project") +@RequiredArgsConstructor +public class ProjectController { + + private final ProjectService projectService; + + @Operation(summary = "PKEY 암호화") + @GetMapping("/skey") + public ResponseEntity getSkey(@Parameter(name = "project_code") String project_code) throws Exception { + String skey = URLEncoder.encode(SecurityUtil.encrypt(project_code), "UTF-8"); + return ResponseEntity.ok(skey); + } + + @Operation(summary = "프로젝트 리스트 불러오기") + @GetMapping("/getProjectList") + public ResponseEntity getProjectList(@ModelAttribute ProjectSearchDto projectSearchDto, + @PageableDefault(size = 6) Pageable pageable) { + + Page list = projectService.getProjectList(projectSearchDto, pageable); + + return ResponseEntity.ok(list); + } + + @Operation(summary = "프로젝트 파라미터 불러오기") + @GetMapping("/getParameter") + public ResponseEntity getProjectParameter(@Parameter(name = "project_code") String project_code){ + List projectParameterDto = projectService.getProjectParameter(project_code); + return ResponseEntity.ok(projectParameterDto); + } + + @Operation(summary = "프로젝트 리다이렉트 정보 불러오기") + @GetMapping("/getRedirect") + public ResponseEntity getProjectRedirect(@Parameter(name = "project_code") String project_code){ + List projectRedirectDto = projectService.getProjectRedirect(project_code); + return ResponseEntity.ok(projectRedirectDto); + } + + @Operation(summary = "프로젝트 중복 체크") + @GetMapping("/getDuplicate") + public ResponseEntity getDuplicate(@Parameter(name = "project_code") String project_code){ + int isDuplicate = projectService.checkDuplicateProjectCode(project_code); + return ResponseEntity.ok(isDuplicate); + } + + @Operation(summary = "프로젝트 등록 및 수정") + @PostMapping("/setProject") + public ResponseEntity upsertProject(@RequestBody ProjectUpsertDto projectUpsertDto){ + long upsertCount = projectService.upsertProject(projectUpsertDto); + + return ResponseEntity.ok(upsertCount); + } + + @Operation(summary = "프로젝트 상태값 변경") + @PostMapping("/setProjectState") + public ResponseEntity updateProjectState(@RequestBody ProjectStateDto projectStateDto){ + long updateCount = 0; + updateCount = projectService.updateProjectState(projectStateDto); + + return ResponseEntity.ok(updateCount); + } + + @Operation(summary = "특정 프로젝트 삭제") + @PostMapping("/deleteProject") + public ResponseEntity deleteProject(@RequestBody ProjectDeleteDto projectDeleteDto){ + long deleteCount = 0; + deleteCount = projectService.deleteProject(projectDeleteDto.getProject_code()); + + return ResponseEntity.ok(deleteCount); + } + + @Operation(summary = "프로젝트 파라미터 등록") + @PostMapping("/insertParameter") + public ResponseEntity insertProjectParameter(@RequestBody ProjectParameterDto projectParameterDto){ + boolean isInsert = projectService.insertProjectParameter(projectParameterDto); + return ResponseEntity.ok(isInsert); + } + + @Operation(summary = "프로젝트 파라미터 삭제") + @PostMapping("/deleteParameter") + public ResponseEntity deleteProjectParameter(@RequestBody ProjectParameterDeleteDto projectParameterDeleteDto){ + long deleteCount = projectService.deleteProjectParameter(projectParameterDeleteDto); + return ResponseEntity.ok(deleteCount); + } + + @Operation(summary = "프로젝트 리다이렉트 정보 등록 및 수정") + @PostMapping("/setRedirect") + public ResponseEntity upsertProjectRedirect(@RequestBody ProjectRedirectDto projectRedirectDto){ + boolean isInsert = projectService.upsertProjectRedirect(projectRedirectDto); + return ResponseEntity.ok(isInsert); + } + + @Operation(summary = "프로젝트 리다이렉트 정보 삭제") + @PostMapping("/deleteRedirect") + public ResponseEntity deleteProjectRedirect(@RequestBody ProjectRedirectDeleteDto projectRedirectDeleteDto){ + long deleteCount = projectService.deleteProjectRedirect(projectRedirectDeleteDto); + return ResponseEntity.ok(deleteCount); + } + + @Operation(summary = "프로젝트 정보 불러오기") + @GetMapping("/getProjectInfo") + public ResponseEntity getProjectInfo(@Parameter(name = "project_code") String project_code){ + ProjectInfoDto projectInfoDto = projectService.getProjectInfo(project_code); + return ResponseEntity.ok(projectInfoDto); + } + + @Operation(summary = "프로젝트 응답 옵션 불러오기") + @GetMapping("/getResponse") + public ResponseEntity getProjectResponse(@Parameter(name = "project_code") String project_code){ + ProjectOptionDto projectOptionDto = projectService.getProjectResponse(project_code); + return ResponseEntity.ok(projectOptionDto); + } + + @Operation(summary = "프로젝트 응답 옵션 수정") + @PostMapping("/setResponse") + public ResponseEntity upsertProjectResponse(@RequestBody ProjectOptionDto projectOptionDto){ + boolean isInsert = projectService.upsertProjectResponse(projectOptionDto); + return ResponseEntity.ok(isInsert); + } + + @Operation(summary = "프로젝트 스타일 불러오기") + @GetMapping("/getStyle") + public ResponseEntity getProjectStyle(@Parameter(name = "project_code") String project_code){ + ProjectOptionDto projectOptionDto = projectService.getProjectStyle(project_code); + return ResponseEntity.ok(projectOptionDto); + } + + @Operation(summary = "프로젝트 스타일 수정") + @PostMapping("/setStyle") + public ResponseEntity upsertProjectStyle(@RequestBody ProjectOptionDto projectOptionDto){ + boolean isInsert = projectService.upsertProjectStyle(projectOptionDto); + return ResponseEntity.ok(isInsert); + } + + @Operation(summary = "프로젝트 상태별 데이터 부수") + @GetMapping("/getStatusByCount") + public ResponseEntity getStatusByCount(@Parameter(name = "project_code") String project_code){ + + return ResponseEntity.ok(projectService.getStatusByCount(project_code)); + } + + @Operation(summary = "프로젝트 복사") + @PostMapping("/copyProject") + public ResponseEntity copyProject(@RequestBody ProjectCopyRequestDto projectCopyRequestDto) throws Exception { + + projectService.copyProject(projectCopyRequestDto); + + return ResponseEntity.ok(true); + } +} diff --git a/src/main/java/com/krt/newssak/controller/QuestionController.java b/src/main/java/com/krt/newssak/controller/QuestionController.java new file mode 100644 index 0000000..006ea28 --- /dev/null +++ b/src/main/java/com/krt/newssak/controller/QuestionController.java @@ -0,0 +1,161 @@ +package com.krt.newssak.controller; + +import com.krt.newssak.dto.autorecode.GetAutoRecodeRequestDto; +import com.krt.newssak.dto.autorecode.GetAutoRecodeResponseDto; +import com.krt.newssak.dto.autorecode.SaveAutoRecodeRequestDto; +import com.krt.newssak.dto.common.ErrorMessageDto; +import com.krt.newssak.dto.question.*; +import com.krt.newssak.service.QuestionService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Tag(name = "Question", description = "문항 API") +@RestController +@RequestMapping("api/v1/question") +@RequiredArgsConstructor +public class QuestionController { + private final QuestionService questionService; + + @Operation(summary = "문항ID 중복 체크") + @GetMapping("/getDuplicateQuestionID") + public ResponseEntity getDuplicateQuestionID( + @Parameter(name = "project_code") String project_code + , @Parameter(name = "question_unique_key") int question_unique_key + , @Parameter(name = "question_id") String question_id + ) { + boolean isDuplicate = questionService.getDuplicateQuestionID(project_code, question_unique_key, question_id); + + return ResponseEntity.ok(isDuplicate); + } + + @Operation(summary = "문항 정보 저장") + @PostMapping("/setQuestionInfo") + public ResponseEntity setQuestionInfo(@RequestBody QuestionUpsertDto questionUpsertDto) { + int upsertQuestionUniqueKey = questionService.upsertQuestion(questionUpsertDto); + + return ResponseEntity.ok(upsertQuestionUniqueKey); + } + + @Operation(summary = "문항 정보 삭제") + @PostMapping("/deleteQuestionInfo") + public ResponseEntity deleteQuestionInfo(@RequestBody QuestionDeleteDto questionDeleteDto) { + long deleteCount = questionService.deleteQuestion(questionDeleteDto); + + return ResponseEntity.ok(deleteCount); + } + + @Operation(summary = "문항 정보 복사") + @PostMapping("/copyQuestionInfo") + public ResponseEntity copyQuestionInfo(@RequestBody QuestionCopyDto questionCopyDto) { + long copyCount = questionService.copyQuestion(questionCopyDto); + + return ResponseEntity.ok(copyCount); + } + + @Operation(summary = "문항 순서 변경") + @PostMapping("/reorderQuestionInfo") + public ResponseEntity reorderQuestionInfo(@RequestBody QuestionReorderDto questionReorderDto) { + boolean isReorder = questionService.reorderQuestion(questionReorderDto); + + return ResponseEntity.ok(isReorder); + } + + @Operation(summary = "로직 정보 저장") + @PostMapping("/setQuestionLogic") + public ResponseEntity setQuestionLogic(@RequestBody QuestionLogicDto questionLogicDto){ + long upsertCount = questionService.upsertQuestionLogic(questionLogicDto); + + return ResponseEntity.ok(upsertCount); + } + + @Operation(summary = "로직 정보 가져오기") + @GetMapping("/getQuestionLogic") + public ResponseEntity getQuestionLogic(@Parameter(name = "project_code") String project_code, @Parameter(name = "question_unique_key") int question_unique_key){ + return ResponseEntity.ok(questionService.getQuestionLogic(project_code,question_unique_key)); + } + + @Operation(summary = "로직 구문 검증") + @PostMapping("/doLogicVerify") + public ResponseEntity logicVerify(@RequestBody QuestionLogicDto questionLogicDto) { + String projectCode = questionLogicDto.getProject_code(); + String logicPosition = ""; + int logicPointer = 0; + try { + logicPosition = "사전"; + logicPointer = 1; + List beforeLogicList = questionLogicDto.getBefore_logic(); + for(QuestionLogicJsonDto beforeLogic : beforeLogicList){ + questionService.logicVerify(projectCode, beforeLogic.getLogic()); + logicPointer++; + } + + logicPosition = "사후"; + logicPointer = 1; + List afterLogicList = questionLogicDto.getAfter_logic(); + for(QuestionLogicJsonDto afterLogic : afterLogicList) { + questionService.logicVerify(projectCode, afterLogic.getLogic()); + logicPointer++; + } + + return ResponseEntity.ok(true); + } + catch (Exception ex){ + HttpHeaders resHeaders = new HttpHeaders(); + resHeaders.add("Content-Type", "application/json;charset=UTF-8"); + return new ResponseEntity<>(new ErrorMessageDto(logicPosition + "로직의 " + logicPointer + "번째 로직 구문 오류"), resHeaders, HttpStatus.BAD_REQUEST); + } + } + + @Operation(summary = "블록 추가 및 수정") + @PostMapping("/setBlockQuestion") + public ResponseEntity setBlockQuestion(@RequestBody QuestionBlockRequestDto questionBlockRequestDto){ + + int result = questionService.setBlockQuestion(questionBlockRequestDto); + + return ResponseEntity.ok(result); + } + + @Operation(summary = "블록 가져오기") + @GetMapping("/getBlockQuestion") + public ResponseEntity getBlockQuestion(@Parameter(name = "project_code") String project_code){ + + List questionBlockList = questionService.getBlockQuestion(project_code); + + return ResponseEntity.ok(questionBlockList); + } + + @Operation(summary = "블록 삭제") + @PostMapping("/deleteBlockQuestion") + public ResponseEntity deleteBlockQuestion(@RequestBody QuestionBlockDeleteRequestDto questionBlockDeleteRequestDto){ + + int result = questionService.deleteBlockQuestion(questionBlockDeleteRequestDto); + + return ResponseEntity.ok(result); + } + + @Operation(summary = "오토리코드 저장 및 수정") + @PostMapping("/saveAutoRecode") + public ResponseEntity saveAutoRecode(@RequestBody List saveAutoRecodeRequestDto){ + + int result = questionService.saveAutoRecode(saveAutoRecodeRequestDto); + + return ResponseEntity.ok(result); + } + + @Operation(summary = "오토리코드 가져오기") + @PostMapping("/getAutoRecode") + public ResponseEntity getAutoRecode(@RequestBody GetAutoRecodeRequestDto GetAutoRecodeRequestDto){ + + List getAutoRecodeResponseDtoList = questionService.getAutoRecode(GetAutoRecodeRequestDto); + + return ResponseEntity.ok(getAutoRecodeResponseDtoList); + } +} diff --git a/src/main/java/com/krt/newssak/controller/QuotaController.java b/src/main/java/com/krt/newssak/controller/QuotaController.java new file mode 100644 index 0000000..90a2fc3 --- /dev/null +++ b/src/main/java/com/krt/newssak/controller/QuotaController.java @@ -0,0 +1,48 @@ +package com.krt.newssak.controller; + +import com.krt.newssak.dto.quota.QuotaDeleteDto; +import com.krt.newssak.dto.quota.QuotaListDto; +import com.krt.newssak.dto.quota.QuotaUpsertDto; +import com.krt.newssak.service.QuotaService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Tag(name = "Quota", description = "쿼터 API") +@RestController +@RequestMapping("api/v1/quota") +@RequiredArgsConstructor +public class QuotaController { + private final QuotaService quotaService; + @Operation(summary = "쿼터 정보 가져오기") + @GetMapping("/getQuotaInfo") + public ResponseEntity getQuotaList(@Parameter(name = "project_code") String project_code) { + return ResponseEntity.ok(quotaService.getQuotaList(project_code)); + } + + @Operation(summary = "쿼터 상세 정보 가져오기") + @GetMapping("/getQuotaCellInfo") + public ResponseEntity getQuotaCellInfo( + @Parameter(name = "project_code") String project_code + , @Parameter(name = "quota_code") int quota_code + ) { + return ResponseEntity.ok(quotaService.getQuotaInfo(project_code, quota_code)); + } + + @Operation(summary = "쿼터 정보 저장") + @PostMapping("/setQuotaInfo") + public ResponseEntity setQuotaInfo(@RequestBody QuotaUpsertDto quotaDto) { + return ResponseEntity.ok(quotaService.setQuota(quotaDto)); + } + + @Operation(summary = "쿼터 삭제") + @PostMapping("/deleteQuotaInfo") + public ResponseEntity deleteQuotaInfo(@RequestBody QuotaDeleteDto quotaDeleteDto) { + return ResponseEntity.ok(quotaService.deleteQuota(quotaDeleteDto)); + } +} diff --git a/src/main/java/com/krt/newssak/controller/WebSocketController.java b/src/main/java/com/krt/newssak/controller/WebSocketController.java new file mode 100644 index 0000000..73cb5f0 --- /dev/null +++ b/src/main/java/com/krt/newssak/controller/WebSocketController.java @@ -0,0 +1,54 @@ +package com.krt.newssak.controller; + +import com.krt.newssak.dto.websocket.QuestionSettingWSInfo; +import com.krt.newssak.service.WebSocketService; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.messaging.handler.annotation.DestinationVariable; +import org.springframework.messaging.handler.annotation.MessageMapping; +import org.springframework.messaging.simp.SimpMessagingTemplate; +import org.springframework.stereotype.Controller; + +import java.util.ArrayList; + +@Tag(name = "WebSocket", description = "웹소켓 API") +@Controller +@RequiredArgsConstructor +public class WebSocketController { + + private final SimpMessagingTemplate simpMessagingTemplate; + private final WebSocketService webSocketService; + + //방 구독 + @MessageMapping("/connection/{projectCode}") + public void connection(@DestinationVariable String projectCode) { + ArrayList setUserList = webSocketService.sessionGet(projectCode); +// System.out.println(setUserList + "<<<연결 리스트"); + + simpMessagingTemplate.convertAndSend("/sub/connection/" + projectCode, setUserList); + } + + @MessageMapping("/questionChange") + public void questionChange(QuestionSettingWSInfo questionSettingWSInfo) { + ArrayList setUserList = webSocketService.questionChange(questionSettingWSInfo); + +// System.out.println(setUserList + "<<<문항변경 리스트"); + + simpMessagingTemplate.convertAndSend("/sub/connection/" + questionSettingWSInfo.getProjectCode(), setUserList); + } + + @MessageMapping("/messageChange") + public void messageChange(QuestionSettingWSInfo questionSettingWSInfo) { + ArrayList setUserList = webSocketService.messageChange(questionSettingWSInfo); + +// System.out.println(setUserList + "<<<상태값 변경 리스트"); + + simpMessagingTemplate.convertAndSend("/sub/connection/" + questionSettingWSInfo.getProjectCode(), setUserList); + + webSocketService.listStatusReset(questionSettingWSInfo); + +// System.out.println(setUserList + "<<<상태값 변경 최종 리스트"); + } + + +} diff --git a/src/main/java/com/krt/newssak/dto/autorecode/GetAutoRecodeRequestDto.java b/src/main/java/com/krt/newssak/dto/autorecode/GetAutoRecodeRequestDto.java new file mode 100644 index 0000000..7367c3a --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/autorecode/GetAutoRecodeRequestDto.java @@ -0,0 +1,13 @@ +package com.krt.newssak.dto.autorecode; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetAutoRecodeRequestDto { + private String projectCode; + private int questionUniqueKey; +} diff --git a/src/main/java/com/krt/newssak/dto/autorecode/GetAutoRecodeResponseDto.java b/src/main/java/com/krt/newssak/dto/autorecode/GetAutoRecodeResponseDto.java new file mode 100644 index 0000000..3651f72 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/autorecode/GetAutoRecodeResponseDto.java @@ -0,0 +1,30 @@ +package com.krt.newssak.dto.autorecode; + +import com.krt.newssak.entity.autorecode.AutoRecodeEntity; +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetAutoRecodeResponseDto { + private int idx; + private String projectCode; + private int questionUniqueKey; + private int recodeValue; + private String recodeCondition; + private int regMember; + + public static GetAutoRecodeResponseDto of(AutoRecodeEntity autoRecodeEntity){ + return GetAutoRecodeResponseDto.builder() + .idx(autoRecodeEntity.getIdx()) + .projectCode(autoRecodeEntity.getProjectCode()) + .questionUniqueKey(autoRecodeEntity.getQuestionUniqueKey()) + .recodeValue(autoRecodeEntity.getRecodeValue()) + .recodeCondition(autoRecodeEntity.getRecodeCondition()) + .regMember(autoRecodeEntity.getRegMember()) + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/dto/autorecode/SaveAutoRecodeRequestDto.java b/src/main/java/com/krt/newssak/dto/autorecode/SaveAutoRecodeRequestDto.java new file mode 100644 index 0000000..ec4c81e --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/autorecode/SaveAutoRecodeRequestDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.autorecode; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SaveAutoRecodeRequestDto { + private int idx; + private String projectCode; + private int questionUniqueKey; + private int recodeValue; + private String recodeCondition; + private String regDate; + private int regMember; +} diff --git a/src/main/java/com/krt/newssak/dto/capi/DeleteInterviewerRequestDto.java b/src/main/java/com/krt/newssak/dto/capi/DeleteInterviewerRequestDto.java new file mode 100644 index 0000000..d87dee7 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/DeleteInterviewerRequestDto.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DeleteInterviewerRequestDto { + private List deleteIdxList; +} diff --git a/src/main/java/com/krt/newssak/dto/capi/DeleteSurveyDataRequestDto.java b/src/main/java/com/krt/newssak/dto/capi/DeleteSurveyDataRequestDto.java new file mode 100644 index 0000000..bb04152 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/DeleteSurveyDataRequestDto.java @@ -0,0 +1,16 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DeleteSurveyDataRequestDto { + private String interviewerId; + private String projectCode; + private String answerId; + private String reason; + private int result; +} diff --git a/src/main/java/com/krt/newssak/dto/capi/GetDeleteSurveyDataResponseDto.java b/src/main/java/com/krt/newssak/dto/capi/GetDeleteSurveyDataResponseDto.java new file mode 100644 index 0000000..9c24e3d --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/GetDeleteSurveyDataResponseDto.java @@ -0,0 +1,17 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetDeleteSurveyDataResponseDto { + private int idx; + private String answerId; + private String answerEndTime; + private int answerStatus; + private String reason; + private int result; +} diff --git a/src/main/java/com/krt/newssak/dto/capi/GetDeleteSurveyReqDataRequestDto.java b/src/main/java/com/krt/newssak/dto/capi/GetDeleteSurveyReqDataRequestDto.java new file mode 100644 index 0000000..6bc3ca8 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/GetDeleteSurveyReqDataRequestDto.java @@ -0,0 +1,12 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetDeleteSurveyReqDataRequestDto { + private String projectCode; +} diff --git a/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAllocationStatusRequestDto.java b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAllocationStatusRequestDto.java new file mode 100644 index 0000000..f5b26da --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAllocationStatusRequestDto.java @@ -0,0 +1,12 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetInterviewerAllocationStatusRequestDto { + private String projectCode; +} diff --git a/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAllocationStatusResponseDto.java b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAllocationStatusResponseDto.java new file mode 100644 index 0000000..9df8258 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAllocationStatusResponseDto.java @@ -0,0 +1,24 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetInterviewerAllocationStatusResponseDto { + private int idx; + private String interviewerCode; + private String projectCode; + +// public static GetInterviewerAllocationStatusResponseDto of(InterviewerInfoEntity interviewerInfoEntity){ +// return GetInterviewerAllocationStatusResponseDto.builder() +// .idx(interviewerInfoEntity.getIdx()) +// .code(interviewerInfoEntity.getCode()) +// .id(interviewerInfoEntity.getInterviewerId()) +// .pwd(interviewerInfoEntity.getInterviewerPwd()) +// .name(interviewerInfoEntity.getInterviewerName()) +// .build(); +// } +} diff --git a/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAssignProjectRequestDto.java b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAssignProjectRequestDto.java new file mode 100644 index 0000000..7bb1729 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAssignProjectRequestDto.java @@ -0,0 +1,12 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetInterviewerAssignProjectRequestDto { + private String interviewerCode; +} diff --git a/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAssignResponseDto.java b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAssignResponseDto.java new file mode 100644 index 0000000..f9b0938 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerAssignResponseDto.java @@ -0,0 +1,23 @@ +package com.krt.newssak.dto.capi; + +import com.krt.newssak.entity.capi.InterviewerAssignEntity; +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetInterviewerAssignResponseDto { + private int idx; + private String interviewerCode; + private String projectCode; + + public static GetInterviewerAssignResponseDto of(InterviewerAssignEntity interviewerAssignEntity){ + return GetInterviewerAssignResponseDto.builder() + .idx(interviewerAssignEntity.getIdx()) + .interviewerCode(interviewerAssignEntity.getInterviewerId()) + .projectCode(interviewerAssignEntity.getProjectCode()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/capi/GetInterviewerResponseDto.java b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerResponseDto.java new file mode 100644 index 0000000..bd4d1af --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerResponseDto.java @@ -0,0 +1,29 @@ +package com.krt.newssak.dto.capi; + +import com.krt.newssak.entity.capi.InterviewerInfoEntity; +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetInterviewerResponseDto { + private int idx; + private String code; + private String id; + private String pwd; + private String name; + private String info; + + public static GetInterviewerResponseDto of(InterviewerInfoEntity interviewerInfoEntity){ + return GetInterviewerResponseDto.builder() + .idx(interviewerInfoEntity.getIdx()) + .code(interviewerInfoEntity.getCode()) + .id(interviewerInfoEntity.getInterviewerId()) + .pwd(interviewerInfoEntity.getInterviewerPwd()) + .name(interviewerInfoEntity.getInterviewerName()) + .info(interviewerInfoEntity.getInterviewerInfo()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/capi/GetInterviewerSurveyStatusRequestDto.java b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerSurveyStatusRequestDto.java new file mode 100644 index 0000000..aba20ad --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerSurveyStatusRequestDto.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetInterviewerSurveyStatusRequestDto { + private String projectCode; + private String startDate; + private String endDate; +} diff --git a/src/main/java/com/krt/newssak/dto/capi/GetInterviewerSurveyStatusResponseDto.java b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerSurveyStatusResponseDto.java new file mode 100644 index 0000000..a93d2ec --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/GetInterviewerSurveyStatusResponseDto.java @@ -0,0 +1,33 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetInterviewerSurveyStatusResponseDto { + private String interviewerCode; + private String interviewerId; + private int progressCount; + private int successCount; + private int screenCount; + private int quotaCount; + + public List fieldValuesList(){ + List valuesList = new ArrayList<>(); + + valuesList.add(interviewerCode); + valuesList.add(interviewerId); + valuesList.add(String.valueOf(progressCount)); + valuesList.add(String.valueOf(successCount)); + valuesList.add(String.valueOf(screenCount)); + valuesList.add(String.valueOf(quotaCount)); + + return valuesList; + } +} diff --git a/src/main/java/com/krt/newssak/dto/capi/GetSurveyDetailResponseDto.java b/src/main/java/com/krt/newssak/dto/capi/GetSurveyDetailResponseDto.java new file mode 100644 index 0000000..47b6874 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/GetSurveyDetailResponseDto.java @@ -0,0 +1,30 @@ +package com.krt.newssak.dto.capi; + +import com.krt.newssak.entity.survey.SurveyRespondentEntity; +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetSurveyDetailResponseDto { + private String projectCode; + private String answerId; + private int surveyTypeCode; + private int answerState; + private String answerStartDate; + private String answerEndQuestionId; + private String answerEndDate; + + public static GetSurveyDetailResponseDto of(SurveyRespondentEntity surveyRespondentEntity){ + return GetSurveyDetailResponseDto.builder() + .projectCode(surveyRespondentEntity.getProjectCode()) + .answerId(surveyRespondentEntity.getAnswerId()) + .surveyTypeCode(surveyRespondentEntity.getSurveyTypeCode()) + .answerState(surveyRespondentEntity.getAnswerState()) + .answerStartDate(surveyRespondentEntity.getAnswerStartDate().toString()) + .answerEndDate(surveyRespondentEntity.getAnswerEndDate().toString()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/capi/GetSurveyStatusCountResponseDto.java b/src/main/java/com/krt/newssak/dto/capi/GetSurveyStatusCountResponseDto.java new file mode 100644 index 0000000..d4b88fc --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/GetSurveyStatusCountResponseDto.java @@ -0,0 +1,41 @@ +package com.krt.newssak.dto.capi; + +import com.krt.newssak.entity.survey.SurveyRespondentEntity; +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetSurveyStatusCountResponseDto { + private int totalCount; + private int progressCount; + private int successCount; + private int screenCount; + private int quotaCount; + + public void filteringCount(List surveyRespondentEntityList){ + + this.totalCount = surveyRespondentEntityList.size(); + + for(SurveyRespondentEntity surveyRespondentEntity : surveyRespondentEntityList){ + switch (surveyRespondentEntity.getAnswerState()){ + case 1 ->{ + this.progressCount += 1; + } + case 10 ->{ + this.successCount += 1; + } + case 99 ->{ + this.screenCount += 1; + } + case 98 ->{ + this.quotaCount += 1; + } + } + } + } +} diff --git a/src/main/java/com/krt/newssak/dto/capi/SaveAllocationRequestDto.java b/src/main/java/com/krt/newssak/dto/capi/SaveAllocationRequestDto.java new file mode 100644 index 0000000..56fe515 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/SaveAllocationRequestDto.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SaveAllocationRequestDto { + private String interviewerCode; + private String projectCode; + private int regMember; +} diff --git a/src/main/java/com/krt/newssak/dto/capi/SaveInterviewerAllocationRequestDto.java b/src/main/java/com/krt/newssak/dto/capi/SaveInterviewerAllocationRequestDto.java new file mode 100644 index 0000000..3398080 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/SaveInterviewerAllocationRequestDto.java @@ -0,0 +1,15 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SaveInterviewerAllocationRequestDto { + private List saveAllocationList; + private List deleteIdxList; +} diff --git a/src/main/java/com/krt/newssak/dto/capi/SaveInterviewerRequestDto.java b/src/main/java/com/krt/newssak/dto/capi/SaveInterviewerRequestDto.java new file mode 100644 index 0000000..b78ea54 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/SaveInterviewerRequestDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SaveInterviewerRequestDto { + private int idx; + private String code; + private String id; + private String pwd; + private String info; + private int regMember; + private String regDate; +} diff --git a/src/main/java/com/krt/newssak/dto/capi/SurveyDataDeleteAcceptRequestDto.java b/src/main/java/com/krt/newssak/dto/capi/SurveyDataDeleteAcceptRequestDto.java new file mode 100644 index 0000000..cc1e11e --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/capi/SurveyDataDeleteAcceptRequestDto.java @@ -0,0 +1,13 @@ +package com.krt.newssak.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SurveyDataDeleteAcceptRequestDto { + private int idx; + private int result; +} diff --git a/src/main/java/com/krt/newssak/dto/common/ErrorMessageDto.java b/src/main/java/com/krt/newssak/dto/common/ErrorMessageDto.java new file mode 100644 index 0000000..b42b50f --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/common/ErrorMessageDto.java @@ -0,0 +1,12 @@ +package com.krt.newssak.dto.common; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ErrorMessageDto { + private String errorMessage; +} diff --git a/src/main/java/com/krt/newssak/dto/common/TokenInfo.java b/src/main/java/com/krt/newssak/dto/common/TokenInfo.java new file mode 100644 index 0000000..66336de --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/common/TokenInfo.java @@ -0,0 +1,19 @@ +package com.krt.newssak.dto.common; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +@AllArgsConstructor +public class TokenInfo { + + //grantType은 JWT 대한 인증 타입으로 Bearer 사용할 것. + private String grantType; + + private String accessToken; + + private String refreshToken; + +} diff --git a/src/main/java/com/krt/newssak/dto/datamange/AnswerDataDto.java b/src/main/java/com/krt/newssak/dto/datamange/AnswerDataDto.java new file mode 100644 index 0000000..8d9fa7e --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/datamange/AnswerDataDto.java @@ -0,0 +1,16 @@ +package com.krt.newssak.dto.datamange; + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AnswerDataDto { + // Todo : SurveyEntity에서 of 삭제 가능하다면 해당 파일 삭제 + private int loopId; + private List surveyDataStructureDtoList = null; +} diff --git a/src/main/java/com/krt/newssak/dto/datamange/AnswerQuestionDto.java b/src/main/java/com/krt/newssak/dto/datamange/AnswerQuestionDto.java new file mode 100644 index 0000000..8d9be89 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/datamange/AnswerQuestionDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.datamange; + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AnswerQuestionDto { + private String questionID; + private int questionUniqueKey; + private int questionOrder; + private int loopId; + private List surveyDataStructureDtoList = null; +} diff --git a/src/main/java/com/krt/newssak/dto/datamange/ChangeStatusRequestDto.java b/src/main/java/com/krt/newssak/dto/datamange/ChangeStatusRequestDto.java new file mode 100644 index 0000000..6dd911e --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/datamange/ChangeStatusRequestDto.java @@ -0,0 +1,15 @@ +package com.krt.newssak.dto.datamange; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter @Setter +@NoArgsConstructor +@AllArgsConstructor +public class ChangeStatusRequestDto { + private String projectCode; + private String answerId; + private int surveyStatus; +} diff --git a/src/main/java/com/krt/newssak/dto/datamange/DeleteDataRequestDto.java b/src/main/java/com/krt/newssak/dto/datamange/DeleteDataRequestDto.java new file mode 100644 index 0000000..0682ad0 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/datamange/DeleteDataRequestDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.datamange; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.List; + +@Getter @Setter +@NoArgsConstructor +@AllArgsConstructor +public class DeleteDataRequestDto { + private String projectCode; + private String answerId; + private int afterQuestionOrder; + private List questionUniqueKeyList; +} diff --git a/src/main/java/com/krt/newssak/dto/datamange/GetAnswerUserRequestDto.java b/src/main/java/com/krt/newssak/dto/datamange/GetAnswerUserRequestDto.java new file mode 100644 index 0000000..8143f19 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/datamange/GetAnswerUserRequestDto.java @@ -0,0 +1,12 @@ +package com.krt.newssak.dto.datamange; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetAnswerUserRequestDto { + private String projectCode; +} diff --git a/src/main/java/com/krt/newssak/dto/datamange/GetAnswerUserResponseDto.java b/src/main/java/com/krt/newssak/dto/datamange/GetAnswerUserResponseDto.java new file mode 100644 index 0000000..62f6343 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/datamange/GetAnswerUserResponseDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.datamange; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetAnswerUserResponseDto { + private String answerId; + private int surveyTypeCode; + private int answerState; + private String answerStartDate; + private int endUniqueKey; + private int endLoopId; + private String answerEndTime; +} diff --git a/src/main/java/com/krt/newssak/dto/datamange/GetDataRequestDto.java b/src/main/java/com/krt/newssak/dto/datamange/GetDataRequestDto.java new file mode 100644 index 0000000..04ccffe --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/datamange/GetDataRequestDto.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.datamange; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter @Setter +@NoArgsConstructor +@AllArgsConstructor +public class GetDataRequestDto { + private String projectCode; + private String answerId; +} diff --git a/src/main/java/com/krt/newssak/dto/datamange/ModifyDataRequestDto.java b/src/main/java/com/krt/newssak/dto/datamange/ModifyDataRequestDto.java new file mode 100644 index 0000000..0f2ccd2 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/datamange/ModifyDataRequestDto.java @@ -0,0 +1,19 @@ +package com.krt.newssak.dto.datamange; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.List; + +@Getter @Setter +@NoArgsConstructor +@AllArgsConstructor +public class ModifyDataRequestDto { + private String projectCode; + private String answerId; + private int questionUniqueKey; + private int loopId; + private List surveyDataStructureDtoList; +} diff --git a/src/main/java/com/krt/newssak/dto/datamange/SurveyDataStructureDto.java b/src/main/java/com/krt/newssak/dto/datamange/SurveyDataStructureDto.java new file mode 100644 index 0000000..ab0e9da --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/datamange/SurveyDataStructureDto.java @@ -0,0 +1,16 @@ +package com.krt.newssak.dto.datamange; + +import lombok.*; + +@Getter +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class SurveyDataStructureDto { + private int t; + private int m; + private int s; + private int r; + private String o; +} diff --git a/src/main/java/com/krt/newssak/dto/hardcode/HardCodeAndHistoryDto.java b/src/main/java/com/krt/newssak/dto/hardcode/HardCodeAndHistoryDto.java new file mode 100644 index 0000000..11433ad --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/hardcode/HardCodeAndHistoryDto.java @@ -0,0 +1,16 @@ +package com.krt.newssak.dto.hardcode; + + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class HardCodeAndHistoryDto { + private HardCodeDto hardCodeDto; + private List hardCodeHistoryDtoList; +} diff --git a/src/main/java/com/krt/newssak/dto/hardcode/HardCodeDto.java b/src/main/java/com/krt/newssak/dto/hardcode/HardCodeDto.java new file mode 100644 index 0000000..d892063 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/hardcode/HardCodeDto.java @@ -0,0 +1,34 @@ +package com.krt.newssak.dto.hardcode; + +import com.krt.newssak.entity.hardcode.HardCodeEntity; +import com.krt.newssak.util.Common; +import lombok.*; + +@Getter +@Setter +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class HardCodeDto { + + private long id; + private int questionUniqueKey; + private String projectCode; + private int hardCodeType; + private String content; + private int regMember; + private String regDate; + + public HardCodeEntity toEntity(HardCodeDto hardCodeDto) { + return HardCodeEntity.builder() + .id(hardCodeDto.getId()) + .questionUniqueKey(hardCodeDto.getQuestionUniqueKey()) + .projectCode(hardCodeDto.getProjectCode()) + .hardCodeType(hardCodeDto.getHardCodeType()) + .content(hardCodeDto.getContent()) + .regMember(hardCodeDto.getRegMember()) + .regDate(Common.getNow(null)) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/hardcode/HardCodeHistoryDto.java b/src/main/java/com/krt/newssak/dto/hardcode/HardCodeHistoryDto.java new file mode 100644 index 0000000..1b6e9c3 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/hardcode/HardCodeHistoryDto.java @@ -0,0 +1,42 @@ +package com.krt.newssak.dto.hardcode; + +import com.krt.newssak.entity.hardcode.HardCodeHistoryEntity; +import com.krt.newssak.util.Common; +import lombok.*; + +@Getter +@Setter +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class HardCodeHistoryDto { + + private int questionUniqueKey; + private String projectCode; + private int hardCodeType; + private String content; + private int regMember; + private String regDate; + + public HardCodeHistoryDto toHardCodeDto(HardCodeDto hardCodeDto) { + return HardCodeHistoryDto.builder() + .questionUniqueKey(hardCodeDto.getQuestionUniqueKey()) + .projectCode(hardCodeDto.getProjectCode()) + .hardCodeType(hardCodeDto.getHardCodeType()) + .content(hardCodeDto.getContent()) + .regMember(hardCodeDto.getRegMember()) + .build(); + } + + public HardCodeHistoryEntity toEntity(HardCodeHistoryDto hardCodeHistoryDto) { + return HardCodeHistoryEntity.builder() + .questionUniqueKey(hardCodeHistoryDto.getQuestionUniqueKey()) + .projectCode(hardCodeHistoryDto.getProjectCode()) + .hardCodeType(hardCodeHistoryDto.getHardCodeType()) + .content(hardCodeHistoryDto.getContent()) + .regMember(hardCodeHistoryDto.getRegMember()) + .regDate(Common.getNow(null)) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/hardcode/HardCodeRequestInfoDto.java b/src/main/java/com/krt/newssak/dto/hardcode/HardCodeRequestInfoDto.java new file mode 100644 index 0000000..e99882f --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/hardcode/HardCodeRequestInfoDto.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.hardcode; + +import lombok.*; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class HardCodeRequestInfoDto { + private String projectCode; + private int questionUniqueKey; + private int type; +} diff --git a/src/main/java/com/krt/newssak/dto/kiwi/request/AllProjectCodeList.java b/src/main/java/com/krt/newssak/dto/kiwi/request/AllProjectCodeList.java new file mode 100644 index 0000000..9449772 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/kiwi/request/AllProjectCodeList.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.kiwi.request; + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class AllProjectCodeList { + private List code; +} diff --git a/src/main/java/com/krt/newssak/dto/kiwi/request/DelSurveyDataInfo.java b/src/main/java/com/krt/newssak/dto/kiwi/request/DelSurveyDataInfo.java new file mode 100644 index 0000000..9a6de61 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/kiwi/request/DelSurveyDataInfo.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.kiwi.request; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class DelSurveyDataInfo { + private String pkey; + private String sid; + private String token; +} diff --git a/src/main/java/com/krt/newssak/dto/kiwi/response/AllSurveyNotInKiwi.java b/src/main/java/com/krt/newssak/dto/kiwi/response/AllSurveyNotInKiwi.java new file mode 100644 index 0000000..8561966 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/kiwi/response/AllSurveyNotInKiwi.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.kiwi.response; + +import lombok.*; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class AllSurveyNotInKiwi { + private String kpKey; + private String kpName; + private int qNumber; +} diff --git a/src/main/java/com/krt/newssak/dto/kiwi/response/GetResponseProjectInfo.java b/src/main/java/com/krt/newssak/dto/kiwi/response/GetResponseProjectInfo.java new file mode 100644 index 0000000..57ec34d --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/kiwi/response/GetResponseProjectInfo.java @@ -0,0 +1,19 @@ +package com.krt.newssak.dto.kiwi.response; + +import lombok.*; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class GetResponseProjectInfo { + private int id; + private String projectKey; + private String groupKey; + private String memberKey; + private String title; + private int surveyClass; + private String createDate; + private int qNumber; +} diff --git a/src/main/java/com/krt/newssak/dto/kiwi/response/exampleListByKpKey.java b/src/main/java/com/krt/newssak/dto/kiwi/response/exampleListByKpKey.java new file mode 100644 index 0000000..14b0ab8 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/kiwi/response/exampleListByKpKey.java @@ -0,0 +1,15 @@ +package com.krt.newssak.dto.kiwi.response; + +import lombok.*; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class exampleListByKpKey { + private String pkey; + private String projectTitle; + private String variable; + private String questionTitle; + private String explain; +} diff --git a/src/main/java/com/krt/newssak/dto/kiwi/response/surveyAnswerTime.java b/src/main/java/com/krt/newssak/dto/kiwi/response/surveyAnswerTime.java new file mode 100644 index 0000000..909e494 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/kiwi/response/surveyAnswerTime.java @@ -0,0 +1,13 @@ +package com.krt.newssak.dto.kiwi.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class surveyAnswerTime { + private String answerStartTime; + private String answerEndTime; +} diff --git a/src/main/java/com/krt/newssak/dto/list/ListContentDeleteRequestDto.java b/src/main/java/com/krt/newssak/dto/list/ListContentDeleteRequestDto.java new file mode 100644 index 0000000..b6f35ee --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/list/ListContentDeleteRequestDto.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.list; + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ListContentDeleteRequestDto { + private List idx; +} diff --git a/src/main/java/com/krt/newssak/dto/list/ListContentDetailSaveRequestDto.java b/src/main/java/com/krt/newssak/dto/list/ListContentDetailSaveRequestDto.java new file mode 100644 index 0000000..da9c45f --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/list/ListContentDetailSaveRequestDto.java @@ -0,0 +1,31 @@ +package com.krt.newssak.dto.list; + +import com.google.gson.Gson; +import com.krt.newssak.entity.list.ListContentEntity; +import lombok.*; + +import java.util.LinkedHashMap; +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ListContentDetailSaveRequestDto { + private String projectCode; + private String listId; + private List> listContent; + private int regMember; + + public static ListContentEntity toEntity(ListContentDetailSaveRequestDto listContentSaveRequestDto){ + Gson gson = new Gson(); + + return ListContentEntity.builder() + .projectCode(listContentSaveRequestDto.getProjectCode()) + .listId(listContentSaveRequestDto.getListId()) + .listInfo(gson.toJson(listContentSaveRequestDto.getListContent())) + .regMember(listContentSaveRequestDto.getRegMember()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/list/ListContentGetRequestDto.java b/src/main/java/com/krt/newssak/dto/list/ListContentGetRequestDto.java new file mode 100644 index 0000000..76b7dc4 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/list/ListContentGetRequestDto.java @@ -0,0 +1,12 @@ +package com.krt.newssak.dto.list; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ListContentGetRequestDto { + private String projectCode; +} diff --git a/src/main/java/com/krt/newssak/dto/list/ListContentGetResponseDto.java b/src/main/java/com/krt/newssak/dto/list/ListContentGetResponseDto.java new file mode 100644 index 0000000..c824e18 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/list/ListContentGetResponseDto.java @@ -0,0 +1,34 @@ +package com.krt.newssak.dto.list; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.newssak.entity.list.ListContentEntity; +import lombok.*; + +import java.lang.reflect.Type; +import java.util.LinkedHashMap; +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ListContentGetResponseDto { + private int idx; + private String projectCode; + private String listId; + private List> listContent; + + public static ListContentGetResponseDto of(ListContentEntity listContentEntity){ + Gson gson = new Gson(); + Type listContentType = new TypeToken>>(){}.getType(); + + return ListContentGetResponseDto.builder() + .idx(listContentEntity.getIdx()) + .projectCode(listContentEntity.getProjectCode()) + .listId(listContentEntity.getListId()) + .listContent(gson.fromJson(listContentEntity.getListInfo(), listContentType)) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/list/ListContentModifyRequestDto.java b/src/main/java/com/krt/newssak/dto/list/ListContentModifyRequestDto.java new file mode 100644 index 0000000..dd074bc --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/list/ListContentModifyRequestDto.java @@ -0,0 +1,16 @@ +package com.krt.newssak.dto.list; + +import lombok.*; + +import java.util.LinkedHashMap; +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ListContentModifyRequestDto { + private int idx; + private List> listContent; +} diff --git a/src/main/java/com/krt/newssak/dto/list/ListContentSaveRequestDto.java b/src/main/java/com/krt/newssak/dto/list/ListContentSaveRequestDto.java new file mode 100644 index 0000000..fee768d --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/list/ListContentSaveRequestDto.java @@ -0,0 +1,15 @@ +package com.krt.newssak.dto.list; + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ListContentSaveRequestDto { + private List listContent; + private int addUpdateCount; +} diff --git a/src/main/java/com/krt/newssak/dto/list/ListDownloadGetRequestDto.java b/src/main/java/com/krt/newssak/dto/list/ListDownloadGetRequestDto.java new file mode 100644 index 0000000..3d9d78b --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/list/ListDownloadGetRequestDto.java @@ -0,0 +1,12 @@ +package com.krt.newssak.dto.list; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ListDownloadGetRequestDto { + private String projectCode; +} diff --git a/src/main/java/com/krt/newssak/dto/list/ListHeaderDeleteRequestDto.java b/src/main/java/com/krt/newssak/dto/list/ListHeaderDeleteRequestDto.java new file mode 100644 index 0000000..042127b --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/list/ListHeaderDeleteRequestDto.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.list; + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ListHeaderDeleteRequestDto { + private List deleteIdxList; +} diff --git a/src/main/java/com/krt/newssak/dto/list/ListHeaderGetRequestDto.java b/src/main/java/com/krt/newssak/dto/list/ListHeaderGetRequestDto.java new file mode 100644 index 0000000..990235c --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/list/ListHeaderGetRequestDto.java @@ -0,0 +1,12 @@ +package com.krt.newssak.dto.list; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ListHeaderGetRequestDto { + private String projectCode; +} diff --git a/src/main/java/com/krt/newssak/dto/list/ListHeaderResponseDto.java b/src/main/java/com/krt/newssak/dto/list/ListHeaderResponseDto.java new file mode 100644 index 0000000..1930e1a --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/list/ListHeaderResponseDto.java @@ -0,0 +1,29 @@ +package com.krt.newssak.dto.list; + +import com.krt.newssak.entity.list.ListHeaderEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ListHeaderResponseDto { + private int idx; + private String projectCode; + private int orderNo; + private String headerName; + private String headerType; + + public static ListHeaderResponseDto of(ListHeaderEntity listHeaderEntity){ + return ListHeaderResponseDto.builder() + .idx(listHeaderEntity.getIdx()) + .projectCode(listHeaderEntity.getProjectCode()) + .orderNo(listHeaderEntity.getOrderNo()) + .headerName(listHeaderEntity.getName()) + .headerType(listHeaderEntity.getType()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/list/ListHeaderSaveRequestDto.java b/src/main/java/com/krt/newssak/dto/list/ListHeaderSaveRequestDto.java new file mode 100644 index 0000000..59123b9 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/list/ListHeaderSaveRequestDto.java @@ -0,0 +1,29 @@ +package com.krt.newssak.dto.list; + +import com.krt.newssak.entity.list.ListHeaderEntity; +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ListHeaderSaveRequestDto { + private int idx; + private String projectCode; + private int orderNo; + private String headerName; + private String headerType; + private int regMember; + + public static ListHeaderEntity toEntity(ListHeaderSaveRequestDto listHeaderSaveRequestDto){ + return ListHeaderEntity.builder() + .idx(listHeaderSaveRequestDto.getIdx()) + .projectCode(listHeaderSaveRequestDto.getProjectCode()) + .orderNo(listHeaderSaveRequestDto.getOrderNo()) + .name(listHeaderSaveRequestDto.getHeaderName()) + .type(listHeaderSaveRequestDto.getHeaderType()) + .regMember(listHeaderSaveRequestDto.getRegMember()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/member/CustomUserDetails.java b/src/main/java/com/krt/newssak/dto/member/CustomUserDetails.java new file mode 100644 index 0000000..a3bdbe8 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/member/CustomUserDetails.java @@ -0,0 +1,52 @@ +package com.krt.newssak.dto.member; + +import com.krt.newssak.entity.member.MemberEntity; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.crypto.password.PasswordEncoder; + +import java.util.Arrays; +import java.util.Collection; +import java.util.stream.Collectors; + +@Getter +@RequiredArgsConstructor +public class CustomUserDetails implements UserDetails { + private String username;// DB의 P.K + private String password;// DB의 비밀번호 + private boolean accountNonLocked =true;// 계정 잠금 여부 + private boolean accountNonExpired =true ;// 사용자 계정 만료 없음 + private boolean credentialsNonExpired =true ;// 비밀번호 만료 없음 + private boolean enabled =true;// 사용자 활성화 여부 + private Collection authorities; // 사용자 권한 목록 + + private String member_id; + private String member_name; + private int member_code; + private MemberTeamInfoDto team_info; + private int is_admin; + + public CustomUserDetails(MemberEntity member, PasswordEncoder passwordEncoder) { + this.username = member.getId(); + this.password = passwordEncoder.encode(member.getPassword()); + this.member_code = member.getCode(); + this.member_id = member.getId(); + this.member_name = member.getName(); + this.team_info = MemberTeamInfoDto.of(member.getMemberTeamInfo()); + this.is_admin = 999; + + if(!"R".equals(member.getMemberTeamInfo().getDivisionCode())){ + this.is_admin = 1; + }else{ + this.is_admin = 0; + } + + Collection roles = Arrays.stream("ADMIN".split(",")) + .map(role -> new SimpleGrantedAuthority(username)) + .collect(Collectors.toList()); + this.authorities = roles; + } +} diff --git a/src/main/java/com/krt/newssak/dto/member/MemberDto.java b/src/main/java/com/krt/newssak/dto/member/MemberDto.java new file mode 100644 index 0000000..8d097ee --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/member/MemberDto.java @@ -0,0 +1,40 @@ +package com.krt.newssak.dto.member; + +import com.krt.newssak.entity.member.MemberEntity; +import lombok.*; + +import java.util.LinkedHashMap; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MemberDto { + + private int member_code; + private String member_id; + private String member_name; + private MemberTeamInfoDto teamInfo; + private int is_admin = 999; + + public static MemberDto of(MemberEntity member) { + return MemberDto.builder() + .member_code(member.getCode()) + .member_id(member.getId()) + .member_name(member.getName()) + .teamInfo(MemberTeamInfoDto.of(member.getMemberTeamInfo())) + .build(); + } + + public static MemberDto of(LinkedHashMap details){ + return MemberDto.builder() + .member_code((int)details.get("member_code")) + .member_id((String)details.get("member_id")) + .member_name((String)details.get("member_name")) + .teamInfo(MemberTeamInfoDto.of((LinkedHashMap) details.get("teamInfo"))) + .is_admin((int)details.get("is_admin")) + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/dto/member/MemberLoginDto.java b/src/main/java/com/krt/newssak/dto/member/MemberLoginDto.java new file mode 100644 index 0000000..899e25b --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/member/MemberLoginDto.java @@ -0,0 +1,21 @@ +package com.krt.newssak.dto.member; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MemberLoginDto { + + @Schema(description = "아이디", defaultValue = "jspark") + private String id; + + @Schema(description = "패스워드", defaultValue = "1") + private String password; + +} diff --git a/src/main/java/com/krt/newssak/dto/member/MemberTeamInfoDto.java b/src/main/java/com/krt/newssak/dto/member/MemberTeamInfoDto.java new file mode 100644 index 0000000..29a53da --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/member/MemberTeamInfoDto.java @@ -0,0 +1,37 @@ +package com.krt.newssak.dto.member; + +import com.krt.newssak.entity.member.MemberTeamInfoEntity; +import lombok.*; + +import java.util.LinkedHashMap; + +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MemberTeamInfoDto { + + private int code; + private String name; + private String groupCode; + private String groupName; + + public static MemberTeamInfoDto of(MemberTeamInfoEntity memberTeamInfo) { + return MemberTeamInfoDto.builder() + .code(memberTeamInfo.getCode()) + .name(memberTeamInfo.getName()) + .groupCode(memberTeamInfo.getDivisionCode()) + .groupName(memberTeamInfo.getDivisionName()) + .build(); + } + + public static MemberTeamInfoDto of(LinkedHashMap detailsTeam){ + return MemberTeamInfoDto.builder() + .code((int)detailsTeam.get("code")) + .name((String)detailsTeam.get("name")) + .groupCode((String)detailsTeam.get("groupCode")) + .groupName((String)detailsTeam.get("groupName")) + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/dto/project/OptionElementDto.java b/src/main/java/com/krt/newssak/dto/project/OptionElementDto.java new file mode 100644 index 0000000..f359f12 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/OptionElementDto.java @@ -0,0 +1,34 @@ +package com.krt.newssak.dto.project; + +import com.krt.newssak.entity.project.ProjectResponseEntity; +import com.krt.newssak.entity.project.ProjectStyleEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class OptionElementDto { + @Schema(description = "옵션 코드") + private int option_code; + @Schema(description = "옵션 값") + private String option_value; + + public static OptionElementDto of(ProjectResponseEntity responseEntity){ + return OptionElementDto.builder() + .option_code(responseEntity.getOptionCode()) + .option_value(responseEntity.getOptionValue()) + .build(); + } + + public static OptionElementDto of(ProjectStyleEntity styleEntity){ + return OptionElementDto.builder() + .option_code(styleEntity.getStyleCode()) + .option_value(styleEntity.getStyleValue()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectByAnswerIdByCountDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectByAnswerIdByCountDto.java new file mode 100644 index 0000000..44af546 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectByAnswerIdByCountDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.project; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectByAnswerIdByCountDto { + private String projectCode; + private String answerId; + private int surveyTypeCode; + private int answerState; + private int dataCount; +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectByStatusByCountDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectByStatusByCountDto.java new file mode 100644 index 0000000..8f5a65e --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectByStatusByCountDto.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.project; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectByStatusByCountDto { + private int successCount; + private int notSuccessCount; + private int testCount; +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectCopyRequestDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectCopyRequestDto.java new file mode 100644 index 0000000..f2fd1a1 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectCopyRequestDto.java @@ -0,0 +1,16 @@ +package com.krt.newssak.dto.project; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectCopyRequestDto { + + private String copyProjectCode; + private String changeProjectCode; +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectDeleteDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectDeleteDto.java new file mode 100644 index 0000000..e9ff144 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectDeleteDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.project; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectDeleteDto { + + @Schema(description = "프로젝트 코드", defaultValue = "") + private String project_code; + +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectDto.java new file mode 100644 index 0000000..aca442b --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectDto.java @@ -0,0 +1,45 @@ +package com.krt.newssak.dto.project; + +import com.krt.newssak.entity.project.ProjectEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectDto { + + private int project_idx; + private String project_code; + private String project_title; + private String survey_title; + private int project_state; + private String own_team; + private int project_company; + private int reg_member; + private String reg_date; + private int is_delete; + private String delete_date; + + public static ProjectDto of(ProjectEntity project) { + return ProjectDto.builder() + .project_idx(project.getIdx()) + .project_code(project.getCode()) + .project_title(project.getProjectTitle()) + .survey_title(project.getSurveyTitle()) + .project_state(project.getState()) + .own_team(project.getOwnTeam()) + .project_company(project.getCompany()) + .reg_member(project.getRegMember()) + .reg_date(project.getRegDate()) + .is_delete(project.getIsDelete()) + .delete_date(project.getDeleteDate()) + .build(); + } + + + +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectInfoDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectInfoDto.java new file mode 100644 index 0000000..e6e7ecf --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectInfoDto.java @@ -0,0 +1,34 @@ +package com.krt.newssak.dto.project; + +import com.krt.newssak.entity.project.ProjectEntity; +import lombok.*; + +import java.util.List; + +@Getter @Setter +@ToString +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectInfoDto { + + private String project_code; + private String project_title; + private String survey_title; + private String own_team; + private int project_company; + + private List pm_list; + private List hashtag_list; + + public static ProjectInfoDto of(ProjectEntity projectEntity) { + return ProjectInfoDto.builder() + .project_code(projectEntity.getCode()) + .project_title(projectEntity.getProjectTitle()) + .survey_title(projectEntity.getSurveyTitle()) + .own_team(projectEntity.getOwnTeam()) + .project_company(projectEntity.getCompany()) + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectListDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectListDto.java new file mode 100644 index 0000000..e542229 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectListDto.java @@ -0,0 +1,26 @@ +package com.krt.newssak.dto.project; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectListDto { + + private String project_code; + private String project_title; + private String survey_title; + private int project_state; + private String own_team; + private String own_team_nm; + private int project_company; + private int reg_member; + private String reg_member_nm; + private String reg_date; + private long hashtag_count; + +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectManagerDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectManagerDto.java new file mode 100644 index 0000000..8fcdcba --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectManagerDto.java @@ -0,0 +1,16 @@ +package com.krt.newssak.dto.project; + +import lombok.*; + +@Getter +@ToString +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectManagerDto { + + private int member_code; + private String member_name; + private String team_name; + private int role_code; +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectOptionDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectOptionDto.java new file mode 100644 index 0000000..b95db8b --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectOptionDto.java @@ -0,0 +1,21 @@ +package com.krt.newssak.dto.project; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectOptionDto { + @Schema(description = "프로젝트 코드") + private String project_code; + + @Schema(description = "옵션 정보") + private List optionList; +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectParameterDeleteDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectParameterDeleteDto.java new file mode 100644 index 0000000..4935bc4 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectParameterDeleteDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.project; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectParameterDeleteDto { + @Schema(description = "프로젝트 코드") + private String project_code; + @Schema(description = "파라미터명") + private String parameter_name; +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectParameterDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectParameterDto.java new file mode 100644 index 0000000..699aee1 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectParameterDto.java @@ -0,0 +1,34 @@ +package com.krt.newssak.dto.project; + +import com.krt.newssak.entity.project.ProjectParameterEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectParameterDto { + + @Schema(description = "프로젝트 코드") + private String project_code; + @Schema(description = "파라미터명") + private String parameter_name; + @Schema(description = "디폴트 여부", defaultValue = "0") + private int is_default = 0; + @Schema(description = "등록자") + private int reg_member; + + public static ProjectParameterDto of(ProjectParameterEntity projectParameterEntity){ + return ProjectParameterDto.builder() + .project_code(projectParameterEntity.getProjectCode()) + .parameter_name(projectParameterEntity.getParameterName()) + .is_default(projectParameterEntity.getIsDefault()) + .reg_member(projectParameterEntity.getRegMember()) + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectRedirectDeleteDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectRedirectDeleteDto.java new file mode 100644 index 0000000..63f9f7f --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectRedirectDeleteDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.project; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectRedirectDeleteDto { + @Schema(description = "프로젝트 코드") + private String project_code; + @Schema(description = "패널사 코드") + private String panel_code; +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectRedirectDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectRedirectDto.java new file mode 100644 index 0000000..f6a9b14 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectRedirectDto.java @@ -0,0 +1,39 @@ +package com.krt.newssak.dto.project; + +import com.krt.newssak.entity.project.ProjectRedirectEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectRedirectDto { + @Schema(description = "프로젝트 코드") + private String project_code; + @Schema(description = "패널사 코드") + private String panel_code; + @Schema(description = "패널사 명") + private String panel_name; + @Schema(description = "성공 리다이렉트 url") + private String complete_url; + @Schema(description = "쿼터풀 리다이렉트 url") + private String quota_url; + @Schema(description = "스크린 아웃 리다이렉트 url") + private String screen_url; + @Schema(description = "등록자") + private int reg_member; + + public static ProjectRedirectDto of(ProjectRedirectEntity projectRedirectEntity){ + return ProjectRedirectDto.builder() + .project_code(projectRedirectEntity.getProjectCode()) + .panel_code(projectRedirectEntity.getPanelCode()) + .panel_name(projectRedirectEntity.getPanelName()) + .complete_url(projectRedirectEntity.getCompleteUrl()) + .quota_url(projectRedirectEntity.getQuotaUrl()) + .screen_url(projectRedirectEntity.getScreenUrl()) + .reg_member(projectRedirectEntity.getRegMember()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectSearchDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectSearchDto.java new file mode 100644 index 0000000..03482a2 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectSearchDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.project; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +@Setter @Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectSearchDto { + + @Schema(description = "부서코드", defaultValue = "") + private String group; + + @Schema(description = "검색어", defaultValue = "") + private String keyword; + +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectStateDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectStateDto.java new file mode 100644 index 0000000..ec6577b --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectStateDto.java @@ -0,0 +1,21 @@ +package com.krt.newssak.dto.project; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectStateDto { + + @Schema(description = "프로젝트 코드", defaultValue = "") + private String project_code; + + @Schema(description = "프로젝트 상태", defaultValue = "") + private int project_state; + +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectStyleDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectStyleDto.java new file mode 100644 index 0000000..4c32760 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectStyleDto.java @@ -0,0 +1,22 @@ +package com.krt.newssak.dto.project; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectStyleDto { + @Schema(description = "프로젝트 코드") + private String project_code; + @Schema(description = "스타일 코드") + private int style_code; + @Schema(description = "스타일 세팅 값") + private String style_value; + @Schema(description = "등록자") + private int reg_member; +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectUpsertDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectUpsertDto.java new file mode 100644 index 0000000..a91dcca --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectUpsertDto.java @@ -0,0 +1,26 @@ +package com.krt.newssak.dto.project; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectUpsertDto { + + private String project_code; + private String project_title; + private String survey_title; + private String own_team; + private int project_company; + private int reg_member; + private int is_update; + List pm_list; + List hashtag_list; + +} diff --git a/src/main/java/com/krt/newssak/dto/project/ProjectWithHashtagDto.java b/src/main/java/com/krt/newssak/dto/project/ProjectWithHashtagDto.java new file mode 100644 index 0000000..0ceb310 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/project/ProjectWithHashtagDto.java @@ -0,0 +1,41 @@ +package com.krt.newssak.dto.project; + +import lombok.*; + +import java.util.List; + +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectWithHashtagDto { + + private String project_code; + private String project_title; + private String survey_title; + private int project_state; + private String own_team; + private String own_team_nm; + private int project_company; + private int reg_member; + private String reg_member_nm; + private String reg_date; + private List hashtags; + + public static ProjectWithHashtagDto setProjectWithHashtagDto(ProjectListDto projectListDto) { + return ProjectWithHashtagDto.builder() + .project_code(projectListDto.getProject_code()) + .project_title(projectListDto.getProject_title()) + .survey_title(projectListDto.getSurvey_title()) + .project_state(projectListDto.getProject_state()) + .own_team(projectListDto.getOwn_team()) + .own_team_nm(projectListDto.getOwn_team_nm()) + .project_company(projectListDto.getProject_company()) + .reg_member(projectListDto.getReg_member()) + .reg_member_nm(projectListDto.getReg_member_nm()) + .reg_date(projectListDto.getReg_date()) + .hashtags(null) + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionBlockCollectResponseDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionBlockCollectResponseDto.java new file mode 100644 index 0000000..db111a7 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionBlockCollectResponseDto.java @@ -0,0 +1,21 @@ +package com.krt.newssak.dto.question; + +import com.krt.newssak.entity.question.QuestionBlockCollectEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionBlockCollectResponseDto { + private int questionUniqueKey; + + public static QuestionBlockCollectResponseDto of(QuestionBlockCollectEntity questionBlockCollectEntity){ + return QuestionBlockCollectResponseDto.builder() + .questionUniqueKey(questionBlockCollectEntity.getQuestionUniqueKey()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionBlockDeleteRequestDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionBlockDeleteRequestDto.java new file mode 100644 index 0000000..3b2e615 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionBlockDeleteRequestDto.java @@ -0,0 +1,13 @@ +package com.krt.newssak.dto.question; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class QuestionBlockDeleteRequestDto { + private String project_code; + private int block_code; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionBlockRequestDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionBlockRequestDto.java new file mode 100644 index 0000000..4d7ccae --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionBlockRequestDto.java @@ -0,0 +1,21 @@ +package com.krt.newssak.dto.question; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class QuestionBlockRequestDto { + private String project_code; + private int block_code; + private String block_name; + private int block_type; + private List block_list; + private int reg_member; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionBlockResponseDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionBlockResponseDto.java new file mode 100644 index 0000000..436dc07 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionBlockResponseDto.java @@ -0,0 +1,31 @@ +package com.krt.newssak.dto.question; + +import com.krt.newssak.entity.question.QuestionBlockCollectEntity; +import com.krt.newssak.entity.question.QuestionBlockEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; +import java.util.stream.Collectors; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionBlockResponseDto { + private int blockCode; + private String blockName; + private int blockType; + private List blockCollectList; + + public static QuestionBlockResponseDto of(QuestionBlockEntity questionBlockEntity){ + return QuestionBlockResponseDto.builder() + .blockCode(questionBlockEntity.getBlockCode()) + .blockName(questionBlockEntity.getBlockName()) + .blockType(questionBlockEntity.getBlockType()) + .blockCollectList(questionBlockEntity.getBlockCollectList().stream().map(QuestionBlockCollectEntity::getQuestionUniqueKey).collect(Collectors.toList())) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionCopyDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionCopyDto.java new file mode 100644 index 0000000..c910b0c --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionCopyDto.java @@ -0,0 +1,24 @@ +package com.krt.newssak.dto.question; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionCopyDto { + @Schema(description = "프로젝트 코드", defaultValue = "") + private String project_code; + + @Schema(description = "문항 고유 키", defaultValue = "") + private List question_unique_key; + + @Schema(description = "복사할 세트 수", defaultValue = "") + private int copy_set_count; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionDeleteDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionDeleteDto.java new file mode 100644 index 0000000..c065e62 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionDeleteDto.java @@ -0,0 +1,21 @@ +package com.krt.newssak.dto.question; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionDeleteDto { + @Schema(description = "프로젝트 코드", defaultValue = "") + private String project_code; + + @Schema(description = "문항 고유 키", defaultValue = "") + private List question_unique_key; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionDto.java new file mode 100644 index 0000000..d58a322 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionDto.java @@ -0,0 +1,47 @@ +package com.krt.newssak.dto.question; + +import com.krt.newssak.entity.question.QuestionEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionDto { + + private long question_idx; + private String question_id; + private String project_code; + private String question_name; + private int question_dimension; + private int question_type; + private String question_explain; + private String question_title; + private String question_description; + private int reg_member; + private String reg_date; + private int is_delete; + private String delete_date; + + public static QuestionDto of(QuestionEntity question){ + return QuestionDto.builder() + .question_idx(question.getIdx()) + .question_id(question.getQuestionID()) + .project_code(question.getProjectCode()) + .question_name(question.getQuestionName()) + .question_dimension(question.getQuestionDimension()) + .question_type(question.getQuestionType()) + .question_explain(question.getQuestionExplain()) + .question_title(question.getQuestionTitle()) + .question_description(question.getQuestionDescription()) + .reg_member(question.getRegMember()) + .reg_date(question.getRegDate()) + .is_delete(question.getIsDelete()) + .delete_date(question.getDeleteDate()) + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionHardcodeDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionHardcodeDto.java new file mode 100644 index 0000000..4a63988 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionHardcodeDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.question; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionHardcodeDto { + private int question_unique_key; + private String project_code; + private int hardcode_type; + private String hardcode_content; + private int reg_member; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionLabelInfoDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionLabelInfoDto.java new file mode 100644 index 0000000..f55cd64 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionLabelInfoDto.java @@ -0,0 +1,29 @@ +package com.krt.newssak.dto.question; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@NoArgsConstructor +@ToString +public class QuestionLabelInfoDto { + private int order; + private int value; + private String label; + + //String, Numeic에서만 사용 + private int open_type = 0; + private int decimal_point = 0; + private int not_duplicate = 0; + private String prefix = ""; + private String range = ""; + private String placeholder = ""; + private String suffix = ""; + //String, Numeic에서만 사용 + + private int is_etc = 0; + private int is_not = 0; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionLabelJsonDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionLabelJsonDto.java new file mode 100644 index 0000000..b5a36ec --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionLabelJsonDto.java @@ -0,0 +1,18 @@ +package com.krt.newssak.dto.question; + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@NoArgsConstructor +public class QuestionLabelJsonDto { + private List label_info = null; + private QuestionLabelOptionDto label_option = null; + + public QuestionLabelJsonDto(List labelInfo, QuestionLabelOptionDto labelOption){ + this.label_info = labelInfo; + this.label_option = labelOption; + } +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionLabelOptionDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionLabelOptionDto.java new file mode 100644 index 0000000..f2a5f18 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionLabelOptionDto.java @@ -0,0 +1,15 @@ +package com.krt.newssak.dto.question; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class QuestionLabelOptionDto { + private String accept_question = ""; + private String except_question = ""; + private int use_rotation = 0; + private QuestionLabelRotationDto rotation_info = null; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionLabelRotationDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionLabelRotationDto.java new file mode 100644 index 0000000..5db563a --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionLabelRotationDto.java @@ -0,0 +1,15 @@ +package com.krt.newssak.dto.question; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class QuestionLabelRotationDto { + private String fixed_top = ""; + private String fixed_bottom = ""; + private int use_group = 0; + private String group = ""; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionLogicDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionLogicDto.java new file mode 100644 index 0000000..4aed66c --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionLogicDto.java @@ -0,0 +1,28 @@ +package com.krt.newssak.dto.question; + +import com.krt.newssak.entity.question.QuestionLogicEntity; +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionLogicDto { + private String project_code; + private int question_unique_key; + private List before_logic; + private List after_logic; + private int reg_member; + public static QuestionLogicDto of(String projectCode, int questionUniqueKey, List beforeLogic, List afterLogic, int regMember) { + return QuestionLogicDto.builder() + .project_code(projectCode) + .question_unique_key(questionUniqueKey) + .before_logic(beforeLogic) + .after_logic(afterLogic) + .reg_member(regMember) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionLogicJsonDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionLogicJsonDto.java new file mode 100644 index 0000000..cc25f93 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionLogicJsonDto.java @@ -0,0 +1,13 @@ +package com.krt.newssak.dto.question; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionLogicJsonDto { + public String logic; + public String page; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionOptionDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionOptionDto.java new file mode 100644 index 0000000..3837707 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionOptionDto.java @@ -0,0 +1,17 @@ +package com.krt.newssak.dto.question; + +import lombok.*; + +import java.util.List; + +@Getter @Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class QuestionOptionDto { + private String project_code; + private int questionUniqueKey; + private List OptionInfo; + private int regMember; + private String regDate; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionOptionValueJsonDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionOptionValueJsonDto.java new file mode 100644 index 0000000..e417d96 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionOptionValueJsonDto.java @@ -0,0 +1,14 @@ +package com.krt.newssak.dto.question; + +import lombok.*; + +@Getter @Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class QuestionOptionValueJsonDto { + private String option_code; + private String type_code; + private String detail_code; + private String value; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionOrderDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionOrderDto.java new file mode 100644 index 0000000..7e3d52c --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionOrderDto.java @@ -0,0 +1,20 @@ +package com.krt.newssak.dto.question; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionOrderDto { + @Schema(description = "문항 고유 키", defaultValue = "") + private int question_unique_key; + @Schema(description = "문항 순서", defaultValue = "") + private int question_order; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionReorderDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionReorderDto.java new file mode 100644 index 0000000..0379a1c --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionReorderDto.java @@ -0,0 +1,21 @@ +package com.krt.newssak.dto.question; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionReorderDto { + @Schema(description = "프로젝트 코드", defaultValue = "") + private String project_code; + + @Schema(description = "문항 순서 리스트", defaultValue = "") + private List question_order_list; +} diff --git a/src/main/java/com/krt/newssak/dto/question/QuestionUpsertDto.java b/src/main/java/com/krt/newssak/dto/question/QuestionUpsertDto.java new file mode 100644 index 0000000..2ec7dd2 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/question/QuestionUpsertDto.java @@ -0,0 +1,32 @@ +package com.krt.newssak.dto.question; + +import lombok.*; + +import java.util.List; + +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionUpsertDto { + + private int question_unique_key; + private String question_id; + private String project_code; + private int question_order; + private String question_name; + private short question_dimension = 0; + private short auto_type = 0; + private short question_type = 10; + private String question_explain = ""; + private String question_title = ""; + private String question_description = ""; + private List question_option = null; + private List question_block_option = null; + private QuestionLabelJsonDto scalar_label = null; + private QuestionLabelJsonDto matrix_label = null; + private QuestionLabelJsonDto tensor_label = null; + private int reg_member; + private int is_update = 0; + private int block_id; +} diff --git a/src/main/java/com/krt/newssak/dto/quota/QuotaCellDto.java b/src/main/java/com/krt/newssak/dto/quota/QuotaCellDto.java new file mode 100644 index 0000000..4e27b86 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/quota/QuotaCellDto.java @@ -0,0 +1,35 @@ +package com.krt.newssak.dto.quota; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.newssak.entity.quota.QuotaCellEntity; +import lombok.*; + +import java.lang.reflect.Type; +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuotaCellDto { + private long quotaCellIdx; + private int quotaCount; + private int viewCount; + private List quotaInfo; + private int isUse; + + public static QuotaCellDto of(QuotaCellEntity quotaCellEntity){ + Gson gson = new Gson(); + Type listType = new TypeToken>() {}.getType(); + + return QuotaCellDto.builder() + .quotaCellIdx(quotaCellEntity.getIdx()) + .quotaCount(quotaCellEntity.getQuotaCount()) + .viewCount(quotaCellEntity.getViewCount()) + .quotaInfo(gson.fromJson(quotaCellEntity.getQuotaInfo(),listType)) + .isUse(quotaCellEntity.getIsUse()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/quota/QuotaCellJsonDto.java b/src/main/java/com/krt/newssak/dto/quota/QuotaCellJsonDto.java new file mode 100644 index 0000000..30c710a --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/quota/QuotaCellJsonDto.java @@ -0,0 +1,12 @@ +package com.krt.newssak.dto.quota; + +import lombok.*; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class QuotaCellJsonDto { + private int quk; + private int val; +} diff --git a/src/main/java/com/krt/newssak/dto/quota/QuotaDeleteDto.java b/src/main/java/com/krt/newssak/dto/quota/QuotaDeleteDto.java new file mode 100644 index 0000000..4ad5cca --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/quota/QuotaDeleteDto.java @@ -0,0 +1,16 @@ +package com.krt.newssak.dto.quota; + +import lombok.*; + +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuotaDeleteDto { + private String projectCode; + private int quotaCode; +} diff --git a/src/main/java/com/krt/newssak/dto/quota/QuotaListDto.java b/src/main/java/com/krt/newssak/dto/quota/QuotaListDto.java new file mode 100644 index 0000000..0526898 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/quota/QuotaListDto.java @@ -0,0 +1,35 @@ +package com.krt.newssak.dto.quota; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.newssak.entity.quota.QuotaEntity; +import lombok.*; + +import java.lang.reflect.Type; +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuotaListDto { + private int quotaCode; + private List rowQuestionList; + private List colQuestionList; + private String quotaTitle; + private int regMember; + + public static QuotaListDto of(QuotaEntity quotaEntity){ + Gson gson = new Gson(); + Type listType = new TypeToken>() {}.getType(); + + return QuotaListDto.builder() + .quotaCode(quotaEntity.getQuotaCode()) + .rowQuestionList(gson.fromJson(quotaEntity.getRowQuestionUniqueKey(), listType)) + .colQuestionList(gson.fromJson(quotaEntity.getColQuestionUniqueKey(), listType)) + .quotaTitle(quotaEntity.getQuotaTitle()) + .regMember(quotaEntity.getRegMember()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/quota/QuotaUpsertDto.java b/src/main/java/com/krt/newssak/dto/quota/QuotaUpsertDto.java new file mode 100644 index 0000000..cc92a83 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/quota/QuotaUpsertDto.java @@ -0,0 +1,23 @@ +package com.krt.newssak.dto.quota; + +import lombok.*; + +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuotaUpsertDto { + private String projectCode; + private int quotaCode; + private int isBooster; + private List rowQuestionList; + private List colQuestionList; + private String quotaTitle; + private int regMember; + private List quotaCellList = new ArrayList<>(); + private int isNew; +} diff --git a/src/main/java/com/krt/newssak/dto/survey/SurveyRespondentDto.java b/src/main/java/com/krt/newssak/dto/survey/SurveyRespondentDto.java new file mode 100644 index 0000000..2a5808f --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/survey/SurveyRespondentDto.java @@ -0,0 +1,31 @@ +package com.krt.newssak.dto.survey; + +import com.krt.newssak.entity.survey.SurveyRespondentEntity; +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SurveyRespondentDto { + private String projectCode; + private String answerId; + private int surveyTypeCode; + private int answerState; + private String answerStartDate; + private int answerEndQuestionUniqueKey; + private String answerEndDate; + + public static SurveyRespondentDto of(SurveyRespondentEntity surveyRespondentEntity){ + return SurveyRespondentDto.builder() + .projectCode(surveyRespondentEntity.getProjectCode()) + .answerId(surveyRespondentEntity.getAnswerId()) + .surveyTypeCode(surveyRespondentEntity.getSurveyTypeCode()) + .answerState(surveyRespondentEntity.getAnswerState()) + .answerStartDate(surveyRespondentEntity.getAnswerStartDate()) + .answerEndQuestionUniqueKey(surveyRespondentEntity.getAnswerEndQuestionUniqueKey()) + .answerEndDate(surveyRespondentEntity.getAnswerEndDate()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/dto/websocket/QuestionSettingWSInfo.java b/src/main/java/com/krt/newssak/dto/websocket/QuestionSettingWSInfo.java new file mode 100644 index 0000000..8694957 --- /dev/null +++ b/src/main/java/com/krt/newssak/dto/websocket/QuestionSettingWSInfo.java @@ -0,0 +1,33 @@ +package com.krt.newssak.dto.websocket; + +import lombok.*; + +@Setter @Getter +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class QuestionSettingWSInfo { + + private String sessionId; + private String id; + private String projectCode; + private int memberCode; + private String memberName; + private String questionUK; + private String colorCode; + private String messageText; + + static public QuestionSettingWSInfo of(String sessionId,String id, String projectCode, int memberCode, String memberName, String colorCode){ + return QuestionSettingWSInfo.builder() + .sessionId(sessionId) + .id(id) + .projectCode(projectCode) + .memberCode(memberCode) + .memberName(memberName) + .questionUK(null) + .colorCode(colorCode) + .messageText(null) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/autorecode/AutoRecodeEntity.java b/src/main/java/com/krt/newssak/entity/autorecode/AutoRecodeEntity.java new file mode 100644 index 0000000..33a50b9 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/autorecode/AutoRecodeEntity.java @@ -0,0 +1,51 @@ +package com.krt.newssak.entity.autorecode; + +import com.krt.newssak.dto.autorecode.SaveAutoRecodeRequestDto; +import com.krt.newssak.util.Common; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "auto_recode") +public class AutoRecodeEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "IDX") + private int idx; + + @Column(name = "PRJ_CD") + private String projectCode; + + @Column(name = "Q_UK") + private int questionUniqueKey; + + @Column(name = "R_VAL") + private int recodeValue; + + @Column(name = "R_CON") + private String recodeCondition; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; + + @Column(name = "REG_MBR") + private int regMember; + + public static AutoRecodeEntity toEntity(SaveAutoRecodeRequestDto saveAutoRecodeRequestDto){ + return AutoRecodeEntity.builder() + .idx(saveAutoRecodeRequestDto.getIdx()) + .projectCode(saveAutoRecodeRequestDto.getProjectCode()) + .questionUniqueKey(saveAutoRecodeRequestDto.getQuestionUniqueKey()) + .recodeValue(saveAutoRecodeRequestDto.getRecodeValue()) + .recodeCondition(saveAutoRecodeRequestDto.getRecodeCondition()) + .regDate(Common.getNow(null)) + .regMember(saveAutoRecodeRequestDto.getRegMember()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/capi/InterviewerAssignEntity.java b/src/main/java/com/krt/newssak/entity/capi/InterviewerAssignEntity.java new file mode 100644 index 0000000..0b13144 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/capi/InterviewerAssignEntity.java @@ -0,0 +1,41 @@ +package com.krt.newssak.entity.capi; + +import com.krt.newssak.dto.capi.SaveAllocationRequestDto; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "interviewer_assign") +public class InterviewerAssignEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "IDX") + private int idx; + + @Column(name = "IV_CD") + private String interviewerId; + + @Column(name = "PRJ_CD") + private String projectCode; + + @Column(name = "REG_MBR", updatable = false) + private int regMember; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; + + public static InterviewerAssignEntity toEntity(SaveAllocationRequestDto saveAllocationRequestDto){ + return InterviewerAssignEntity.builder() + .interviewerId(saveAllocationRequestDto.getInterviewerCode()) + .projectCode(saveAllocationRequestDto.getProjectCode()) + .regMember(saveAllocationRequestDto.getRegMember()) + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/entity/capi/InterviewerDeleteRequestEntity.java b/src/main/java/com/krt/newssak/entity/capi/InterviewerDeleteRequestEntity.java new file mode 100644 index 0000000..c67eedc --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/capi/InterviewerDeleteRequestEntity.java @@ -0,0 +1,50 @@ +package com.krt.newssak.entity.capi; + + +import com.krt.newssak.dto.capi.DeleteSurveyDataRequestDto; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "interviewer_delete_request") +public class InterviewerDeleteRequestEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "IDX") + private int idx; + + @Column(name = "IV_CD") + private String interviewerId; + + @Column(name = "PRJ_CD") + private String projectCode; + + @Column(name = "ANSWER_ID") + private String answerId; + + @Column(name = "REASON") + private String reason; + + @Column(name = "RESULT") + private int result; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; + + public static InterviewerDeleteRequestEntity toEntity(DeleteSurveyDataRequestDto deleteSurveyDataRequestDto){ + return InterviewerDeleteRequestEntity.builder() + .interviewerId(deleteSurveyDataRequestDto.getInterviewerId()) + .projectCode(deleteSurveyDataRequestDto.getProjectCode()) + .answerId(deleteSurveyDataRequestDto.getAnswerId()) + .reason(deleteSurveyDataRequestDto.getReason()) + .result(deleteSurveyDataRequestDto.getResult()) + .build(); + + } +} diff --git a/src/main/java/com/krt/newssak/entity/capi/InterviewerInfoEntity.java b/src/main/java/com/krt/newssak/entity/capi/InterviewerInfoEntity.java new file mode 100644 index 0000000..db9e9cd --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/capi/InterviewerInfoEntity.java @@ -0,0 +1,54 @@ +package com.krt.newssak.entity.capi; + +import com.krt.newssak.dto.capi.SaveInterviewerRequestDto; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "interviewer_info") +public class InterviewerInfoEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "IDX") + private int idx; + + @Column(name = "CD") + private String code; + + @Column(name = "IV_ID") + private String interviewerId; + + @Column(name = "IV_PW") + private String interviewerPwd; + + @Column(name = "NM") + private String interviewerName; + + @Column(name = "INFO") + private String interviewerInfo; + + @Column(name = "REG_MBR", updatable = false) + private int regMember; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; + + public static InterviewerInfoEntity toEntity(SaveInterviewerRequestDto saveInterviewerRequestDto){ + return InterviewerInfoEntity.builder() + .idx(saveInterviewerRequestDto.getIdx()) + .code(saveInterviewerRequestDto.getCode()) + .interviewerId(saveInterviewerRequestDto.getId()) + .interviewerPwd(saveInterviewerRequestDto.getPwd()) + .interviewerInfo(saveInterviewerRequestDto.getInfo()) + .regMember(saveInterviewerRequestDto.getRegMember()) + .regDate(saveInterviewerRequestDto.getRegDate()) + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/entity/hardcode/HardCodeEntity.java b/src/main/java/com/krt/newssak/entity/hardcode/HardCodeEntity.java new file mode 100644 index 0000000..8537589 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/hardcode/HardCodeEntity.java @@ -0,0 +1,53 @@ +package com.krt.newssak.entity.hardcode; + +import com.krt.newssak.dto.hardcode.HardCodeDto; +import com.krt.newssak.entity_pk.hardcode.HardcodeEntityPK; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(HardcodeEntityPK.class) +@Table(name = "question_hardcode") +public class HardCodeEntity { + + @Column(name = "IDX", insertable = false, updatable = false) + private long id; + + @Id + @Column(name = "PRJ_CD") + private String projectCode; + + @Id + @Column(name = "Q_UK") + private int questionUniqueKey; + + @Id + @Column(name = "TY") + private int hardCodeType; + + @Column(name = "CONTENT") + private String content; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false) + private String regDate; + + public HardCodeDto of(HardCodeEntity hardCodeEntity) { + return HardCodeDto.builder() + .id(hardCodeEntity.getId()) + .projectCode(hardCodeEntity.getProjectCode()) + .questionUniqueKey(hardCodeEntity.getQuestionUniqueKey()) + .hardCodeType(hardCodeEntity.getHardCodeType()) + .content(hardCodeEntity.getContent()) + .regMember(hardCodeEntity.getRegMember()) + .regDate(hardCodeEntity.getRegDate()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/hardcode/HardCodeHistoryEntity.java b/src/main/java/com/krt/newssak/entity/hardcode/HardCodeHistoryEntity.java new file mode 100644 index 0000000..b5494c0 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/hardcode/HardCodeHistoryEntity.java @@ -0,0 +1,52 @@ +package com.krt.newssak.entity.hardcode; + +import com.krt.newssak.dto.hardcode.HardCodeHistoryDto; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.*; + +@Entity +@Getter +@Setter +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "question_hardcode_history") +public class HardCodeHistoryEntity { + + @Id + @Column(name = "IDX", insertable = false, updatable = false) + private long id; + + @Column(name = "PRJ_CD", updatable = false) + private String projectCode; + + @Column(name = "Q_UK") + private int questionUniqueKey; + + @Column(name = "TY") + private int hardCodeType; + + @Column(name = "CONTENT") + private String content; + + @Column(name = "UP_MBR") + private int regMember; + + @Column(name = "UP_DT", insertable = false) + private String regDate; + + public static HardCodeHistoryDto of(HardCodeHistoryEntity hardCodeHistoryEntity) { + return HardCodeHistoryDto.builder() + .projectCode(hardCodeHistoryEntity.getProjectCode()) + .questionUniqueKey(hardCodeHistoryEntity.getQuestionUniqueKey()) + .hardCodeType(hardCodeHistoryEntity.getHardCodeType()) + .content(hardCodeHistoryEntity.getContent()) + .regMember(hardCodeHistoryEntity.getRegMember()) + .regDate(hardCodeHistoryEntity.getRegDate()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/list/ListContentEntity.java b/src/main/java/com/krt/newssak/entity/list/ListContentEntity.java new file mode 100644 index 0000000..16f3564 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/list/ListContentEntity.java @@ -0,0 +1,40 @@ +package com.krt.newssak.entity.list; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "list") +public class ListContentEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "IDX", insertable = false, updatable = false) + private int idx; + + @Column(name = "PRJ_CD") + private String projectCode; + + @Column(name = "LT_ID") + private String listId; + + @Column(name = "LT_INFO") + private String listInfo; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; + + public void listContentUpdate(String listInfo){ + this.listInfo = listInfo; + } +} diff --git a/src/main/java/com/krt/newssak/entity/list/ListHeaderEntity.java b/src/main/java/com/krt/newssak/entity/list/ListHeaderEntity.java new file mode 100644 index 0000000..dcc824b --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/list/ListHeaderEntity.java @@ -0,0 +1,40 @@ +package com.krt.newssak.entity.list; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.*; + +@Entity +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "list_header") +public class ListHeaderEntity { + + @Id + @Column(name = "IDX", insertable = false, updatable = false) + private int idx; + + @Column(name = "PRJ_CD") + private String projectCode; + + @Column(name = "ORDER_NO") + private int orderNo; + + @Column(name = "NM") + private String name; + + @Column(name = "TY") + private String type; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; +} + + diff --git a/src/main/java/com/krt/newssak/entity/member/MemberEntity.java b/src/main/java/com/krt/newssak/entity/member/MemberEntity.java new file mode 100644 index 0000000..7bd5087 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/member/MemberEntity.java @@ -0,0 +1,34 @@ +package com.krt.newssak.entity.member; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Entity +@Getter @Setter +@NoArgsConstructor +@Table(name = "member") +public class MemberEntity { + + @Id + @Column(name = "CD") + private int code; + + @Column(name = "MBR_ID") + private String id; + + @Column(name = "MBR_PW") + private String password; + + @Column(name = "NM") + private String name; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumns({ + @JoinColumn(name = "DIVI_CD"), + @JoinColumn(name = "TM_CD") + }) + private MemberTeamInfoEntity memberTeamInfo; + +} diff --git a/src/main/java/com/krt/newssak/entity/member/MemberProjectManagerEntity.java b/src/main/java/com/krt/newssak/entity/member/MemberProjectManagerEntity.java new file mode 100644 index 0000000..7dc187d --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/member/MemberProjectManagerEntity.java @@ -0,0 +1,28 @@ +package com.krt.newssak.entity.member; + +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "member_project_manager") +public class MemberProjectManagerEntity { + + @Id + @Column(name = "IDX", updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int idx; + + @Column(name = "PRJ_CD") + private String project_code; + + @Column(name = "MBR_CD") + private int member_code; + + @Column(name = "ROLE_CD") + private int role_code; + +} diff --git a/src/main/java/com/krt/newssak/entity/member/MemberTeamInfoEntity.java b/src/main/java/com/krt/newssak/entity/member/MemberTeamInfoEntity.java new file mode 100644 index 0000000..6eab0b1 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/member/MemberTeamInfoEntity.java @@ -0,0 +1,34 @@ +package com.krt.newssak.entity.member; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.ArrayList; +import java.util.List; + +@Entity +@Getter @Setter +@NoArgsConstructor +@Table(name = "member_team_info") +public class MemberTeamInfoEntity { + + @Id + @Column(name = "CD") + private int code; + + @Column(name = "NM") + private String name; + + @Id + @Column(name = "DIVI_CD") + private String divisionCode; + + @Column(name = "DIVI_NM") + private String divisionName; + + @OneToMany(mappedBy = "memberTeamInfo") + private List members = new ArrayList<>(); + +} diff --git a/src/main/java/com/krt/newssak/entity/project/ProjectEntity.java b/src/main/java/com/krt/newssak/entity/project/ProjectEntity.java new file mode 100644 index 0000000..108d826 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/project/ProjectEntity.java @@ -0,0 +1,74 @@ +package com.krt.newssak.entity.project; + +import com.krt.newssak.dto.project.ProjectUpsertDto; +import jakarta.persistence.*; +import lombok.*; +import org.springframework.data.domain.Persistable; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "project") +public class ProjectEntity implements Persistable { + + @Column(name = "IDX", insertable = false, updatable = false) + private int idx; + + @Id + @Column(name = "CD", updatable = false) + private String code; + + @Column(name = "IN_TT") + private String projectTitle; + + @Column(name = "OUT_TT") + private String surveyTitle; + + @Column(name = "ST", updatable = false) + private int state; + + @Column(name = "OWN_TM_CD") + private String ownTeam; + + @Column(name = "COMP") + private int company; + + @Column(name = "REG_MBR", updatable = false) + private int regMember; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; + + @Column(name = "IS_DEL", insertable = false) + private int isDelete; + + @Column(name = "DEL_DT", insertable = false) + private String deleteDate; + + @Transient + private boolean isNew = true; + + @Override + public String getId() { + return this.code; + } + + @Override + public boolean isNew() { + return isNew; + } + + public static ProjectEntity of(ProjectUpsertDto projectUpsertDto){ + return ProjectEntity.builder() + .code(projectUpsertDto.getProject_code()) + .projectTitle(projectUpsertDto.getProject_title()) + .surveyTitle(projectUpsertDto.getSurvey_title()) + .ownTeam(projectUpsertDto.getOwn_team()) + .company(projectUpsertDto.getProject_company()) + .regMember(projectUpsertDto.getReg_member()) + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/entity/project/ProjectFileEntity.java b/src/main/java/com/krt/newssak/entity/project/ProjectFileEntity.java new file mode 100644 index 0000000..57c783b --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/project/ProjectFileEntity.java @@ -0,0 +1,42 @@ +package com.krt.newssak.entity.project; + +import com.krt.newssak.entity_pk.project.ProjectFileEntityPK; +import com.krt.newssak.util.Common; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(ProjectFileEntityPK.class) +@Table(name = "project_file") +public class ProjectFileEntity { + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name = "PRJ_CD") + private String projectCode; + + @Id + @Column(name = "NM") + private String fileName; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT") + private String regDate; + + public static ProjectFileEntity of(String projectCode, String fileName, int memberCode){ + return ProjectFileEntity.builder() + .projectCode(projectCode) + .fileName(fileName) + .regMember(memberCode) + .regDate(Common.getNow(null)) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/project/ProjectHashtagEntity.java b/src/main/java/com/krt/newssak/entity/project/ProjectHashtagEntity.java new file mode 100644 index 0000000..4c26593 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/project/ProjectHashtagEntity.java @@ -0,0 +1,30 @@ +package com.krt.newssak.entity.project; + +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "project_hashtag") +public class ProjectHashtagEntity { + @Id + @Column(name = "IDX", insertable = false, updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int idx; + + @Column(name = "PRJ_CD") + private String projectCode; + + @Column(name = "TAG") + private String hashtag; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; + +} diff --git a/src/main/java/com/krt/newssak/entity/project/ProjectParameterEntity.java b/src/main/java/com/krt/newssak/entity/project/ProjectParameterEntity.java new file mode 100644 index 0000000..804da82 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/project/ProjectParameterEntity.java @@ -0,0 +1,45 @@ +package com.krt.newssak.entity.project; + +import com.krt.newssak.dto.project.ProjectParameterDto; +import com.krt.newssak.entity_pk.project.ProjectParameterEntityPK; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(ProjectParameterEntityPK.class) +@Table(name = "project_parameter") +public class ProjectParameterEntity { + + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name = "PRJ_CD") + private String projectCode; + + @Id + @Column(name = "NM") + private String parameterName; + + @Column(name = "IS_DEF") + private int isDefault; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false) + private String regDate; + + public static ProjectParameterEntity of(ProjectParameterDto projectParameterDto){ + return ProjectParameterEntity.builder() + .projectCode(projectParameterDto.getProject_code()) + .parameterName(projectParameterDto.getParameter_name()) + .isDefault(projectParameterDto.getIs_default()) + .regMember(projectParameterDto.getReg_member()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/project/ProjectRedirectEntity.java b/src/main/java/com/krt/newssak/entity/project/ProjectRedirectEntity.java new file mode 100644 index 0000000..5118089 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/project/ProjectRedirectEntity.java @@ -0,0 +1,70 @@ +package com.krt.newssak.entity.project; + +import com.krt.newssak.dto.project.ProjectRedirectDto; +import com.krt.newssak.entity_pk.project.ProjectRedirectEntityPK; +import com.krt.newssak.enums.DefaultRedirectEnum; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(ProjectRedirectEntityPK.class) +@Table(name = "project_redirect") +public class ProjectRedirectEntity { + + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name = "PRJ_CD", updatable = false) + private String projectCode; + + @Id + @Column(name = "PN_CD") + private String panelCode; + + @Column(name = "PN_NM") + private String panelName; + + @Column(name = "CO") + private String completeUrl; + + @Column(name = "QT") + private String quotaUrl; + + @Column(name = "SC") + private String screenUrl; + + @Column(name = "REG_MBR", updatable = false) + private int regMember; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; + + public static ProjectRedirectEntity of(String projectCode, int regMember, DefaultRedirectEnum dr) { + return ProjectRedirectEntity.builder() + .projectCode(projectCode) + .panelCode(dr.getPanelCode()) + .panelName(dr.getPanelName()) + .completeUrl(dr.getPanelUrl().replace("{STATE}",dr.getCompleteState())) + .quotaUrl(dr.getPanelUrl().replace("{STATE}",dr.getQuotaState())) + .screenUrl(dr.getPanelUrl().replace("{STATE}",dr.getScreenState())) + .regMember(regMember) + .build(); + } + + public static ProjectRedirectEntity of(ProjectRedirectDto projectRedirectDto){ + return ProjectRedirectEntity.builder() + .projectCode(projectRedirectDto.getProject_code()) + .panelCode(projectRedirectDto.getPanel_code()) + .panelName(projectRedirectDto.getPanel_name()) + .completeUrl(projectRedirectDto.getComplete_url()) + .quotaUrl(projectRedirectDto.getQuota_url()) + .screenUrl(projectRedirectDto.getScreen_url()) + .regMember(projectRedirectDto.getReg_member()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/project/ProjectResponseEntity.java b/src/main/java/com/krt/newssak/entity/project/ProjectResponseEntity.java new file mode 100644 index 0000000..053c218 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/project/ProjectResponseEntity.java @@ -0,0 +1,38 @@ +package com.krt.newssak.entity.project; + +import com.krt.newssak.dto.project.OptionElementDto; +import com.krt.newssak.entity_pk.project.ProjectResponseEntityPK; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(ProjectResponseEntityPK.class) +@Table(name = "project_response") +public class ProjectResponseEntity { + + @Column(name = "IDX", insertable = false, updatable = false) + private int idx; + + @Id + @Column(name = "PRJ_CD", updatable = false) + private String projectCode; + + @Id + @Column(name = "RES_OP_CD", updatable = false) + private int optionCode; + + @Column(name = "RES_OP_VAL") + private String optionValue; + + public static ProjectResponseEntity of(String projectCode, OptionElementDto optionElementDto){ + return ProjectResponseEntity.builder() + .projectCode(projectCode) + .optionCode(optionElementDto.getOption_code()) + .optionValue(optionElementDto.getOption_value()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/project/ProjectStyleEntity.java b/src/main/java/com/krt/newssak/entity/project/ProjectStyleEntity.java new file mode 100644 index 0000000..4fffb9e --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/project/ProjectStyleEntity.java @@ -0,0 +1,40 @@ +package com.krt.newssak.entity.project; + +import com.krt.newssak.dto.project.OptionElementDto; +import com.krt.newssak.entity_pk.project.ProjectStyleEntityPK; +import jakarta.persistence.*; +import lombok.*; + +import java.sql.Timestamp; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(ProjectStyleEntityPK.class) +@Table(name = "project_style", schema = "newssak") +public class ProjectStyleEntity { + + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name = "PRJ_CD", updatable = false) + private String projectCode; + + @Id + @Column(name = "CD", updatable = false) + private int styleCode; + + @Column(name = "VAL") + private String styleValue; + + public static ProjectStyleEntity of(String projectCode, OptionElementDto optionElementDto){ + return ProjectStyleEntity.builder() + .projectCode(projectCode) + .styleCode(optionElementDto.getOption_code()) + .styleValue(optionElementDto.getOption_value()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/question/QuestionBlockCollectEntity.java b/src/main/java/com/krt/newssak/entity/question/QuestionBlockCollectEntity.java new file mode 100644 index 0000000..1fb923d --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/question/QuestionBlockCollectEntity.java @@ -0,0 +1,43 @@ +package com.krt.newssak.entity.question; + +import jakarta.persistence.*; +import lombok.*; + +import java.util.Date; + +@Getter +@Setter +@Entity +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "question_block_collection") +public class QuestionBlockCollectEntity { + + @Id + @Column(name = "IDX", insertable = false, updatable = false) + @GeneratedValue(strategy= GenerationType.IDENTITY) + private int idx; + + @Column(name = "PRJ_CD") + private String projectCode; + + @Column(name = "BK_CD") + private int blockCode; + + @Column(name = "Q_UK") + private int questionUniqueKey; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false) + private Date regDate; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumns({ + @JoinColumn(name = "PRJ_CD", referencedColumnName = "PRJ_CD", insertable = false, updatable = false), + @JoinColumn(name = "BK_CD", referencedColumnName = "CD", insertable = false, updatable = false) + }) + private QuestionBlockEntity questionBlockEntity; +} diff --git a/src/main/java/com/krt/newssak/entity/question/QuestionBlockEntity.java b/src/main/java/com/krt/newssak/entity/question/QuestionBlockEntity.java new file mode 100644 index 0000000..7c5c442 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/question/QuestionBlockEntity.java @@ -0,0 +1,59 @@ +package com.krt.newssak.entity.question; + +import com.krt.newssak.dto.question.QuestionBlockRequestDto; +import com.krt.newssak.entity_pk.question.QuestionBlockEntityPk; +import jakarta.persistence.*; +import lombok.*; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Getter +@Setter +@Entity +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(QuestionBlockEntityPk.class) +@Table(name = "question_block") +public class QuestionBlockEntity { + + @Column(name = "IDX", insertable = false, updatable = false) + @GeneratedValue(strategy= GenerationType.IDENTITY) + private int idx; + + @Id + @Column(name = "PRJ_CD") + private String projectCode; + + @Id + @Column(name = "CD") + private int blockCode; + + @Column(name = "NM") + private String blockName; + + @Column(name = "TY") + private int blockType; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false) + private Date regDate; + + @OneToMany(mappedBy = "questionBlockEntity") + private List blockCollectList = new ArrayList<>(); + + public static QuestionBlockEntity toEntity(QuestionBlockRequestDto questionBlockRequestDto){ + return QuestionBlockEntity.builder() + .projectCode(questionBlockRequestDto.getProject_code()) + .blockCode(questionBlockRequestDto.getBlock_code()) + .blockName(questionBlockRequestDto.getBlock_name()) + .blockType(questionBlockRequestDto.getBlock_type()) + .regMember(questionBlockRequestDto.getReg_member()) + .regDate(new Date()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/question/QuestionBlockOptionEntity.java b/src/main/java/com/krt/newssak/entity/question/QuestionBlockOptionEntity.java new file mode 100644 index 0000000..2812151 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/question/QuestionBlockOptionEntity.java @@ -0,0 +1,50 @@ +package com.krt.newssak.entity.question; + +import com.google.gson.Gson; +import com.krt.newssak.dto.question.QuestionUpsertDto; +import com.krt.newssak.entity_pk.question.QuestionBlockEntityPk; +import com.krt.newssak.util.Common; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(QuestionBlockEntityPk.class) +@Table(name = "question_block_option") +public class QuestionBlockOptionEntity { + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name = "PRJ_CD", updatable = false) + private String projectCode; + + @Id + @Column(name = "BK_CD", updatable = false) + private int blockCode; + + @Column(name = "OPT_VAL") + private String optionValue; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false) + private String regDate; + + public static QuestionBlockOptionEntity of(QuestionUpsertDto questionUpsertDto){ + Gson gson = new Gson(); + + return QuestionBlockOptionEntity.builder() + .projectCode(questionUpsertDto.getProject_code()) + .blockCode(questionUpsertDto.getBlock_id()) + .optionValue(gson.toJson(questionUpsertDto.getQuestion_block_option())) + .regMember(questionUpsertDto.getReg_member()) + .regDate(Common.getNow(null)) + .build(); + + } +} diff --git a/src/main/java/com/krt/newssak/entity/question/QuestionEntity.java b/src/main/java/com/krt/newssak/entity/question/QuestionEntity.java new file mode 100644 index 0000000..51ef88e --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/question/QuestionEntity.java @@ -0,0 +1,87 @@ +package com.krt.newssak.entity.question; + +import com.krt.newssak.dto.question.QuestionUpsertDto; +import com.krt.newssak.entity_pk.question.QuestionEntityPK; +import com.krt.newssak.util.Common; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(QuestionEntityPK.class) +@Table(name = "question") +public class QuestionEntity { + + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name = "PRJ_CD", updatable = false) + private String projectCode; + + @Id + @Column(name = "Q_UK") + private int questionUniqueKey; + + @Column(name = "Q_ODR") + private int questionOrder; + + @Column(name = "Q_ID") + private String questionID; + + @Column(name = "NM") + private String questionName; + + @Column(name = "DIM") + private int questionDimension; + + @Column(name = "TY") + private int questionType; + + @Column(name = "EXP_TXT") + private String questionExplain; + + @Column(name = "TT") + private String questionTitle; + + @Column(name = "DES") + private String questionDescription; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false) + private String regDate; + + @Column(name = "IS_DEL", insertable = false) + private int isDelete; + + @Column(name = "DEL_DT", insertable = false) + private String deleteDate; + + public static QuestionEntity toEntity(QuestionUpsertDto questionUpsertDto){ + int questionType = questionUpsertDto.getQuestion_type(); + if(questionUpsertDto.getQuestion_dimension() == 9){ + questionType = (questionUpsertDto.getAuto_type() * 100) + questionType; + } + + return QuestionEntity.builder() + .projectCode(questionUpsertDto.getProject_code()) + .questionUniqueKey(questionUpsertDto.getQuestion_unique_key()) + .questionOrder(questionUpsertDto.getQuestion_order()) + .questionID(questionUpsertDto.getQuestion_id()) + .questionName(questionUpsertDto.getQuestion_name()) + .questionDimension(questionUpsertDto.getQuestion_dimension()) + .questionType(questionType) + .questionExplain(questionUpsertDto.getQuestion_explain()) + .questionTitle(questionUpsertDto.getQuestion_title()) + .questionDescription(questionUpsertDto.getQuestion_description()) + .regMember(questionUpsertDto.getReg_member()) + .regDate(Common.getNow(null)) + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/entity/question/QuestionHardcodeEntity.java b/src/main/java/com/krt/newssak/entity/question/QuestionHardcodeEntity.java new file mode 100644 index 0000000..f310583 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/question/QuestionHardcodeEntity.java @@ -0,0 +1,51 @@ +package com.krt.newssak.entity.question; + +import com.krt.newssak.dto.question.QuestionHardcodeDto; +import com.krt.newssak.entity_pk.question.QuestionEntityPK; +import com.krt.newssak.util.Common; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(QuestionEntityPK.class) +@Table(name = "question_hardcode") +public class QuestionHardcodeEntity { + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name = "PRJ_CD", updatable = false) + private String projectCode; + + @Id + @Column(name = "Q_UK", updatable = false) + private int questionUniqueKey; + + @Column(name = "TY") + private int hardcodeType; + + @Column(name = "CONTENT") + private String hardcodeContent; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false) + private String regDate; + + public static QuestionHardcodeEntity of(QuestionHardcodeDto questionHardcodeDto){ + return QuestionHardcodeEntity.builder() + .projectCode(questionHardcodeDto.getProject_code()) + .questionUniqueKey(questionHardcodeDto.getQuestion_unique_key()) + .hardcodeType(questionHardcodeDto.getHardcode_type()) + .hardcodeContent(questionHardcodeDto.getHardcode_content()) + .regMember(questionHardcodeDto.getReg_member()) + .regDate(Common.getNow(null)) + .build(); + + } +} diff --git a/src/main/java/com/krt/newssak/entity/question/QuestionHardcodeHistoryEntity.java b/src/main/java/com/krt/newssak/entity/question/QuestionHardcodeHistoryEntity.java new file mode 100644 index 0000000..c3acc8a --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/question/QuestionHardcodeHistoryEntity.java @@ -0,0 +1,51 @@ +package com.krt.newssak.entity.question; + +import com.krt.newssak.dto.question.QuestionHardcodeDto; +import com.krt.newssak.util.Common; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.*; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "question_hardcode_history") +public class QuestionHardcodeHistoryEntity { + @Id + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Column(name = "PRJ_CD", updatable = false) + private String projectCode; + + @Column(name = "Q_UK", updatable = false) + private int questionUniqueKey; + + @Column(name = "TY", updatable = false) + private int hardcodeType; + + @Column(name = "CONTENT", updatable = false) + private String hardcodeContent; + + @Column(name = "UP_MBR", updatable = false) + private int upMember; + + @Column(name = "UP_DT", insertable = false) + private String upDate; + + public static QuestionHardcodeHistoryEntity of(QuestionHardcodeDto questionHardcodeDto){ + return QuestionHardcodeHistoryEntity.builder() + .projectCode(questionHardcodeDto.getProject_code()) + .questionUniqueKey(questionHardcodeDto.getQuestion_unique_key()) + .hardcodeType(questionHardcodeDto.getHardcode_type()) + .hardcodeContent(questionHardcodeDto.getHardcode_content()) + .upMember(questionHardcodeDto.getReg_member()) + .upDate(Common.getNow(null)) + .build(); + + } +} diff --git a/src/main/java/com/krt/newssak/entity/question/QuestionLabelEntity.java b/src/main/java/com/krt/newssak/entity/question/QuestionLabelEntity.java new file mode 100644 index 0000000..e108fff --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/question/QuestionLabelEntity.java @@ -0,0 +1,46 @@ +package com.krt.newssak.entity.question; + +import com.krt.newssak.entity_pk.question.QuestionLabelEntityPK; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter @Setter +@Builder +@IdClass(QuestionLabelEntityPK.class) +@Table(name = "question_label") +@NoArgsConstructor +@AllArgsConstructor +public class QuestionLabelEntity { + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name = "PRJ_CD", updatable = false) + private String projectCode; + + @Id + @Column(name = "Q_UK", updatable = false) + private int questionUniqueKey; + + @Id + @Column(name = "DIM", updatable = false) + private int labelDimension; + + @Column(name = "L_INFO") + private String labelInfo; + + @Column(name = "L_OPT") + private String labelOption; + + public static QuestionLabelEntity of(String projectCode, int questionUniqueKey, int labelDimension, String labelInfo, String labelOption){ + return QuestionLabelEntity.builder() + .projectCode(projectCode) + .questionUniqueKey(questionUniqueKey) + .labelDimension(labelDimension) + .labelInfo(labelInfo) + .labelOption(labelOption) + .build(); + + } +} diff --git a/src/main/java/com/krt/newssak/entity/question/QuestionLogicEntity.java b/src/main/java/com/krt/newssak/entity/question/QuestionLogicEntity.java new file mode 100644 index 0000000..0e2be90 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/question/QuestionLogicEntity.java @@ -0,0 +1,51 @@ +package com.krt.newssak.entity.question; + +import com.krt.newssak.dto.question.QuestionLogicDto; +import com.krt.newssak.entity_pk.question.QuestionEntityPK; +import com.krt.newssak.util.Common; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(QuestionEntityPK.class) +@Table(name="question_logic") +public class QuestionLogicEntity { + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name = "PRJ_CD", updatable = false) + private String projectCode; + + @Id + @Column(name = "Q_UK", updatable = false) + private int questionUniqueKey; + + @Column(name = "B_LGC") + private String beforeLogic; + + @Column(name = "A_LGC") + private String afterLogic; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false) + private String regDate; + + public static QuestionLogicEntity of(String projectCode, int questionUniqueKey, String beforeLogic, String afterLogic, int regMember){ + return QuestionLogicEntity.builder() + .projectCode(projectCode) + .questionUniqueKey(questionUniqueKey) + .beforeLogic(beforeLogic) + .afterLogic(afterLogic) + .regMember(regMember) + .regDate(Common.getNow(null)) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/question/QuestionOptionEntity.java b/src/main/java/com/krt/newssak/entity/question/QuestionOptionEntity.java new file mode 100644 index 0000000..7fde35f --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/question/QuestionOptionEntity.java @@ -0,0 +1,50 @@ +package com.krt.newssak.entity.question; + +import com.google.gson.Gson; +import com.krt.newssak.dto.question.QuestionUpsertDto; +import com.krt.newssak.entity_pk.question.QuestionEntityPK; +import com.krt.newssak.util.Common; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(QuestionEntityPK.class) +@Table(name = "question_option") +public class QuestionOptionEntity { + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name = "PRJ_CD", updatable = false) + private String projectCode; + + @Id + @Column(name = "Q_UK", updatable = false) + private int questionUniqueKey; + + @Column(name = "OPT_VAL") + private String optionInfo; + + @Column(name = "REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false) + private String regDate; + + public static QuestionOptionEntity of(QuestionUpsertDto questionUpsertDto){ + Gson gson = new Gson(); + + return QuestionOptionEntity.builder() + .projectCode(questionUpsertDto.getProject_code()) + .questionUniqueKey(questionUpsertDto.getQuestion_unique_key()) + .optionInfo(gson.toJson(questionUpsertDto.getQuestion_option())) + .regMember(questionUpsertDto.getReg_member()) + .regDate(Common.getNow(null)) + .build(); + + } +} diff --git a/src/main/java/com/krt/newssak/entity/quota/QuotaCellEntity.java b/src/main/java/com/krt/newssak/entity/quota/QuotaCellEntity.java new file mode 100644 index 0000000..701c6bb --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/quota/QuotaCellEntity.java @@ -0,0 +1,51 @@ +package com.krt.newssak.entity.quota; + +import com.google.gson.Gson; +import com.krt.newssak.dto.quota.QuotaCellDto; +import jakarta.persistence.*; +import lombok.*; + +@Getter +@Setter +@Entity +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name="quota_cell") +public class QuotaCellEntity { + @Id + @Column(name="IDX", insertable = false, updatable = false) + @GeneratedValue(strategy= GenerationType.IDENTITY) + private long idx; + + @Column(name="PRJ_CD") + private String projectCode; + + @Column(name="QT_CD") + private int quotaCode; + + @Column(name="QT_CNT") + private int quotaCount; + + @Column(name="VW_CNT") + private int viewCount; + + @Column(name="QT_INFO") + private String quotaInfo; + + @Column(name="IS_USE") + private int isUse; + + public static QuotaCellEntity toEntity(String projectCode, int quotaCode, QuotaCellDto quotaCellDto){ + Gson gson = new Gson(); + + return QuotaCellEntity.builder() + .projectCode(projectCode) + .quotaCode(quotaCode) + .quotaCount(quotaCellDto.getQuotaCount()) + .viewCount(quotaCellDto.getViewCount()) + .quotaInfo(gson.toJson(quotaCellDto.getQuotaInfo())) + .isUse(quotaCellDto.getIsUse()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/quota/QuotaEntity.java b/src/main/java/com/krt/newssak/entity/quota/QuotaEntity.java new file mode 100644 index 0000000..5f32809 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/quota/QuotaEntity.java @@ -0,0 +1,62 @@ +package com.krt.newssak.entity.quota; + +import com.google.gson.Gson; +import com.krt.newssak.dto.quota.QuotaUpsertDto; +import com.krt.newssak.entity_pk.quota.QuotaEntityPK; +import jakarta.persistence.*; +import lombok.*; + +@Getter +@Setter +@Entity +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(QuotaEntityPK.class) +@Table(name="quota") +public class QuotaEntity { + + @Column(name="IDX", insertable = false, updatable = false) + @GeneratedValue(strategy= GenerationType.IDENTITY) + private long idx; + + @Id + @Column(name="PRJ_CD") + private String projectCode; + + @Id + @Column(name="CD") + private int quotaCode; + + @Column(name="IS_BST") + private int isBooster; + + @Column(name="ROW_QUK") + private String rowQuestionUniqueKey; + + @Column(name="COL_QUK") + private String colQuestionUniqueKey; + + @Column(name="TT") + private String quotaTitle; + + @Column(name="REG_MBR") + private int regMember; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; + + public static QuotaEntity toEntity(QuotaUpsertDto quotaUpsertDto){ + Gson gson = new Gson(); + + return QuotaEntity.builder() + .projectCode(quotaUpsertDto.getProjectCode()) + .quotaCode(quotaUpsertDto.getQuotaCode()) + .isBooster(quotaUpsertDto.getIsBooster()) + .rowQuestionUniqueKey(gson.toJson(quotaUpsertDto.getRowQuestionList())) + .colQuestionUniqueKey(gson.toJson(quotaUpsertDto.getColQuestionList())) + .quotaTitle(quotaUpsertDto.getQuotaTitle()) + .regMember(quotaUpsertDto.getRegMember()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity/survey/SurveyDataEntity.java b/src/main/java/com/krt/newssak/entity/survey/SurveyDataEntity.java new file mode 100644 index 0000000..ea99eff --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/survey/SurveyDataEntity.java @@ -0,0 +1,69 @@ +package com.krt.newssak.entity.survey; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.newssak.dto.datamange.AnswerDataDto; +import com.krt.newssak.dto.datamange.SurveyDataStructureDto; +import com.krt.newssak.entity.question.QuestionEntity; +import com.krt.newssak.entity_pk.survey.SurveyDataEntityPK; +import jakarta.persistence.*; +import lombok.*; + +import java.lang.reflect.Type; +import java.util.List; + +@Entity +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(SurveyDataEntityPK.class) +@Table(name = "survey_data") +public class SurveyDataEntity { + + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name="PRJ_CD") + private String projectCode; + + @Id + @Column(name = "ANS_ID") + private String answerID; + + @Id + @Column(name = "Q_UK") + private int questionUniqueKey; + + @Id + @Column(name = "LOOP_ID") + private int loopID; + + @Column(name = "ANS_DATA") + private String answerData; + + @Column(name = "ANS_DT", insertable = false) + private String answerDate; + + @OneToOne + @JoinColumns({ + @JoinColumn(name = "PRJ_CD"), + @JoinColumn(name = "Q_UK") + }) + private QuestionEntity questionEntity; + + public static AnswerDataDto of(SurveyDataEntity surveyDataEntity) { + // Todo : 어디에 쓰는 것인지 확인하고 없어져도 된다면 삭제 + Gson gson = new Gson(); + Type surveyDataType = new TypeToken>(){}.getType(); + List surveyDataStructureDtoList = gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType); + + return AnswerDataDto.builder() + .loopId(surveyDataEntity.getLoopID()) + .surveyDataStructureDtoList(surveyDataStructureDtoList) + .build(); + + } +} diff --git a/src/main/java/com/krt/newssak/entity/survey/SurveyRespondentEntity.java b/src/main/java/com/krt/newssak/entity/survey/SurveyRespondentEntity.java new file mode 100644 index 0000000..d1060f0 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity/survey/SurveyRespondentEntity.java @@ -0,0 +1,69 @@ +package com.krt.newssak.entity.survey; + +import com.krt.newssak.dto.datamange.GetAnswerUserResponseDto; +import com.krt.newssak.entity_pk.survey.SurveyRespondentEntityPK; +import com.krt.newssak.util.Common; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(SurveyRespondentEntityPK.class) +@Table(name = "survey_respondent") +public class SurveyRespondentEntity { + @Column(name = "IDX", insertable = false, updatable = false) + private long idx; + + @Id + @Column(name = "PRJ_CD") + private String projectCode; + + @Id + @Column(name = "ANS_ID") + private String answerId; + + @Column(name = "SV_TY_CD") + private int surveyTypeCode; + + @Column(name = "ANS_ST") + private int answerState; + + @Column(name = "ANS_S_DT", insertable = false, updatable = false) + private String answerStartDate; + + @Column(name = "ANS_E_Q_UK") + private int answerEndQuestionUniqueKey; + + @Column(name = "ANS_LOOP_ID") + private int answerLoopId; + + @Column(name = "ANS_E_DT", insertable = false) + private String answerEndDate; + + public static SurveyRespondentEntity of(String projectCode, String answerId, int surveyTypeCode, int answerState, int answerEndQuestionUniqueKey){ + return SurveyRespondentEntity.builder() + .projectCode(projectCode) + .answerId(answerId) + .surveyTypeCode(surveyTypeCode) + .answerState(answerState) + .answerEndQuestionUniqueKey(answerEndQuestionUniqueKey) + .answerEndDate(Common.getNow(null)) + .build(); + } + + public static GetAnswerUserResponseDto of(SurveyRespondentEntity surveyRespondentEntity){ + return GetAnswerUserResponseDto.builder() + .answerId(surveyRespondentEntity.getAnswerId()) + .surveyTypeCode(surveyRespondentEntity.getSurveyTypeCode()) + .answerState(surveyRespondentEntity.getAnswerState()) + .answerStartDate(surveyRespondentEntity.getAnswerStartDate()) + .endUniqueKey(surveyRespondentEntity.getAnswerEndQuestionUniqueKey()) + .endLoopId(surveyRespondentEntity.getAnswerLoopId()) + .answerEndTime(surveyRespondentEntity.getAnswerEndDate()) + .build(); + } +} diff --git a/src/main/java/com/krt/newssak/entity_pk/hardcode/HardcodeEntityPK.java b/src/main/java/com/krt/newssak/entity_pk/hardcode/HardcodeEntityPK.java new file mode 100644 index 0000000..103d73d --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/hardcode/HardcodeEntityPK.java @@ -0,0 +1,12 @@ +package com.krt.newssak.entity_pk.hardcode; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class HardcodeEntityPK implements Serializable { + private String projectCode; + private int questionUniqueKey; + private int hardCodeType; +} diff --git a/src/main/java/com/krt/newssak/entity_pk/project/ProjectFileEntityPK.java b/src/main/java/com/krt/newssak/entity_pk/project/ProjectFileEntityPK.java new file mode 100644 index 0000000..be5ffb2 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/project/ProjectFileEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.newssak.entity_pk.project; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ProjectFileEntityPK implements Serializable { + private String projectCode; + private String fileName; +} diff --git a/src/main/java/com/krt/newssak/entity_pk/project/ProjectParameterEntityPK.java b/src/main/java/com/krt/newssak/entity_pk/project/ProjectParameterEntityPK.java new file mode 100644 index 0000000..88f9538 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/project/ProjectParameterEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.newssak.entity_pk.project; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ProjectParameterEntityPK implements Serializable { + private String projectCode; + private String parameterName; +} diff --git a/src/main/java/com/krt/newssak/entity_pk/project/ProjectRedirectEntityPK.java b/src/main/java/com/krt/newssak/entity_pk/project/ProjectRedirectEntityPK.java new file mode 100644 index 0000000..954a5ef --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/project/ProjectRedirectEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.newssak.entity_pk.project; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ProjectRedirectEntityPK implements Serializable { + private String projectCode; + private String panelCode; +} diff --git a/src/main/java/com/krt/newssak/entity_pk/project/ProjectResponseEntityPK.java b/src/main/java/com/krt/newssak/entity_pk/project/ProjectResponseEntityPK.java new file mode 100644 index 0000000..841ae5c --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/project/ProjectResponseEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.newssak.entity_pk.project; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ProjectResponseEntityPK implements Serializable { + private String projectCode; + private int optionCode; +} diff --git a/src/main/java/com/krt/newssak/entity_pk/project/ProjectStyleEntityPK.java b/src/main/java/com/krt/newssak/entity_pk/project/ProjectStyleEntityPK.java new file mode 100644 index 0000000..1261eb4 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/project/ProjectStyleEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.newssak.entity_pk.project; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ProjectStyleEntityPK implements Serializable { + private String projectCode; + private int styleCode; +} diff --git a/src/main/java/com/krt/newssak/entity_pk/question/QuestionBlockCollectEntityPk.java b/src/main/java/com/krt/newssak/entity_pk/question/QuestionBlockCollectEntityPk.java new file mode 100644 index 0000000..23d6256 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/question/QuestionBlockCollectEntityPk.java @@ -0,0 +1,18 @@ +package com.krt.newssak.entity_pk.question; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode +public class QuestionBlockCollectEntityPk implements Serializable { + + private String projectCode; + private int blockCode; +} diff --git a/src/main/java/com/krt/newssak/entity_pk/question/QuestionBlockEntityPk.java b/src/main/java/com/krt/newssak/entity_pk/question/QuestionBlockEntityPk.java new file mode 100644 index 0000000..9f5c5ce --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/question/QuestionBlockEntityPk.java @@ -0,0 +1,19 @@ +package com.krt.newssak.entity_pk.question; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode +public class QuestionBlockEntityPk implements Serializable { + + private String projectCode; + private int blockCode; + +} diff --git a/src/main/java/com/krt/newssak/entity_pk/question/QuestionEntityPK.java b/src/main/java/com/krt/newssak/entity_pk/question/QuestionEntityPK.java new file mode 100644 index 0000000..f144d03 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/question/QuestionEntityPK.java @@ -0,0 +1,13 @@ +package com.krt.newssak.entity_pk.question; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QuestionEntityPK implements Serializable { + + private int questionUniqueKey; + private String projectCode; + +} diff --git a/src/main/java/com/krt/newssak/entity_pk/question/QuestionLabelEntityPK.java b/src/main/java/com/krt/newssak/entity_pk/question/QuestionLabelEntityPK.java new file mode 100644 index 0000000..22a39c1 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/question/QuestionLabelEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.newssak.entity_pk.question; + +import lombok.Data; +import java.io.Serializable; + +@Data +public class QuestionLabelEntityPK implements Serializable { + private int questionUniqueKey; + private String projectCode; + private int labelDimension; +} diff --git a/src/main/java/com/krt/newssak/entity_pk/quota/QuotaEntityPK.java b/src/main/java/com/krt/newssak/entity_pk/quota/QuotaEntityPK.java new file mode 100644 index 0000000..25b8702 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/quota/QuotaEntityPK.java @@ -0,0 +1,10 @@ +package com.krt.newssak.entity_pk.quota; + +import lombok.Data; +import java.io.Serializable; + +@Data +public class QuotaEntityPK implements Serializable { + private String projectCode; + private int quotaCode; +} diff --git a/src/main/java/com/krt/newssak/entity_pk/survey/SurveyDataEntityPK.java b/src/main/java/com/krt/newssak/entity_pk/survey/SurveyDataEntityPK.java new file mode 100644 index 0000000..c7c21a9 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/survey/SurveyDataEntityPK.java @@ -0,0 +1,12 @@ +package com.krt.newssak.entity_pk.survey; + +import lombok.Data; +import java.io.Serializable; + +@Data +public class SurveyDataEntityPK implements Serializable { + private String projectCode; + private String answerID; + private int questionUniqueKey; + private int loopID; +} diff --git a/src/main/java/com/krt/newssak/entity_pk/survey/SurveyRespondentEntityPK.java b/src/main/java/com/krt/newssak/entity_pk/survey/SurveyRespondentEntityPK.java new file mode 100644 index 0000000..47ca126 --- /dev/null +++ b/src/main/java/com/krt/newssak/entity_pk/survey/SurveyRespondentEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.newssak.entity_pk.survey; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SurveyRespondentEntityPK implements Serializable { + private String projectCode; + private String answerId; +} diff --git a/src/main/java/com/krt/newssak/enums/DefaultParameterEnum.java b/src/main/java/com/krt/newssak/enums/DefaultParameterEnum.java new file mode 100644 index 0000000..32cef8b --- /dev/null +++ b/src/main/java/com/krt/newssak/enums/DefaultParameterEnum.java @@ -0,0 +1,19 @@ +package com.krt.newssak.enums; + +import lombok.Getter; +import lombok.ToString; + +@Getter +@ToString +public enum DefaultParameterEnum { + + ECHO("ECHO"), + SID("SID"), + PANNEL("PANEL"); + + private String parameterName; + + DefaultParameterEnum(String parameterName){ + this.parameterName = parameterName; + } +} diff --git a/src/main/java/com/krt/newssak/enums/DefaultQuestionEnum.java b/src/main/java/com/krt/newssak/enums/DefaultQuestionEnum.java new file mode 100644 index 0000000..70ae8e6 --- /dev/null +++ b/src/main/java/com/krt/newssak/enums/DefaultQuestionEnum.java @@ -0,0 +1,27 @@ +package com.krt.newssak.enums; + +import lombok.Getter; +import lombok.ToString; + +@Getter +@ToString +public enum DefaultQuestionEnum { + INDEX("INDEX","","",0), + END("END","설문조사가<br>완료되었습니다.","설문에 참여해 주셔서 감사합니다.",-1), + SCREEN("SCREEN","죄송합니다.<br>조사 대상자가 아닙니다.","설문에 참여해주셔서 감사합니다.",-1), + QUOTA("QUOTA","죄송합니다.<br>설문이 마감되었습니다.","설문에 참여해주셔서 감사합니다.",-1), + CLOSE("CLOSE","죄송합니다.<br>설문이 마감되었습니다.","설문에 참여해주셔서 감사합니다.",-1), + ALREADY("ALREADY","이미 참여 해주신 설문 입니다.","설문에 참여해주셔서 감사합니다.",-1); + + private final String questionId; + private final String questionTitle; + private final String questionDescription; + private final int questionOrder; + + DefaultQuestionEnum(String questionId, String questionTitle, String questionDescription, int questionOrder) { + this.questionId = questionId; + this.questionTitle = questionTitle; + this.questionDescription = questionDescription; + this.questionOrder = questionOrder; + } +} diff --git a/src/main/java/com/krt/newssak/enums/DefaultRedirectEnum.java b/src/main/java/com/krt/newssak/enums/DefaultRedirectEnum.java new file mode 100644 index 0000000..c98bb1e --- /dev/null +++ b/src/main/java/com/krt/newssak/enums/DefaultRedirectEnum.java @@ -0,0 +1,28 @@ +package com.krt.newssak.enums; + +import lombok.Getter; +import lombok.ToString; + +@Getter +@ToString +public enum DefaultRedirectEnum { + KIWI("KIWI","키위","https://kiwisurvey.kr/survey/complete?TK={ECHO}&SID={SID}&completionStatus={STATE}","1","4","2"), + CLOUD_PANEL("CLD","클라우드 패널","https://join.cloudpanel.co.kr/join/result?CAMPAIGN_ID={ECHO}&PANEL_SEQ={SID}&RESULT={STATE}&CHECKSUM=[#CHECKSUM#]","1","2","3"), + DATA_SPRING("DSP","데이터 스프링","https://d8aspring.post-survey.com/ans/back?key={ECHO}&uid={SID}&status={STATE}","comp","quotafull","scrout"); + + private final String panelCode; + private final String panelName; + private final String panelUrl; + private final String completeState; + private final String quotaState; + private final String screenState; + + DefaultRedirectEnum(String panelCode, String panelName, String panelUrl, String completeState, String quotaState, String screenState){ + this.panelCode = panelCode; + this.panelName = panelName; + this.panelUrl = panelUrl; + this.completeState = completeState; + this.quotaState = quotaState; + this.screenState = screenState; + } +} diff --git a/src/main/java/com/krt/newssak/enums/DefaultResponseEnum.java b/src/main/java/com/krt/newssak/enums/DefaultResponseEnum.java new file mode 100644 index 0000000..5e9825a --- /dev/null +++ b/src/main/java/com/krt/newssak/enums/DefaultResponseEnum.java @@ -0,0 +1,25 @@ +package com.krt.newssak.enums; + +import lombok.Getter; +import lombok.ToString; + +@Getter +@ToString +public enum DefaultResponseEnum { + IS_BACK(110, 0), //뒤로가기 + ALL_QUOTA_CHECK(120, 0), //모든 문항 쿼터 체크 + ACCEPT_DEVICE_PC(211, 1), //허용디바이스 - PC + ACCEPT_DEVICE_TABLET(212, 1), //허용디바이스 - 태블릿 + ACCEPT_DEVICE_MOBILE_HORIZON(213, 1), //허용디바이스 - 모바일 가로 + ACCEPT_DEVICE_MOBILE_VERTICAL(214, 1), //허용디바이스 - 모바일 세로 + PROGRESS_DATA_STORAGE_DATE(310, 30), //데이터 보관 기간 + SURVEY_OPEN(320, 1); // 설문 무기한 공개 여부 + + private final int code; + private final int status; + + DefaultResponseEnum(int code, int status) { + this.code = code; + this.status = status; + } +} diff --git a/src/main/java/com/krt/newssak/enums/DefaultStyleOptionEnum.java b/src/main/java/com/krt/newssak/enums/DefaultStyleOptionEnum.java new file mode 100644 index 0000000..0205a91 --- /dev/null +++ b/src/main/java/com/krt/newssak/enums/DefaultStyleOptionEnum.java @@ -0,0 +1,29 @@ +package com.krt.newssak.enums; + +import lombok.Getter; +import lombok.ToString; + +@Getter +@ToString +public enum DefaultStyleOptionEnum { + LOGO_FILE(101, new String[]{"kri_logo.png","krc_logo.png","kiwi_logo.png"}), //로고 파일 경로 + LOGO_VERTICAL(102, new String[]{"T"}), //로고 파일 수직 정렬 T 위, B 아래 + LOGO_HORIZON(103, new String[]{"C"}), //로고 파일 수평 정렬 L 왼, C 가, R 오 + LOGO_WIDTH(104, new String[]{"10","10","15"}), //로고 파일의 높이 % 0 -> 파일의 원본 크기 + LOGO_HEIGHT(105, new String[]{"100"}), //로고 파일의 높이 % 0 -> 파일의 원본 크기 + BUTTON_NEXT_TEXT(201, new String[]{"Next"}), //다음 버튼 TEXT + BUTTON_PREV_TEXT(202, new String[]{"Prev"}), //이전 버튼 TEXT + USE_PROGRESS(301, new String[]{"1"}), //진행률 사용여부 0사용 X, 1 사용 + USE_QUESTION_NAME(302, new String[]{"1"}), //질문 번호 사용여부 0사용 X, 1 사용 + COLOR_CODE(401, new String[]{"#284668","#284668","#1CAE81"}), //메인 컬러 헥사 + SHADOW_CODE(402, new String[]{"#DEE2E6","#DEE2E6","#E7F0E6"}); //음영 컬러 헥사 + // 코드 + + private final int code; + private final String[] values; + + DefaultStyleOptionEnum(int code, String[] values){ + this.code = code; + this.values = values; + } +} diff --git a/src/main/java/com/krt/newssak/eventhandler/WebSocketEventListener.java b/src/main/java/com/krt/newssak/eventhandler/WebSocketEventListener.java new file mode 100644 index 0000000..df11661 --- /dev/null +++ b/src/main/java/com/krt/newssak/eventhandler/WebSocketEventListener.java @@ -0,0 +1,63 @@ +package com.krt.newssak.eventhandler; +import com.krt.newssak.dto.websocket.QuestionSettingWSInfo; +import com.krt.newssak.service.WebSocketService; +import org.springframework.context.event.EventListener; +import org.springframework.messaging.simp.SimpMessagingTemplate; +import org.springframework.messaging.simp.stomp.StompHeaderAccessor; +import org.springframework.stereotype.Component; +import org.springframework.web.socket.messaging.SessionConnectEvent; +import org.springframework.web.socket.messaging.SessionDisconnectEvent; + +import java.util.ArrayList; + +@Component +public class WebSocketEventListener { + private final WebSocketService webSocketService; + private final SimpMessagingTemplate simpMessagingTemplate; + public WebSocketEventListener(WebSocketService webSocketService, SimpMessagingTemplate simpMessagingTemplate) { + this.webSocketService = webSocketService; + this.simpMessagingTemplate = simpMessagingTemplate; + } + + //Connection 연결되는 순간 방에 입장! + @EventListener + public void handleConnectEvent(SessionConnectEvent event) { + StompHeaderAccessor headerAccessor = StompHeaderAccessor.wrap(event.getMessage()); + + String sessionId = headerAccessor.getSessionId(); + String wsId = headerAccessor.getFirstNativeHeader("id"); + String projectCode = headerAccessor.getFirstNativeHeader("projectCode"); + String memberCodeString = headerAccessor.getFirstNativeHeader("memberCode"); + int memberCode = Integer.parseInt(headerAccessor.getFirstNativeHeader("memberCode")); + String memberName = headerAccessor.getFirstNativeHeader("memberName"); + String colorCode = headerAccessor.getFirstNativeHeader("colorCode"); + + //String sessionId = headerAccessor.getSessionId(); + + QuestionSettingWSInfo questionSettingWSInfo = QuestionSettingWSInfo.of( + sessionId, + wsId, + projectCode, + memberCode, + memberName, + colorCode + ); + + ArrayList setUserList = webSocketService.sessionAdd(questionSettingWSInfo); + System.out.println(setUserList + "<<<연결 리스트"); + } + + //Connection 끊기는 순간 방에서 퇴장! + @EventListener + public void handleDisconnectEvent(SessionDisconnectEvent event) { + StompHeaderAccessor headerAccessor = StompHeaderAccessor.wrap(event.getMessage()); + + String sessionIdId = headerAccessor.getSessionId(); + String projectCode = webSocketService.getProjectCode(sessionIdId); + // 연결 해제 이벤트 핸들링 로직 + ArrayList setUserList = webSocketService.sessionDelete(projectCode, sessionIdId); + System.out.println(setUserList + "<<<삭제 리스트"); + + simpMessagingTemplate.convertAndSend("/sub/connection/" + projectCode, setUserList); + } +} diff --git a/src/main/java/com/krt/newssak/exception/ApiException.java b/src/main/java/com/krt/newssak/exception/ApiException.java new file mode 100644 index 0000000..a57f34c --- /dev/null +++ b/src/main/java/com/krt/newssak/exception/ApiException.java @@ -0,0 +1,15 @@ +package com.krt.newssak.exception; + +import lombok.Getter; + +@Getter +public class ApiException extends RuntimeException{ + + private ExceptionEnum error; + + public ApiException(ExceptionEnum e) { + super(e.getMessage()); + this.error = e; + } + +} diff --git a/src/main/java/com/krt/newssak/exception/ApiExceptionAdvice.java b/src/main/java/com/krt/newssak/exception/ApiExceptionAdvice.java new file mode 100644 index 0000000..d6a0b39 --- /dev/null +++ b/src/main/java/com/krt/newssak/exception/ApiExceptionAdvice.java @@ -0,0 +1,21 @@ +package com.krt.newssak.exception; + +import jakarta.servlet.http.HttpServletRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +@RestControllerAdvice +public class ApiExceptionAdvice { + + @ExceptionHandler({ApiException.class}) + public ResponseEntity exceptionHandler(HttpServletRequest request, final ApiException e) { + return ResponseEntity + .status(e.getError().getStatus()) + .body(ApiExceptionEntity.builder() + .errorCode(e.getError().getCode()) + .errorMessage(e.getError().getMessage()) + .build()); + } + +} diff --git a/src/main/java/com/krt/newssak/exception/ApiExceptionEntity.java b/src/main/java/com/krt/newssak/exception/ApiExceptionEntity.java new file mode 100644 index 0000000..3ddce23 --- /dev/null +++ b/src/main/java/com/krt/newssak/exception/ApiExceptionEntity.java @@ -0,0 +1,21 @@ +package com.krt.newssak.exception; + +import lombok.Builder; +import lombok.Getter; +import lombok.ToString; +import org.springframework.http.HttpStatus; + +@Getter +@ToString +public class ApiExceptionEntity { + + private String errorCode; + private String errorMessage; + + @Builder + public ApiExceptionEntity(HttpStatus status, String errorCode, String errorMessage) { + this.errorCode = errorCode; + this.errorMessage = errorMessage; + } + +} diff --git a/src/main/java/com/krt/newssak/exception/ExceptionEnum.java b/src/main/java/com/krt/newssak/exception/ExceptionEnum.java new file mode 100644 index 0000000..b894553 --- /dev/null +++ b/src/main/java/com/krt/newssak/exception/ExceptionEnum.java @@ -0,0 +1,36 @@ +package com.krt.newssak.exception; + +import lombok.Getter; +import lombok.ToString; +import org.springframework.http.HttpStatus; + +@Getter +@ToString +public enum ExceptionEnum { + +// RUNTIME_EXCEPTION(HttpStatus.BAD_REQUEST, "E0001"), +// ACCESS_DENIED_EXCEPTION(HttpStatus.UNAUTHORIZED, "E0002"), +// INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "E0003"), +// + USER_NOT_FOUND(HttpStatus.NOT_FOUND, "E404", "유저 정보가 없습니다."), + PROJECT_NOT_FOUND(HttpStatus.NOT_FOUND, "E404", "프로젝트 정보가 없습니다."), + QUESTION_NOT_FOUND(HttpStatus.NOT_FOUND, "E400", "문항 정보가 없습니다."), + INTERVIEWER_ID_DUPLICATE(HttpStatus.CONFLICT, "IN409", "중복되는 면접원이 있습니다."), + DELETE_REQUEST_DATA_NOT_FOUND(HttpStatus.NOT_FOUND, "CPAC404", "요청 데이터 없음"); + + private final HttpStatus status; + private final String code; + private String message; + + ExceptionEnum(HttpStatus status, String code) { + this.status = status; + this.code = code; + } + + ExceptionEnum(HttpStatus status, String code, String message) { + this.status = status; + this.code = code; + this.message = message; + } + +} diff --git a/src/main/java/com/krt/newssak/jwt/JwtAuthenticationFilter.java b/src/main/java/com/krt/newssak/jwt/JwtAuthenticationFilter.java new file mode 100644 index 0000000..2acb0d6 --- /dev/null +++ b/src/main/java/com/krt/newssak/jwt/JwtAuthenticationFilter.java @@ -0,0 +1,50 @@ +package com.krt.newssak.jwt; + +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import lombok.RequiredArgsConstructor; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.util.StringUtils; +import org.springframework.web.filter.GenericFilterBean; + +import java.io.IOException; + +@RequiredArgsConstructor +public class JwtAuthenticationFilter extends GenericFilterBean { + + private final JwtTokenProvider jwtTokenProvider; + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + + // 1. Request Header 에서 JWT 토큰 추출 + String token = resolveToken((HttpServletRequest) request); + +// System.out.println(request); +// System.out.println(response); +// System.out.println(chain); +// System.out.println("▼▼▼▼▼▼▼▼▼▼토큰 값▼▼▼▼▼▼▼▼▼▼"); +// System.out.println(token); + // 2. validateToken 으로 토큰 유효성 검사 + if (token != null && jwtTokenProvider.validateToken(token)) { + // 토큰이 유효할 경우 토큰에서 Authentication 객체를 가지고 와서 SecurityContext 에 저장 + Authentication authentication = jwtTokenProvider.getAuthentication(token); + SecurityContextHolder.getContext().setAuthentication(authentication); + } + chain.doFilter(request, response); + } + + // Request Header 에서 토큰 정보 추출 + private String resolveToken(HttpServletRequest request) { + String bearerToken = request.getHeader("Authorization"); + if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer")) { + return bearerToken.substring(7); + } + return null; + } + +} diff --git a/src/main/java/com/krt/newssak/jwt/JwtTokenProvider.java b/src/main/java/com/krt/newssak/jwt/JwtTokenProvider.java new file mode 100644 index 0000000..9513fd3 --- /dev/null +++ b/src/main/java/com/krt/newssak/jwt/JwtTokenProvider.java @@ -0,0 +1,136 @@ +package com.krt.newssak.jwt; + +import com.krt.newssak.dto.common.TokenInfo; +import io.jsonwebtoken.*; +import io.jsonwebtoken.io.Decoders; +import io.jsonwebtoken.security.Keys; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.authentication.AbstractAuthenticationToken; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Component; + +import com.krt.newssak.dto.member.MemberDto; +import com.krt.newssak.dto.member.CustomUserDetails; + +import java.security.Key; +import java.util.Arrays; +import java.util.Collection; +import java.util.Date; +import java.util.stream.Collectors; + + +@Slf4j +@Component +public class JwtTokenProvider { + + private final Key key; + private static final long ACCESS_TOKEN_EXPIRE_TIME = 1000 * 60 * 60 * 8; // 8시간 (밀리세컨드 단위임) 1000 * 초 * 분 * 시 + private static final long REFRESH_TOKEN_EXPIRE_TIME = 1000 * 60 * 60 * 24 * 7; // 7일 + + public JwtTokenProvider(@Value("${jwt.secret}") String secretKey) { + byte[] keyBytes = Decoders.BASE64.decode(secretKey); + this.key = Keys.hmacShaKeyFor(keyBytes); + } + + // 유저 정보를 가지고 AccessToken, RefreshToken 을 생성하는 메서드 + public TokenInfo generateToken(Authentication authentication) { + + //토큰에 같이 실어갈 정보 + CustomUserDetails userDetails = (CustomUserDetails)authentication.getPrincipal(); + //토큰에 같이 실어갈 정보 -> MemberDto로 변환 : Password감추기 위해 + MemberDto memberDto = MemberDto.builder() + .member_code(userDetails.getMember_code()) + .member_id(userDetails.getMember_id()) + .member_name(userDetails.getMember_name()) + .teamInfo(userDetails.getTeam_info()) + .is_admin(userDetails.getIs_admin()) + .build(); + + // 권한 가져오기 + String authorities = authentication.getAuthorities().stream() + .map(GrantedAuthority::getAuthority) + .collect(Collectors.joining(",")); + + long now = (new Date()).getTime(); + + // Access Token 생성 + Date accessTokenExpiresIn = userDetails.getMember_name().equals("test") ? new Date(now + 6000) : new Date(now + ACCESS_TOKEN_EXPIRE_TIME); +// Date accessTokenExpiresIn = new Date(now + ACCESS_TOKEN_EXPIRE_TIME); + String accessToken = Jwts.builder() + .setSubject(authentication.getName()) + .claim("auth", authorities) + .claim("details", memberDto) + .setExpiration(accessTokenExpiresIn) + .signWith(key, SignatureAlgorithm.HS256) + .compact(); + + // Refresh Token 생성 + String refreshToken = Jwts.builder() + .setExpiration(new Date(now + REFRESH_TOKEN_EXPIRE_TIME)) + .signWith(key, SignatureAlgorithm.HS256) + .compact(); + + return TokenInfo.builder() + .grantType("Bearer") + .accessToken(accessToken) + .refreshToken(refreshToken) + .build(); + } + + // JWT 토큰을 복호화하여 토큰에 들어있는 정보를 꺼내는 메서드 + public Authentication getAuthentication(String accessToken) { + // 토큰 복호화 + Claims claims = parseClaims(accessToken); +// System.out.println("▼▼▼▼▼토큰 정보▼▼▼▼▼"); +// System.out.println(accessToken); +// System.out.println(claims); + if (claims.get("auth") == null) { + throw new RuntimeException("권한 정보가 없는 토큰입니다."); + } + + // 클레임에서 권한 정보 가져오기 + Collection authorities = + Arrays.stream(claims.get("auth").toString().split(",")) + .map(SimpleGrantedAuthority::new) + .collect(Collectors.toList()); + + // UserDetails 객체를 만들어서 Authentication 리턴 + UserDetails principal = new User(claims.getSubject(), "", authorities); + AbstractAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(principal, "", authorities); + authentication.setDetails(claims.get("details")); + + return authentication; + } + + // 토큰 정보를 검증하는 메서드 + public boolean validateToken(String token) { + try { + Jwts.parserBuilder().setSigningKey(key).build().parseClaimsJws(token); + return true; + } catch (io.jsonwebtoken.security.SecurityException | MalformedJwtException e) { + log.info("잘못된 JWT 서명입니다."); + } catch (ExpiredJwtException e) { + log.info("만료된 JWT 토큰입니다."); + } catch (UnsupportedJwtException e) { + log.info("지원되지 않는 JWT 토큰입니다."); + } catch (IllegalArgumentException e) { + log.info("JWT 토큰이 잘못되었습니다."); + } + return false; + } + + private Claims parseClaims(String accessToken) { + try { + return Jwts.parserBuilder().setSigningKey(key).build().parseClaimsJws(accessToken).getBody(); + } catch (ExpiredJwtException e) { + return e.getClaims(); + } + } + +} diff --git a/src/main/java/com/krt/newssak/repository/autorecode/AutoRecodeRepository.java b/src/main/java/com/krt/newssak/repository/autorecode/AutoRecodeRepository.java new file mode 100644 index 0000000..ac9934e --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/autorecode/AutoRecodeRepository.java @@ -0,0 +1,12 @@ +package com.krt.newssak.repository.autorecode; + +import com.krt.newssak.entity.autorecode.AutoRecodeEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface AutoRecodeRepository extends JpaRepository { + List findAllByProjectCodeAndQuestionUniqueKey(String projectCode, int questionUniqueKey); + + int deleteByProjectCodeAndQuestionUniqueKey(String projectCode, int questionUniqueKey); +} diff --git a/src/main/java/com/krt/newssak/repository/capi/CapiAssignRepository.java b/src/main/java/com/krt/newssak/repository/capi/CapiAssignRepository.java new file mode 100644 index 0000000..5272218 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/capi/CapiAssignRepository.java @@ -0,0 +1,12 @@ +package com.krt.newssak.repository.capi; + +import com.krt.newssak.entity.capi.InterviewerAssignEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface CapiAssignRepository extends JpaRepository { + List findByProjectCode(String projectCode); + + List findByInterviewerId(String interviewerId); +} diff --git a/src/main/java/com/krt/newssak/repository/capi/CapiQueryRepository.java b/src/main/java/com/krt/newssak/repository/capi/CapiQueryRepository.java new file mode 100644 index 0000000..eb64552 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/capi/CapiQueryRepository.java @@ -0,0 +1,102 @@ +package com.krt.newssak.repository.capi; + +import com.krt.newssak.dto.capi.GetDeleteSurveyDataResponseDto; +import com.krt.newssak.dto.capi.GetDeleteSurveyReqDataRequestDto; +import com.krt.newssak.dto.capi.GetInterviewerSurveyStatusRequestDto; +import com.krt.newssak.dto.capi.GetInterviewerSurveyStatusResponseDto; +import com.krt.newssak.entity.capi.QInterviewerDeleteRequestEntity; +import com.krt.newssak.entity.capi.QInterviewerInfoEntity; +import com.krt.newssak.entity.survey.QSurveyRespondentEntity; +import com.querydsl.core.BooleanBuilder; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.CaseBuilder; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +@RequiredArgsConstructor +public class CapiQueryRepository { + + private final JPAQueryFactory queryFactory; + private QInterviewerInfoEntity qInterviewerInfoEntity = QInterviewerInfoEntity.interviewerInfoEntity; + private QSurveyRespondentEntity qSurveyRespondentEntity = QSurveyRespondentEntity.surveyRespondentEntity; + private QInterviewerDeleteRequestEntity qInterviewerDeleteRequestEntity = QInterviewerDeleteRequestEntity.interviewerDeleteRequestEntity; + + //면접원by상태별 카운트 가져오기 + public List findInterviewerByStatusCount(GetInterviewerSurveyStatusRequestDto getInterviewerSurveyStatusRequestDto){ + BooleanBuilder builder = new BooleanBuilder(); + + if(getInterviewerSurveyStatusRequestDto.getStartDate() != null && getInterviewerSurveyStatusRequestDto.getEndDate() != null){ + builder.and(qSurveyRespondentEntity.answerEndDate.substring(0, 10).between(getInterviewerSurveyStatusRequestDto.getStartDate(), getInterviewerSurveyStatusRequestDto.getEndDate())); + } + + List resList = queryFactory + .select( + Projections.constructor(GetInterviewerSurveyStatusResponseDto.class, + qInterviewerInfoEntity.code.as("interviewerCode"), + qInterviewerInfoEntity.interviewerId.as("interviewerId"), + new CaseBuilder() + .when(qSurveyRespondentEntity.answerState.eq(1)).then(1) + .otherwise(0).sum().as("progressCount"), + new CaseBuilder() + .when(qSurveyRespondentEntity.answerState.eq(10)).then(1) + .otherwise(0).sum().as("successCount"), + new CaseBuilder() + .when(qSurveyRespondentEntity.answerState.eq(98)).then(1) + .otherwise(0).sum().as("screenCount"), + new CaseBuilder() + .when(qSurveyRespondentEntity.answerState.eq(99)).then(1) + .otherwise(0).sum().as("quotaCount")) + ) + .from(qInterviewerInfoEntity) + .join(qSurveyRespondentEntity) + .on(qSurveyRespondentEntity.answerId.substring(0, 8).eq(qInterviewerInfoEntity.code)) + .where( + qSurveyRespondentEntity.projectCode.eq(getInterviewerSurveyStatusRequestDto.getProjectCode()), + qSurveyRespondentEntity.surveyTypeCode.eq(31), + qSurveyRespondentEntity.answerId.contains("_"), + builder + ) + .groupBy(qInterviewerInfoEntity.code) + .fetch(); + + return resList; + } + + //삭제요청리스트 조회 + public List findSurveyDataDeleteRequestList(GetDeleteSurveyReqDataRequestDto getDeleteSurveyReqDataRequestDto){ + + List resList = queryFactory + .select( + Projections.constructor(GetDeleteSurveyDataResponseDto.class, + qInterviewerDeleteRequestEntity.idx, + qInterviewerDeleteRequestEntity.answerId.concat(" (").concat(qInterviewerInfoEntity.interviewerId).concat(")"), + qSurveyRespondentEntity.answerEndDate, + qSurveyRespondentEntity.answerState, + qInterviewerDeleteRequestEntity.reason, + qInterviewerDeleteRequestEntity.result + ) + ) + .from(qInterviewerDeleteRequestEntity) + .join(qSurveyRespondentEntity) + .on( + qInterviewerDeleteRequestEntity.projectCode.eq(qSurveyRespondentEntity.projectCode), + qInterviewerDeleteRequestEntity.answerId.eq(qSurveyRespondentEntity.answerId) + ) + .join(qInterviewerInfoEntity) + .on( + qInterviewerInfoEntity.code.eq(qInterviewerDeleteRequestEntity.interviewerId) + ) + .where( + qInterviewerDeleteRequestEntity.result.eq(0), + qInterviewerDeleteRequestEntity.projectCode.eq(getDeleteSurveyReqDataRequestDto.getProjectCode()) + ) + .orderBy(qInterviewerDeleteRequestEntity.idx.desc()) + .fetch(); + + return resList; + } +} diff --git a/src/main/java/com/krt/newssak/repository/capi/CapiRepository.java b/src/main/java/com/krt/newssak/repository/capi/CapiRepository.java new file mode 100644 index 0000000..f768b53 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/capi/CapiRepository.java @@ -0,0 +1,10 @@ +package com.krt.newssak.repository.capi; + +import com.krt.newssak.entity.capi.InterviewerInfoEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface CapiRepository extends JpaRepository { + List findAllByOrderByCodeDesc(); +} diff --git a/src/main/java/com/krt/newssak/repository/capi/CapiSurveyDataDeleteRequestRepository.java b/src/main/java/com/krt/newssak/repository/capi/CapiSurveyDataDeleteRequestRepository.java new file mode 100644 index 0000000..d0d39f9 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/capi/CapiSurveyDataDeleteRequestRepository.java @@ -0,0 +1,8 @@ +package com.krt.newssak.repository.capi; + +import com.krt.newssak.entity.capi.InterviewerDeleteRequestEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface CapiSurveyDataDeleteRequestRepository extends JpaRepository { + InterviewerDeleteRequestEntity findByIdx(int idx); +} diff --git a/src/main/java/com/krt/newssak/repository/datamanage/DataManageRepository.java b/src/main/java/com/krt/newssak/repository/datamanage/DataManageRepository.java new file mode 100644 index 0000000..1dd58a1 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/datamanage/DataManageRepository.java @@ -0,0 +1,10 @@ +package com.krt.newssak.repository.datamanage; + +import com.krt.newssak.entity.survey.SurveyDataEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface DataManageRepository extends JpaRepository { + List findAllByProjectCodeAndAnswerIDAndQuestionUniqueKeyGreaterThan(String projectCode, String answerId, int uniqueKey); +} diff --git a/src/main/java/com/krt/newssak/repository/hardcode/HardCodeHistoryRepository.java b/src/main/java/com/krt/newssak/repository/hardcode/HardCodeHistoryRepository.java new file mode 100644 index 0000000..af3bc1e --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/hardcode/HardCodeHistoryRepository.java @@ -0,0 +1,12 @@ +package com.krt.newssak.repository.hardcode; + +import com.krt.newssak.entity.hardcode.HardCodeHistoryEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface HardCodeHistoryRepository extends JpaRepository{ + List findByProjectCodeAndQuestionUniqueKeyAndHardCodeTypeOrderByRegDateDesc(String projectCode, int questionUniqueKey, int type); +} diff --git a/src/main/java/com/krt/newssak/repository/hardcode/HardCodeRepository.java b/src/main/java/com/krt/newssak/repository/hardcode/HardCodeRepository.java new file mode 100644 index 0000000..c211c7f --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/hardcode/HardCodeRepository.java @@ -0,0 +1,10 @@ +package com.krt.newssak.repository.hardcode; + +import com.krt.newssak.entity.hardcode.HardCodeEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface HardCodeRepository extends JpaRepository{ + HardCodeEntity findByProjectCodeAndQuestionUniqueKeyAndHardCodeTypeOrderByRegDateDesc(String projectCode, int questionUniqueKey, int type); +} diff --git a/src/main/java/com/krt/newssak/repository/kiwi/KiwiQueryRepository.java b/src/main/java/com/krt/newssak/repository/kiwi/KiwiQueryRepository.java new file mode 100644 index 0000000..9e6a9f2 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/kiwi/KiwiQueryRepository.java @@ -0,0 +1,205 @@ +package com.krt.newssak.repository.kiwi; + +import com.krt.newssak.dto.kiwi.request.AllProjectCodeList; +import com.krt.newssak.dto.kiwi.request.DelSurveyDataInfo; +import com.krt.newssak.dto.kiwi.response.AllSurveyNotInKiwi; +import com.krt.newssak.dto.kiwi.response.GetResponseProjectInfo; +import com.krt.newssak.dto.kiwi.response.exampleListByKpKey; +import com.krt.newssak.dto.kiwi.response.surveyAnswerTime; +import com.krt.newssak.entity.member.QMemberEntity; +import com.krt.newssak.entity.project.QProjectEntity; +import com.krt.newssak.entity.question.QQuestionEntity; +import com.krt.newssak.entity.survey.QSurveyDataEntity; +import com.krt.newssak.entity.survey.QSurveyRespondentEntity; +import com.querydsl.core.BooleanBuilder; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Repository; + +import java.text.SimpleDateFormat; +import java.time.Duration; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +@Repository +@RequiredArgsConstructor +public class KiwiQueryRepository { + + private final JPAQueryFactory queryFactory; + private QProjectEntity projectEntity = QProjectEntity.projectEntity; + private QQuestionEntity questionEntity = QQuestionEntity.questionEntity; + private QMemberEntity memberEntity = QMemberEntity.memberEntity; + private QSurveyDataEntity surveyDataEntity = QSurveyDataEntity.surveyDataEntity; + private QSurveyRespondentEntity surveyRespondentEntity = QSurveyRespondentEntity.surveyRespondentEntity; + + private String tagChange(String text){ + String changeText = StringUtils.replaceEach( + text, + new String[]{"<", ">", """, "&", " "}, + new String[]{"<", ">", "\"", "&", " "} + ).replaceAll("<.*?>", ""); + + return changeText; + } + + public List getAllProjectList(AllProjectCodeList allProjectCodeList) { + + BooleanBuilder builder = new BooleanBuilder(); + + if(allProjectCodeList.getCode() != null && allProjectCodeList.getCode().size() > 0){ + builder.and(projectEntity.code.notIn(allProjectCodeList.getCode())); + } + + List allProject = queryFactory + .select(Projections.constructor(AllSurveyNotInKiwi.class, + projectEntity.code, + projectEntity.surveyTitle, + projectEntity.count().castToNum(int.class) + ) + ) + .from(projectEntity) + .join(questionEntity) + .on(projectEntity.code.eq(questionEntity.projectCode)) + .where( + builder, + projectEntity.isDelete.eq(0), + projectEntity.company.eq(3), + questionEntity.questionOrder.gt(0), + questionEntity.isDelete.eq(0) + ) + .groupBy(projectEntity.code) + .orderBy(projectEntity.idx.desc()) + .fetch(); + + return allProject; + } + + public GetResponseProjectInfo getProjectInfo(String pkey) { + GetResponseProjectInfo getResponseProjectInfo = queryFactory + .select(Projections.constructor(GetResponseProjectInfo.class, + projectEntity.idx, + projectEntity.code, + memberEntity.memberTeamInfo.name, + memberEntity.name, + projectEntity.surveyTitle, + Expressions.constant(3), + projectEntity.regDate, + questionEntity.count().castToNum(Integer.class) + ) + ) + .from(projectEntity) + .join(memberEntity) + .on(projectEntity.regMember.eq(memberEntity.code)) + .join(questionEntity) + .on(projectEntity.code.eq(questionEntity.projectCode)) + .where( + projectEntity.code.eq(pkey), + projectEntity.isDelete.eq(0), + questionEntity.questionOrder.gt(0), + questionEntity.isDelete.eq(0) + ) + .fetchOne(); + + if(getResponseProjectInfo.getProjectKey() == null){ + return null; + }else{ + return getResponseProjectInfo; + } + + } + + // + public List getAllQuestionList(String pkey) { + List exampleListByKpKeyList = queryFactory + .select(Projections.constructor(exampleListByKpKey.class, + projectEntity.code, + projectEntity.projectTitle, + questionEntity.questionID, + questionEntity.questionTitle, + questionEntity.questionExplain + ) + ) + .from(questionEntity) + .join(projectEntity) + .on(questionEntity.projectCode.eq(projectEntity.code)) + .where( + questionEntity.projectCode.eq(pkey), + questionEntity.questionOrder.gt(0), + questionEntity.isDelete.eq(0) + ) + .fetch(); + + + return exampleListByKpKeyList.stream() + .map(exampleListByKpKey -> new exampleListByKpKey( + exampleListByKpKey.getPkey(), + exampleListByKpKey.getProjectTitle(), + exampleListByKpKey.getVariable(), + tagChange(exampleListByKpKey.getQuestionTitle()), + tagChange(exampleListByKpKey.getExplain()) + )) + .collect(Collectors.toList()); + } + + public String getSurveyAnswerAvgTime(String pkey) { + List surveyAnswerTimeList = queryFactory + .select( + Projections.constructor(surveyAnswerTime.class, + surveyRespondentEntity.answerStartDate, + surveyRespondentEntity.answerEndDate + ) + ) + .from(surveyRespondentEntity) + .where( + surveyRespondentEntity.projectCode.eq(pkey), + surveyRespondentEntity.surveyTypeCode.ne(99), + surveyRespondentEntity.answerState.eq(10) + ) + .fetch(); + + System.out.println(surveyAnswerTimeList); + + // 스트림으로 진행 시간 계산 및 평균 구하기 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + double avgDuration = surveyAnswerTimeList.stream() + .mapToLong(t -> { + LocalDateTime startTime = LocalDateTime.parse(t.getAnswerStartTime(), formatter); + LocalDateTime endTime = LocalDateTime.parse(t.getAnswerEndTime(), formatter); + return Duration.between(startTime, endTime).toSeconds(); + }) + .average() + .orElse(0.0); + + // 평균 진행 시간을 HH:mm:ss 형식의 문자열로 변환 + long avgDurationMillis = (long) avgDuration; + long hours = TimeUnit.SECONDS.toHours(avgDurationMillis); + long minutes = TimeUnit.SECONDS.toMinutes(avgDurationMillis) % 60; + long seconds = TimeUnit.SECONDS.toSeconds(avgDurationMillis) % 60; + + return String.format("%02d:%02d:%02d", hours, minutes, seconds); + } + + public long delSurveyData(DelSurveyDataInfo delSurveyDataInfo) { + //날짜 + Date today = new Date(); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); + String deleteTime = "_DEL_"+dateFormat.format(today); + + return queryFactory.update(surveyDataEntity) + .set(surveyDataEntity.answerID, delSurveyDataInfo.getSid()+deleteTime) + .where( + surveyDataEntity.projectCode.eq(delSurveyDataInfo.getPkey()), + surveyDataEntity.answerID.eq(delSurveyDataInfo.getSid()) + ) + .execute(); + } +} diff --git a/src/main/java/com/krt/newssak/repository/list/ListContentRepository.java b/src/main/java/com/krt/newssak/repository/list/ListContentRepository.java new file mode 100644 index 0000000..b5d8d6e --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/list/ListContentRepository.java @@ -0,0 +1,13 @@ +package com.krt.newssak.repository.list; + + +import com.krt.newssak.entity.list.ListContentEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface ListContentRepository extends JpaRepository { + List findAllByProjectCode(String projectCode); + ListContentEntity findByIdx(int idx); + int deleteAllByProjectCode(String projectCode); +} diff --git a/src/main/java/com/krt/newssak/repository/list/ListHeaderRepository.java b/src/main/java/com/krt/newssak/repository/list/ListHeaderRepository.java new file mode 100644 index 0000000..2292ccd --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/list/ListHeaderRepository.java @@ -0,0 +1,13 @@ +package com.krt.newssak.repository.list; + + +import com.krt.newssak.entity.list.ListHeaderEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface ListHeaderRepository extends JpaRepository { + ListHeaderEntity findFirstByProjectCodeOrderByOrderNoDesc(String projectCode); + + List findAllByProjectCodeOrderByOrderNo(String projectCode); +} diff --git a/src/main/java/com/krt/newssak/repository/member/MemberProjectManagerRepository.java b/src/main/java/com/krt/newssak/repository/member/MemberProjectManagerRepository.java new file mode 100644 index 0000000..d1fc7c1 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/member/MemberProjectManagerRepository.java @@ -0,0 +1,9 @@ +package com.krt.newssak.repository.member; + +import com.krt.newssak.entity.member.MemberProjectManagerEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface MemberProjectManagerRepository extends JpaRepository, JpaSpecificationExecutor { + +} diff --git a/src/main/java/com/krt/newssak/repository/member/MemberRepository.java b/src/main/java/com/krt/newssak/repository/member/MemberRepository.java new file mode 100644 index 0000000..2d5b42f --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/member/MemberRepository.java @@ -0,0 +1,20 @@ +package com.krt.newssak.repository.member; + +import com.krt.newssak.entity.member.MemberEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Optional; + +@Repository +public interface MemberRepository extends JpaRepository { + List findAll(); + + Optional findById(String id); + + Optional findByIdStartsWith(String id); + + Optional findByIdAndPassword(String id, String password); + +} diff --git a/src/main/java/com/krt/newssak/repository/project/ProjectFileRepository.java b/src/main/java/com/krt/newssak/repository/project/ProjectFileRepository.java new file mode 100644 index 0000000..7f070b1 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/project/ProjectFileRepository.java @@ -0,0 +1,10 @@ +package com.krt.newssak.repository.project; + + +import com.krt.newssak.entity.project.ProjectFileEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface ProjectFileRepository extends JpaRepository, JpaSpecificationExecutor { + ProjectFileEntity findByProjectCodeAndFileName(String projectCode, String filename); +} diff --git a/src/main/java/com/krt/newssak/repository/project/ProjectHashTagRepository.java b/src/main/java/com/krt/newssak/repository/project/ProjectHashTagRepository.java new file mode 100644 index 0000000..72ca610 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/project/ProjectHashTagRepository.java @@ -0,0 +1,10 @@ +package com.krt.newssak.repository.project; + +import com.krt.newssak.entity.project.ProjectHashtagEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface ProjectHashTagRepository extends JpaRepository, JpaSpecificationExecutor { + + +} diff --git a/src/main/java/com/krt/newssak/repository/project/ProjectParameterRepository.java b/src/main/java/com/krt/newssak/repository/project/ProjectParameterRepository.java new file mode 100644 index 0000000..8f60203 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/project/ProjectParameterRepository.java @@ -0,0 +1,14 @@ +package com.krt.newssak.repository.project; + +import com.krt.newssak.entity.project.ProjectParameterEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface ProjectParameterRepository extends JpaRepository, JpaSpecificationExecutor { + + List findByProjectCode(String projectCode); +} diff --git a/src/main/java/com/krt/newssak/repository/project/ProjectQueryRepository.java b/src/main/java/com/krt/newssak/repository/project/ProjectQueryRepository.java new file mode 100644 index 0000000..a713de5 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/project/ProjectQueryRepository.java @@ -0,0 +1,806 @@ +package com.krt.newssak.repository.project; + +import com.krt.newssak.dto.project.*; +import com.krt.newssak.entity.hardcode.HardCodeEntity; +import com.krt.newssak.entity.hardcode.HardCodeHistoryEntity; +import com.krt.newssak.entity.hardcode.QHardCodeEntity; +import com.krt.newssak.entity.hardcode.QHardCodeHistoryEntity; +import com.krt.newssak.entity.member.QMemberEntity; +import com.krt.newssak.entity.member.QMemberProjectManagerEntity; +import com.krt.newssak.entity.member.QMemberTeamInfoEntity; +import com.krt.newssak.entity.project.*; +import com.krt.newssak.entity.question.*; +import com.krt.newssak.entity.quota.QQuotaCellEntity; +import com.krt.newssak.entity.quota.QQuotaEntity; +import com.krt.newssak.entity.quota.QuotaCellEntity; +import com.krt.newssak.entity.quota.QuotaEntity; +import com.krt.newssak.entity.survey.QSurveyDataEntity; +import com.krt.newssak.entity.survey.QSurveyRespondentEntity; +import com.krt.newssak.repository.hardcode.HardCodeHistoryRepository; +import com.krt.newssak.repository.hardcode.HardCodeRepository; +import com.krt.newssak.repository.question.*; +import com.krt.newssak.repository.quota.QuotaCellRepository; +import com.krt.newssak.repository.quota.QuotaRepository; +import com.krt.newssak.util.Common; +import com.querydsl.core.types.Order; +import com.querydsl.core.types.OrderSpecifier; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.CaseBuilder; +import com.querydsl.core.types.dsl.PathBuilder; +import com.querydsl.jpa.impl.JPAQuery; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import org.apache.commons.io.FileUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.support.PageableExecutionUtils; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import static org.springframework.util.StringUtils.hasText; + +@Repository +@RequiredArgsConstructor +public class ProjectQueryRepository { + + private final JPAQueryFactory queryFactory; + + private final ProjectRepository projectRepository; + private final ProjectFileRepository projectFileRepository; + private final ProjectHashTagRepository projectHashTagRepository; + private final ProjectRedirectRepository projectRedirectRepository; + private final ProjectParameterRepository projectParameterRepository; + private final ProjectResponseRepository projectResponseRepository; + private final ProjectStyleRepository projectStyleRepository; + private final QuestionRepository questionRepository; + private final QuestionLabelRepository questionLabelRepository; + private final QuestionLogicRepository questionLogicRepository; + private final QuestionOptionRepository questionOptionRepository; + private final QuestionBlockRepository questionBlockRepository; + private final QuestionBlockCollectionRepository questionBlockCollectionRepository; + private final QuestionBlockOptionRepository questionBlockOptionRepository; + private final HardCodeRepository hardcodeRepository; + private final QuotaRepository quotaRepository; + private final QuotaCellRepository quotaCellRepository; + + + private QProjectEntity projectEntity = QProjectEntity.projectEntity; + private QProjectFileEntity projectFileEntity = QProjectFileEntity.projectFileEntity; + private QProjectHashtagEntity projectHashtag = QProjectHashtagEntity.projectHashtagEntity; + private QProjectParameterEntity projectParameter = QProjectParameterEntity.projectParameterEntity; + private QProjectRedirectEntity projectRedirect = QProjectRedirectEntity.projectRedirectEntity; + private QSurveyRespondentEntity qSurveyRespondent = QSurveyRespondentEntity.surveyRespondentEntity; + private QSurveyDataEntity qSurveyData = QSurveyDataEntity.surveyDataEntity; + private QQuestionEntity questionEntity = QQuestionEntity.questionEntity; + private QQuestionLabelEntity questionLaeblEntity = QQuestionLabelEntity.questionLabelEntity; + private QQuestionLogicEntity questionLogicEntity = QQuestionLogicEntity.questionLogicEntity; + private QQuestionOptionEntity questionOptionEntity = QQuestionOptionEntity.questionOptionEntity; + private QQuestionBlockEntity questionBlockEntity = QQuestionBlockEntity.questionBlockEntity; + private QQuestionBlockCollectEntity questionBlockCollectEntity = QQuestionBlockCollectEntity.questionBlockCollectEntity; + private QQuestionBlockOptionEntity questionBlockOptionEntity = QQuestionBlockOptionEntity.questionBlockOptionEntity; + private QProjectResponseEntity projectResponse = QProjectResponseEntity.projectResponseEntity; + private QProjectStyleEntity projectStyle = QProjectStyleEntity.projectStyleEntity; + private QHardCodeEntity hardCodeEntity = QHardCodeEntity.hardCodeEntity; + private QQuotaEntity quotaEntity = QQuotaEntity.quotaEntity; + private QQuotaCellEntity quotaCellEntity = QQuotaCellEntity.quotaCellEntity; + + private QMemberEntity memberEntity = QMemberEntity.memberEntity; + private QMemberTeamInfoEntity memberTeamInfo = QMemberTeamInfoEntity.memberTeamInfoEntity; + private QMemberProjectManagerEntity memberProjectManager = QMemberProjectManagerEntity.memberProjectManagerEntity; + + public Page findBySearchDto(ProjectSearchDto projectSearchDto, Pageable pageable){ + List content = getProjectList(projectSearchDto, pageable); + JPAQuery countQuery = getSearchCount(projectSearchDto); + + return PageableExecutionUtils.getPage(content, pageable, () -> countQuery.fetchOne()); + } + + public long updateProjectInfo(ProjectUpsertDto projectUpsertDto){ + long updateCount = queryFactory.update(projectEntity) + .set(projectEntity.projectTitle, projectUpsertDto.getProject_title()) + .set(projectEntity.surveyTitle, projectUpsertDto.getSurvey_title()) + .set(projectEntity.ownTeam, projectUpsertDto.getOwn_team()) + .set(projectEntity.company, projectUpsertDto.getProject_company()) + .set(projectEntity.regMember, projectUpsertDto.getReg_member()) + .where( + projectEntity.code.eq(projectUpsertDto.getProject_code()), + notDelete() + ).execute(); + + return updateCount; + } + + public long updateProjectState(String projectCode, int projectState){ + long updateCount = queryFactory.update(projectEntity) + .set(projectEntity.state,projectState) + .where( + projectEntity.code.eq(projectCode), + notDelete() + ) + .execute(); + return updateCount; + } + + public long updateIsDelete(String projectCode) { + long updateCount = queryFactory.update(projectEntity) + .set(projectEntity.isDelete,1) + .set(projectEntity.deleteDate, Common.getNow(null)) + .where( + projectEntity.code.eq(projectCode), + notDelete() + ) + .execute(); + return updateCount; + } + + public long deleteHashTag(String projectCode) { + + return queryFactory.delete(projectHashtag) + .where(projectHashtag.projectCode.eq(projectCode)) + .execute(); + } + + public long deleteManager(String projectCode) { + + return queryFactory.delete(memberProjectManager) + .where(memberProjectManager.project_code.eq(projectCode)) + .execute(); + } + + public long deleteParameter(String projectCode, String parameterName){ + + return queryFactory.delete(projectParameter) + .where( + projectParameter.projectCode.eq(projectCode), + projectParameter.isDefault.eq(0), + projectParameter.parameterName.eq(parameterName) + ) + .execute(); + } + + public long deleteRedirect(String projectCode, String panelCode){ + + return queryFactory.delete(projectRedirect) + .where( + projectRedirect.projectCode.eq(projectCode), + projectRedirect.panelCode.eq(panelCode) + ) + .execute(); + } + + //프로젝트 단일 조회 + //프로젝트 정보 / 담당자 정보 / 해시태그 정보 총 3가지 + public ProjectInfoDto getProjectInfo(ProjectInfoDto projectInfoDto, String projectCode) { + + List pmList = getManagers(projectCode); + List hashtagList = getHashtags(projectCode); + + projectInfoDto.setPm_list(pmList); + projectInfoDto.setHashtag_list(hashtagList); + + return projectInfoDto; + } + + //내부 + private List getProjectList(ProjectSearchDto projectSearchDto, Pageable pageable) { + + List projectList = queryFactory + .select(Projections.constructor(ProjectListDto.class, + projectEntity.code + ,projectEntity.projectTitle + ,projectEntity.surveyTitle + ,projectEntity.state + ,projectEntity.ownTeam + ,memberTeamInfo.name + ,projectEntity.company + ,projectEntity.regMember + ,memberEntity.name + ,projectEntity.regDate + ,projectHashtag.hashtag.count().as("hashtag_count") + ) + ) + .from(projectEntity) + .innerJoin(memberEntity).on(projectEntity.regMember.eq(memberEntity.code)) + .innerJoin(memberTeamInfo).on(projectEntity.ownTeam.eq(memberTeamInfo.divisionCode.concat(memberTeamInfo.code.stringValue()))) + .leftJoin(projectHashtag).on(projectEntity.code.eq(projectHashtag.projectCode)) + .where( + notDelete(), + keywordLike(projectSearchDto.getKeyword()), + groupEqual(projectSearchDto.getGroup()) + ) + .groupBy( + projectEntity.idx + ,projectEntity.code + ,projectEntity.projectTitle + ,projectEntity.surveyTitle + ,projectEntity.state + ,projectEntity.ownTeam + ,memberTeamInfo.name + ,projectEntity.company + ,projectEntity.regMember + ,projectEntity.regDate + ) + .orderBy(getOrderSpecifier(pageable.getSort()).stream().toArray(OrderSpecifier[]::new)) + .offset(pageable.getOffset()) // 페이지 번호 + .limit(pageable.getPageSize()) // 페이지 사이즈 + .fetch(); + + List returnContent = new ArrayList<>(); + projectList.forEach(tempProject -> { + ProjectWithHashtagDto returnProject = ProjectWithHashtagDto.setProjectWithHashtagDto(tempProject); + + List hashtagList = new ArrayList<>(); + if(tempProject.getHashtag_count() > 0){ + hashtagList = getHashtags(tempProject.getProject_code()); + } + + returnProject.setHashtags(hashtagList); + + returnContent.add(returnProject); + }); + + return returnContent; + } + + //해시태그 가져오기 + private List getHashtags(String projectCode) { + List content = queryFactory + .select(projectHashtag.hashtag) + .from(projectHashtag) + .where(projectHashtag.projectCode.eq(projectCode)) + .fetch(); + + return content; + } + + //담당자 가져오기 + private List getManagers(String projectCode) { + List managers = queryFactory + .select(Projections.constructor(ProjectManagerDto.class, + memberProjectManager.member_code, + memberEntity.name.as("member_name"), + memberEntity.memberTeamInfo.divisionName.concat("-").concat(memberEntity.memberTeamInfo.name).as("team_name"), + memberProjectManager.role_code + ) + ) + .from(memberProjectManager) + .innerJoin(memberEntity).on(memberProjectManager.member_code.eq(memberEntity.code)) +// .innerJoin(memberTeamInfo).on(memberEntity..eq(memberTeamInfo.code)) + .where(memberProjectManager.project_code.eq(projectCode)) + .fetch(); + + return managers; + } + + // + private JPAQuery getSearchCount(ProjectSearchDto projectSearchDto){ + JPAQuery countQuery = queryFactory + .select(projectEntity.code.countDistinct()) + .from(projectEntity) + .leftJoin(projectHashtag).on(projectEntity.code.eq(projectHashtag.projectCode)) + .where( + notDelete(), + keywordLike(projectSearchDto.getKeyword()), + groupEqual(projectSearchDto.getGroup()) + ); + return countQuery; + } + + private BooleanExpression keywordLike(String keyword) { + return hasText(keyword) ? projectEntity.code.like("%"+keyword+"%") + .or(projectEntity.projectTitle.like("%"+keyword+"%")) + .or(projectEntity.surveyTitle.like("%"+keyword+"%")) + .or(projectHashtag.hashtag.like("%"+keyword+"%")) + : null; + } + + private BooleanExpression notDelete() { + return projectEntity.isDelete.eq(0); + } + private BooleanExpression groupEqual(String groupCode) { + return hasText(groupCode) ? projectEntity.ownTeam.eq(groupCode.trim()) : null; + } + + private List getOrderSpecifier(Sort sort){ + List orders = new ArrayList<>(); + sort.stream().forEach(order -> { + Order dircetion = order.isAscending() ? Order.ASC : Order.DESC; + PathBuilder orderByExpression = new PathBuilder(ProjectEntity.class, "projectEntity"); + orders.add(new OrderSpecifier(dircetion, orderByExpression.get(order.getProperty()))); + }); + + return orders; + } + + //프로젝트별 데이터 부수 가져오기 + public ProjectByStatusByCountDto getProjectByStatusByCount(String projectCode){ + + List answerList = queryFactory + .select( + Projections.constructor(ProjectByAnswerIdByCountDto.class, + qSurveyRespondent.projectCode, + qSurveyRespondent.answerId, + qSurveyRespondent.surveyTypeCode, + qSurveyRespondent.answerState, + new CaseBuilder().when(qSurveyData.answerData.isNotNull()).then(1).otherwise(0).sum().as("dataCount") + ) + ) + .from(qSurveyRespondent) + .leftJoin(qSurveyData) + .on( + qSurveyRespondent.projectCode.eq(qSurveyData.projectCode), + qSurveyRespondent.answerId.eq(qSurveyData.answerID) + ) + .leftJoin(questionEntity) + .on( + qSurveyData.projectCode.eq(questionEntity.projectCode), + qSurveyData.questionUniqueKey.eq(questionEntity.questionUniqueKey) + ) + .where( + qSurveyRespondent.projectCode.eq(projectCode), + qSurveyData.answerData.ne("[]"), + questionEntity.isDelete.eq(0) + ) + .groupBy( + qSurveyRespondent.projectCode, + qSurveyRespondent.answerId + ) + .having( + new CaseBuilder().when(qSurveyData.answerData.isNotNull()).then(1).otherwise(0).sum().gt(0) + ) + .fetch(); + + ProjectByStatusByCountDto dataCount = new ProjectByStatusByCountDto(); + + for(ProjectByAnswerIdByCountDto pac : answerList){ + if(pac.getSurveyTypeCode() != 99 && pac.getAnswerState() == 10){ + dataCount.setSuccessCount(dataCount.getSuccessCount() + 1); + } + + if(pac.getSurveyTypeCode() != 99 && pac.getAnswerState() != 10){ + dataCount.setNotSuccessCount(dataCount.getNotSuccessCount() + 1); + } + + if(pac.getSurveyTypeCode() == 99){ + dataCount.setTestCount(dataCount.getTestCount() + 1); + } + } + + return dataCount; + } + + //프로젝트 복사 + public void projectCopy(ProjectCopyRequestDto projectCopyRequestDto){ + ProjectEntity originalProjectEntity = queryFactory + .select(projectEntity) + .from(projectEntity) + .where(projectEntity.code.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetchOne(); + + ProjectEntity newProjectEntity = new ProjectEntity(); + + BeanUtils.copyProperties(originalProjectEntity, newProjectEntity, "idx"); + + //수정 + newProjectEntity.setCode(projectCopyRequestDto.getChangeProjectCode()); + newProjectEntity.setProjectTitle(newProjectEntity.getProjectTitle() + "_COPY"); + + //추가 + projectRepository.save(newProjectEntity); + + } + + //프로젝트 파일 복사 + public void projectFileCopy(ProjectCopyRequestDto projectCopyRequestDto) throws IOException { + + //파일 복사 + String copyUrl = "opt/newssak/projectfiles/" + projectCopyRequestDto.getCopyProjectCode(); + String changeUrl = "opt/newssak/projectfiles/" + projectCopyRequestDto.getChangeProjectCode(); + + File copyDirectory = new File(copyUrl); + File changeDirectory = new File(changeUrl); + + if(copyDirectory.exists() && !changeDirectory.exists()){ + changeDirectory.mkdir(); + } + + FileUtils.copyDirectory(copyDirectory, changeDirectory); + + //데이터 복사 + List originalProjectFileEntityList = queryFactory + .select(projectFileEntity) + .from(projectFileEntity) + .where(projectFileEntity.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newProjectFileEntityList = new ArrayList<>(); + + //리스트 수정 + for(ProjectFileEntity pf : originalProjectFileEntityList){ + ProjectFileEntity newProjectFileEntity = new ProjectFileEntity(); + + BeanUtils.copyProperties(pf, newProjectFileEntity, "idx"); + + newProjectFileEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newProjectFileEntityList.add(newProjectFileEntity); + } + + projectFileRepository.saveAll(newProjectFileEntityList); + } + + //프로젝트 해시태그 복사 + public void projectHashTagCopy(ProjectCopyRequestDto projectCopyRequestDto) { + + //데이터 복사 + List originalHashTagEntityList = queryFactory + .select(projectHashtag) + .from(projectHashtag) + .where(projectHashtag.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newHashTagEntityList = new ArrayList<>(); + + //리스트 수정 + for(ProjectHashtagEntity pht : originalHashTagEntityList){ + ProjectHashtagEntity newHashTagEntity = new ProjectHashtagEntity(); + + BeanUtils.copyProperties(pht, newHashTagEntity, "idx"); + + newHashTagEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newHashTagEntityList.add(newHashTagEntity); + } + + projectHashTagRepository.saveAll(newHashTagEntityList); + } + + //리다이렉트 URL 복사 + public void projectRedirectCopy(ProjectCopyRequestDto projectCopyRequestDto) { + //데이터 복사 + List originalRedirectEntityList = queryFactory + .select(projectRedirect) + .from(projectRedirect) + .where(projectRedirect.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newRedirectEntityList = new ArrayList<>(); + + //리스트 수정 + for(ProjectRedirectEntity pr : originalRedirectEntityList){ + ProjectRedirectEntity newRedirectEntity = new ProjectRedirectEntity(); + + BeanUtils.copyProperties(pr, newRedirectEntity, "idx"); + + newRedirectEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newRedirectEntityList.add(newRedirectEntity); + } + + projectRedirectRepository.saveAll(newRedirectEntityList); + } + + //파라미터 복사 + public void projectParameterCopy(ProjectCopyRequestDto projectCopyRequestDto) { + //데이터 복사 + List originalParameterEntityList = queryFactory + .select(projectParameter) + .from(projectParameter) + .where(projectParameter.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newParameterEntityList = new ArrayList<>(); + + //리스트 수정 + for(ProjectParameterEntity pp : originalParameterEntityList){ + ProjectParameterEntity newParameterEntity = new ProjectParameterEntity(); + + BeanUtils.copyProperties(pp, newParameterEntity, "idx"); + + newParameterEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newParameterEntityList.add(newParameterEntity); + } + + projectParameterRepository.saveAll(newParameterEntityList); + } + + //응답옵션 복사 + public void projectResponseCopy(ProjectCopyRequestDto projectCopyRequestDto) { + //데이터 복사 + List originalResponseEntityList = queryFactory + .select(projectResponse) + .from(projectResponse) + .where(projectResponse.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newResponseEntityList = new ArrayList<>(); + + //리스트 수정 + for(ProjectResponseEntity pr : originalResponseEntityList){ + ProjectResponseEntity newResponseEntity = new ProjectResponseEntity(); + + BeanUtils.copyProperties(pr, newResponseEntity, "idx"); + + newResponseEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newResponseEntityList.add(newResponseEntity); + } + + projectResponseRepository.saveAll(newResponseEntityList); + } + + //스타일 복사 + public void projectStyleCopy(ProjectCopyRequestDto projectCopyRequestDto) { + //데이터 복사 + List originalStyleEntityList = queryFactory + .select(projectStyle) + .from(projectStyle) + .where(projectStyle.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newStyleEntityList = new ArrayList<>(); + + //리스트 수정 + for(ProjectStyleEntity ps : originalStyleEntityList){ + ProjectStyleEntity newStyleEntity = new ProjectStyleEntity(); + + BeanUtils.copyProperties(ps, newStyleEntity, "idx"); + + newStyleEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newStyleEntityList.add(newStyleEntity); + } + + projectStyleRepository.saveAll(newStyleEntityList); + } + + //문항, 보기, 옵션 복사 + public void projectQuestionCopy(ProjectCopyRequestDto projectCopyRequestDto) { + //------------------- 문항 ------------------- + //데이터 복사 + List originalQuestionEntityList = queryFactory + .select(questionEntity) + .from(questionEntity) + .where(questionEntity.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newQuestionEntityList = new ArrayList<>(); + + //리스트 수정 + for(QuestionEntity q : originalQuestionEntityList){ + QuestionEntity newQuestionEntity = new QuestionEntity(); + + BeanUtils.copyProperties(q, newQuestionEntity, "idx"); + + newQuestionEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newQuestionEntityList.add(newQuestionEntity); + } + + questionRepository.saveAll(newQuestionEntityList); + + //------------------- 문항 보기 ------------------- + //데이터 복사 + List originalQuestionLabelEntityList = queryFactory + .select(questionLaeblEntity) + .from(questionLaeblEntity) + .where(questionLaeblEntity.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newQuestionLabelEntityList = new ArrayList<>(); + + //리스트 수정 + for(QuestionLabelEntity ql : originalQuestionLabelEntityList){ + QuestionLabelEntity newQuestionLabelEntity = new QuestionLabelEntity(); + + BeanUtils.copyProperties(ql, newQuestionLabelEntity, "idx"); + + newQuestionLabelEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newQuestionLabelEntityList.add(newQuestionLabelEntity); + } + + questionLabelRepository.saveAll(newQuestionLabelEntityList); + + //------------------- 문항 로직 ------------------- + //데이터 복사 + List originalQuestionLogicEntityList = queryFactory + .select(questionLogicEntity) + .from(questionLogicEntity) + .where(questionLogicEntity.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newQuestionLogicEntityList = new ArrayList<>(); + + //리스트 수정 + for(QuestionLogicEntity q : originalQuestionLogicEntityList){ + QuestionLogicEntity newQuestionLogicEntity = new QuestionLogicEntity(); + + BeanUtils.copyProperties(q, newQuestionLogicEntity, "idx"); + + newQuestionLogicEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newQuestionLogicEntityList.add(newQuestionLogicEntity); + } + + questionLogicRepository.saveAll(newQuestionLogicEntityList); + + //------------------- 문항 옵션 ------------------- + //데이터 복사 + List originalQuestionOptionEntityList = queryFactory + .select(questionOptionEntity) + .from(questionOptionEntity) + .where(questionOptionEntity.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newQuestionOptionEntityList = new ArrayList<>(); + + //리스트 수정 + for(QuestionOptionEntity q : originalQuestionOptionEntityList){ + QuestionOptionEntity newQuestionOptionEntity = new QuestionOptionEntity(); + + BeanUtils.copyProperties(q, newQuestionOptionEntity, "idx"); + + newQuestionOptionEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newQuestionOptionEntityList.add(newQuestionOptionEntity); + } + + questionOptionRepository.saveAll(newQuestionOptionEntityList); + + + } + + //문항 블록 복사 + public void projectQuestionBlockCopy(ProjectCopyRequestDto projectCopyRequestDto) { + //------------------- 문항 블록 ------------------- + //데이터 복사 + List originalQuestionBlockEntityList = queryFactory + .select(questionBlockEntity) + .from(questionBlockEntity) + .where(questionBlockEntity.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newQuestionBlockEntityList = new ArrayList<>(); + + //리스트 수정 + for(QuestionBlockEntity qb : originalQuestionBlockEntityList){ + QuestionBlockEntity newQuestionBlockEntity = new QuestionBlockEntity(); + + BeanUtils.copyProperties(qb, newQuestionBlockEntity, "idx"); + + newQuestionBlockEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newQuestionBlockEntityList.add(newQuestionBlockEntity); + } + + questionBlockRepository.saveAll(newQuestionBlockEntityList); + + //------------------- 문항 블록 집합 ------------------- + //데이터 복사 + List originalQuestionBlockCollectEntityList = queryFactory + .select(questionBlockCollectEntity) + .from(questionBlockCollectEntity) + .where(questionBlockCollectEntity.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newQuestionBlockCollectEntityList = new ArrayList<>(); + + //리스트 수정 + for(QuestionBlockCollectEntity qbc : originalQuestionBlockCollectEntityList){ + QuestionBlockCollectEntity newQuestionBlockCollectEntity = new QuestionBlockCollectEntity(); + + BeanUtils.copyProperties(qbc, newQuestionBlockCollectEntity, "idx"); + + newQuestionBlockCollectEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newQuestionBlockCollectEntityList.add(newQuestionBlockCollectEntity); + } + + questionBlockCollectionRepository.saveAll(newQuestionBlockCollectEntityList); + + //------------------- 문항 블록 옵션 ------------------- + //데이터 복사 + List originalQuestionBlockOptionEntityList = queryFactory + .select(questionBlockOptionEntity) + .from(questionBlockOptionEntity) + .where(questionBlockOptionEntity.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newQuestionBlockOptionEntityList = new ArrayList<>(); + + //리스트 수정 + for(QuestionBlockOptionEntity qbo : originalQuestionBlockOptionEntityList){ + QuestionBlockOptionEntity newQuestionBlockOptionEntity = new QuestionBlockOptionEntity(); + + BeanUtils.copyProperties(qbo, newQuestionBlockOptionEntity, "idx"); + + newQuestionBlockOptionEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newQuestionBlockOptionEntityList.add(newQuestionBlockOptionEntity); + } + + questionBlockOptionRepository.saveAll(newQuestionBlockOptionEntityList); + } + + public void projectHardCodeCopy(ProjectCopyRequestDto projectCopyRequestDto) { + //데이터 복사 + List originalHardCodeEntityList = queryFactory + .select(hardCodeEntity) + .from(hardCodeEntity) + .where(hardCodeEntity.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newHardCodeEntityList = new ArrayList<>(); + + //리스트 수정 + for(HardCodeEntity h : originalHardCodeEntityList){ + HardCodeEntity newHardCodeEntity = new HardCodeEntity(); + + BeanUtils.copyProperties(h, newHardCodeEntity, "id"); + + newHardCodeEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newHardCodeEntityList.add(newHardCodeEntity); + } + + hardcodeRepository.saveAll(newHardCodeEntityList); + } + + public void projectQuotaCopy(ProjectCopyRequestDto projectCopyRequestDto) { + //------------------- 쿼터 ------------------- + //데이터 복사 + List originalQuotaEntityList = queryFactory + .select(quotaEntity) + .from(quotaEntity) + .where(quotaEntity.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newQuotaEntityList = new ArrayList<>(); + + //리스트 수정 + for(QuotaEntity q : originalQuotaEntityList){ + QuotaEntity newQuotaEntity = new QuotaEntity(); + + BeanUtils.copyProperties(q, newQuotaEntity, "id"); + + newQuotaEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newQuotaEntityList.add(newQuotaEntity); + } + + quotaRepository.saveAll(newQuotaEntityList); + + //------------------- 쿼터 셀 ------------------- + //데이터 복사 + List originalQuotaCellEntityList = queryFactory + .select(quotaCellEntity) + .from(quotaCellEntity) + .where(quotaCellEntity.projectCode.eq(projectCopyRequestDto.getCopyProjectCode())) + .fetch(); + + List newQuotaCellEntityList = new ArrayList<>(); + + //리스트 수정 + for(QuotaCellEntity q : originalQuotaCellEntityList){ + QuotaCellEntity newQuotaCellEntity = new QuotaCellEntity(); + + BeanUtils.copyProperties(q, newQuotaCellEntity, "id"); + + newQuotaCellEntity.setProjectCode(projectCopyRequestDto.getChangeProjectCode()); + + newQuotaCellEntityList.add(newQuotaCellEntity); + } + + quotaCellRepository.saveAll(newQuotaCellEntityList); + } +} diff --git a/src/main/java/com/krt/newssak/repository/project/ProjectRedirectRepository.java b/src/main/java/com/krt/newssak/repository/project/ProjectRedirectRepository.java new file mode 100644 index 0000000..8742106 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/project/ProjectRedirectRepository.java @@ -0,0 +1,15 @@ +package com.krt.newssak.repository.project; + +import com.krt.newssak.entity.project.ProjectRedirectEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface ProjectRedirectRepository extends JpaRepository, JpaSpecificationExecutor { + + List findByProjectCode(String projectCode); + +} diff --git a/src/main/java/com/krt/newssak/repository/project/ProjectRepository.java b/src/main/java/com/krt/newssak/repository/project/ProjectRepository.java new file mode 100644 index 0000000..d2e3e33 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/project/ProjectRepository.java @@ -0,0 +1,17 @@ +package com.krt.newssak.repository.project; + +import com.krt.newssak.entity.project.ProjectEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Optional; + +@Repository +public interface ProjectRepository extends JpaRepository, JpaSpecificationExecutor { + + Optional findByCodeAndIsDelete(String cd, int is_delete); + + List findByIsDelete(int is_delete); +} diff --git a/src/main/java/com/krt/newssak/repository/project/ProjectResponseRepository.java b/src/main/java/com/krt/newssak/repository/project/ProjectResponseRepository.java new file mode 100644 index 0000000..0608375 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/project/ProjectResponseRepository.java @@ -0,0 +1,13 @@ +package com.krt.newssak.repository.project; + +import com.krt.newssak.entity.project.ProjectResponseEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface ProjectResponseRepository extends JpaRepository, JpaSpecificationExecutor { + List findByProjectCode(String projectCode); +} diff --git a/src/main/java/com/krt/newssak/repository/project/ProjectStyleRepository.java b/src/main/java/com/krt/newssak/repository/project/ProjectStyleRepository.java new file mode 100644 index 0000000..a9570f8 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/project/ProjectStyleRepository.java @@ -0,0 +1,13 @@ +package com.krt.newssak.repository.project; + +import com.krt.newssak.entity.project.ProjectStyleEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface ProjectStyleRepository extends JpaRepository, JpaSpecificationExecutor { + List findByProjectCodeOrderByStyleCode(String projectCode); +} diff --git a/src/main/java/com/krt/newssak/repository/question/QuestionBlockCollectionRepository.java b/src/main/java/com/krt/newssak/repository/question/QuestionBlockCollectionRepository.java new file mode 100644 index 0000000..9ca8c13 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/question/QuestionBlockCollectionRepository.java @@ -0,0 +1,17 @@ +package com.krt.newssak.repository.question; + + +import com.krt.newssak.entity.question.QuestionBlockCollectEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface QuestionBlockCollectionRepository extends JpaRepository, JpaSpecificationExecutor { + + List findAllByProjectCodeAndBlockCode(String projectCode, int blockCode); + + int deleteAllByProjectCodeAndBlockCode(String projectCode, int blockCode); + + int deleteAllByProjectCodeAndQuestionUniqueKey(String projectCode, int questionUniqueKey); +} diff --git a/src/main/java/com/krt/newssak/repository/question/QuestionBlockOptionRepository.java b/src/main/java/com/krt/newssak/repository/question/QuestionBlockOptionRepository.java new file mode 100644 index 0000000..287682d --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/question/QuestionBlockOptionRepository.java @@ -0,0 +1,9 @@ +package com.krt.newssak.repository.question; + +import com.krt.newssak.entity.question.QuestionBlockCollectEntity; +import com.krt.newssak.entity.question.QuestionBlockOptionEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface QuestionBlockOptionRepository extends JpaRepository, JpaSpecificationExecutor { +} diff --git a/src/main/java/com/krt/newssak/repository/question/QuestionBlockRepository.java b/src/main/java/com/krt/newssak/repository/question/QuestionBlockRepository.java new file mode 100644 index 0000000..9665952 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/question/QuestionBlockRepository.java @@ -0,0 +1,17 @@ +package com.krt.newssak.repository.question; + + +import com.krt.newssak.entity.question.QuestionBlockEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface QuestionBlockRepository extends JpaRepository, JpaSpecificationExecutor { + + QuestionBlockEntity findFirstByProjectCodeOrderByBlockCodeDesc(String projectCode); + + List findAllByProjectCode(String projectCode); + + int deleteByProjectCodeAndBlockCode(String projectCode, int blockCode); +} diff --git a/src/main/java/com/krt/newssak/repository/question/QuestionHardcodeHistoryRepository.java b/src/main/java/com/krt/newssak/repository/question/QuestionHardcodeHistoryRepository.java new file mode 100644 index 0000000..867a56b --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/question/QuestionHardcodeHistoryRepository.java @@ -0,0 +1,9 @@ +package com.krt.newssak.repository.question; + +import com.krt.newssak.entity.question.QuestionHardcodeHistoryEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface QuestionHardcodeHistoryRepository extends JpaRepository, JpaSpecificationExecutor { + +} diff --git a/src/main/java/com/krt/newssak/repository/question/QuestionHardcodeRepository.java b/src/main/java/com/krt/newssak/repository/question/QuestionHardcodeRepository.java new file mode 100644 index 0000000..5b2914a --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/question/QuestionHardcodeRepository.java @@ -0,0 +1,9 @@ +package com.krt.newssak.repository.question; + +import com.krt.newssak.entity.question.QuestionHardcodeEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface QuestionHardcodeRepository extends JpaRepository, JpaSpecificationExecutor { + +} diff --git a/src/main/java/com/krt/newssak/repository/question/QuestionLabelRepository.java b/src/main/java/com/krt/newssak/repository/question/QuestionLabelRepository.java new file mode 100644 index 0000000..f5b37ef --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/question/QuestionLabelRepository.java @@ -0,0 +1,11 @@ +package com.krt.newssak.repository.question; + +import com.krt.newssak.entity.question.QuestionLabelEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface QuestionLabelRepository extends JpaRepository, JpaSpecificationExecutor { + List findAllByProjectCodeAndQuestionUniqueKey(String projectCode, int questionUniqueKey); +} diff --git a/src/main/java/com/krt/newssak/repository/question/QuestionLogicRepository.java b/src/main/java/com/krt/newssak/repository/question/QuestionLogicRepository.java new file mode 100644 index 0000000..6bcdf03 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/question/QuestionLogicRepository.java @@ -0,0 +1,12 @@ +package com.krt.newssak.repository.question; + +import com.krt.newssak.entity.question.QuestionLogicEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface QuestionLogicRepository extends JpaRepository, JpaSpecificationExecutor { + + QuestionLogicEntity findByProjectCodeAndQuestionUniqueKey(String projectCode, int questionUniqueKey); + + +} diff --git a/src/main/java/com/krt/newssak/repository/question/QuestionOptionRepository.java b/src/main/java/com/krt/newssak/repository/question/QuestionOptionRepository.java new file mode 100644 index 0000000..c0a80b7 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/question/QuestionOptionRepository.java @@ -0,0 +1,9 @@ +package com.krt.newssak.repository.question; + +import com.krt.newssak.entity.question.QuestionOptionEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface QuestionOptionRepository extends JpaRepository, JpaSpecificationExecutor { + QuestionOptionEntity findByProjectCodeAndQuestionUniqueKey(String projectCode, int questionUniqueKey); +} diff --git a/src/main/java/com/krt/newssak/repository/question/QuestionQueryRepository.java b/src/main/java/com/krt/newssak/repository/question/QuestionQueryRepository.java new file mode 100644 index 0000000..4c42d90 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/question/QuestionQueryRepository.java @@ -0,0 +1,242 @@ +package com.krt.newssak.repository.question; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.newssak.dto.datamange.*; +import com.krt.newssak.dto.question.QuestionDeleteDto; +import com.krt.newssak.entity.question.QQuestionBlockCollectEntity; +import com.krt.newssak.entity.question.QQuestionEntity; +import com.krt.newssak.entity.question.QuestionEntity; +import com.krt.newssak.entity.survey.QSurveyDataEntity; +import com.krt.newssak.entity.survey.QSurveyRespondentEntity; +import com.krt.newssak.entity.survey.SurveyDataEntity; +import com.krt.newssak.entity.survey.SurveyRespondentEntity; +import com.krt.newssak.util.Common; +import com.querydsl.core.BooleanBuilder; +import com.querydsl.core.Tuple; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Repository; + +import java.lang.reflect.Type; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Repository +@RequiredArgsConstructor +public class QuestionQueryRepository { + + private final JPAQueryFactory queryFactory; + private QQuestionEntity questionEntity = QQuestionEntity.questionEntity; + private QSurveyDataEntity surveyDataEntity = QSurveyDataEntity.surveyDataEntity; + private QSurveyRespondentEntity surveyRespondentEntity = QSurveyRespondentEntity.surveyRespondentEntity; + private QQuestionBlockCollectEntity questionBlockCollectEntity = QQuestionBlockCollectEntity.questionBlockCollectEntity; + + private final QuestionRepository questionRepository; + + public long updateIsDelete(QuestionDeleteDto questionDeleteDto){ + return queryFactory.update(questionEntity) + .set(questionEntity.isDelete, 1) + .set(questionEntity.deleteDate, Common.getNow(null)) + .where( + questionEntity.projectCode.eq(questionDeleteDto.getProject_code()), + questionEntity.questionUniqueKey.in(questionDeleteDto.getQuestion_unique_key()), + notDelete() + ) + .execute(); + } + + public long decreaseQuestionOrder(String projectCode, int deleteQuestionOrder){ + return queryFactory.update(questionEntity) + .set(questionEntity.questionOrder, questionEntity.questionOrder.subtract(1)) + .where( + questionEntity.projectCode.eq(projectCode), + questionEntity.questionOrder.gt(deleteQuestionOrder) + ) + .execute(); + } + + public long increaseQuestionOrder(String projectCode, int insertQuestionOrder){ + return queryFactory.update(questionEntity) + .set(questionEntity.questionOrder, questionEntity.questionOrder.add(1)) + .where( + questionEntity.projectCode.eq(projectCode), + questionEntity.questionOrder.goe(insertQuestionOrder) + ) + .execute(); + } + + private BooleanExpression notDelete() { + return questionEntity.isDelete.eq(0); + } + + public List selectAnswerData(GetDataRequestDto getDataRequestDto){ + List result = queryFactory + .select(questionEntity, surveyDataEntity) + .from(questionEntity) + .leftJoin(surveyDataEntity) + .on( + questionEntity.projectCode.eq(surveyDataEntity.projectCode) + .and(questionEntity.questionUniqueKey.eq(surveyDataEntity.questionUniqueKey)) + .and(surveyDataEntity.answerID.eq(getDataRequestDto.getAnswerId())) + ) + .where( + questionEntity.projectCode.eq(getDataRequestDto.getProjectCode()), + questionEntity.questionOrder.gt(0), + questionEntity.isDelete.eq(0) + ) + .orderBy( + questionEntity.questionOrder.asc() + ) + .fetch(); + + List answerQuestionDtoList = new ArrayList<>(); + Gson gson = new Gson(); + Type surveyDataType = new TypeToken>(){}.getType(); + + for(Tuple tuple : result){ + QuestionEntity questionEntity = tuple.get(0, QuestionEntity.class); + + AnswerQuestionDto answerQuestionDto = AnswerQuestionDto.builder() + .questionID(questionEntity.getQuestionID()) + .questionUniqueKey(questionEntity.getQuestionUniqueKey()) + .questionOrder(questionEntity.getQuestionOrder()) + .loopId(-1) + .surveyDataStructureDtoList(new ArrayList<>()) + .build(); + + if(tuple.get(1, SurveyDataEntity.class) != null){ + SurveyDataEntity surveyDataEntity = tuple.get(1, SurveyDataEntity.class); + answerQuestionDto.setLoopId(surveyDataEntity.getLoopID()); + + List surveyDataStructureDtoList = gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType); + if(surveyDataStructureDtoList.size() > 0){ + answerQuestionDto.getSurveyDataStructureDtoList().addAll(surveyDataStructureDtoList); + } + } + + answerQuestionDtoList.add(answerQuestionDto); + } + + return answerQuestionDtoList; + } + + public long updateAnswerData(ModifyDataRequestDto modifyDataRequestDto){ + Gson gson = new Gson(); + return queryFactory.update(surveyDataEntity) + .set(surveyDataEntity.answerData, gson.toJson(modifyDataRequestDto.getSurveyDataStructureDtoList())) + .where( + surveyDataEntity.projectCode.eq(modifyDataRequestDto.getProjectCode()), + surveyDataEntity.answerID.eq(modifyDataRequestDto.getAnswerId()), + surveyDataEntity.questionUniqueKey.eq(modifyDataRequestDto.getQuestionUniqueKey()), + surveyDataEntity.loopID.eq(modifyDataRequestDto.getLoopId()) + ) + .execute(); + } + + public long deleteAnswerData(DeleteDataRequestDto deleteDataRequestDto){ + //날짜 + Date today = new Date(); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); + String deleteTime = "_DEL_"+dateFormat.format(today); + + + //surveyRespondent 변경 +// queryFactory.update(surveyRespondentEntity) +// .set(surveyRespondentEntity.answerId, deleteDataRequestDto.getAnswerId()+deleteTime) +// .set(surveyRespondentEntity.answerState, 999) +// .where( +// surveyRespondentEntity.projectCode.eq(deleteDataRequestDto.getProjectCode()) +// .and(surveyRespondentEntity.answerId.eq(deleteDataRequestDto.getAnswerId())) +// ) +// .execute(); + + //surveyData where 조건 세팅 + BooleanBuilder builder = new BooleanBuilder(); + + builder.and(surveyDataEntity.projectCode.eq(deleteDataRequestDto.getProjectCode())); + builder.and(surveyDataEntity.answerID.eq(deleteDataRequestDto.getAnswerId())); + + //이후 문항 데이터 삭제 + if(deleteDataRequestDto.getAfterQuestionOrder() > -1){ + List uniqueKeyList = questionRepository.findAllByProjectCodeAndQuestionOrderGreaterThanAndIsDeleteOrderByQuestionOrderAsc(deleteDataRequestDto.getProjectCode(), + deleteDataRequestDto.getAfterQuestionOrder() + , 0) + .stream() + .map(QuestionEntity::getQuestionUniqueKey) + .collect(Collectors.toList()); + + builder.and(surveyDataEntity.questionUniqueKey.in(uniqueKeyList)); + } + + //다중 선택 데이터 삭제 + if(deleteDataRequestDto.getQuestionUniqueKeyList().size() > 0){ + builder.and(surveyDataEntity.questionUniqueKey.in(deleteDataRequestDto.getQuestionUniqueKeyList())); + } + + + + return queryFactory.update(surveyDataEntity) + .set(surveyDataEntity.answerID, deleteDataRequestDto.getAnswerId()+deleteTime) + .where(builder) + .execute(); + } + + public List getAnswerUser(GetAnswerUserRequestDto getAnswerUserRequestDto) { + + List surveyRespondentEntityList = queryFactory.select(surveyRespondentEntity) + .from(surveyRespondentEntity) + .where(surveyRespondentEntity.projectCode.eq(getAnswerUserRequestDto.getProjectCode())) + //리스트 한번에 처리할 것인지, onKeyup 할때마다 불러올 것인지 확인!!! + .fetch(); + + return surveyRespondentEntityList.stream().map(SurveyRespondentEntity::of).collect(Collectors.toList()); + } + + public Long changeAnswerStatus(ChangeStatusRequestDto changeStatusRequestDto) { + //날짜 + Date today = new Date(); + + if(changeStatusRequestDto.getSurveyStatus() == 999){ + return queryFactory.update(surveyRespondentEntity) + .set(surveyRespondentEntity.answerId, changeStatusRequestDto.getAnswerId()) + .set(surveyRespondentEntity.answerState, changeStatusRequestDto.getSurveyStatus()) + .where( + surveyRespondentEntity.projectCode.eq(changeStatusRequestDto.getProjectCode()) + .and(surveyRespondentEntity.answerId.eq(changeStatusRequestDto.getAnswerId())) + ) + .execute(); + }else{ + return queryFactory.update(surveyRespondentEntity) + .set(surveyRespondentEntity.answerState, changeStatusRequestDto.getSurveyStatus()) + .where( + surveyRespondentEntity.projectCode.eq(changeStatusRequestDto.getProjectCode()) + .and(surveyRespondentEntity.answerId.eq(changeStatusRequestDto.getAnswerId())) + ) + .execute(); + } + + +// return queryFactory.update(surveyRespondentEntity) +// .set(surveyRespondentEntity.answerState, changeStatusRequestDto.getSurveyStatus()) +// .where( +// surveyRespondentEntity.projectCode.eq(changeStatusRequestDto.getProjectCode()) +// .and(surveyRespondentEntity.answerId.eq(changeStatusRequestDto.getAnswerId())) +// ) +// .execute(); + } + + public Long deleteQuestionBlockCollection(QuestionDeleteDto questionDeleteDto) { + return queryFactory.delete(questionBlockCollectEntity) + .where( + questionBlockCollectEntity.projectCode.eq(questionDeleteDto.getProject_code()), + questionBlockCollectEntity.questionUniqueKey.in(questionDeleteDto.getQuestion_unique_key()) + ) + .execute(); + } +} diff --git a/src/main/java/com/krt/newssak/repository/question/QuestionRepository.java b/src/main/java/com/krt/newssak/repository/question/QuestionRepository.java new file mode 100644 index 0000000..29c1d65 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/question/QuestionRepository.java @@ -0,0 +1,26 @@ +package com.krt.newssak.repository.question; + +import com.krt.newssak.entity.question.QuestionEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; +import java.util.Optional; + +public interface QuestionRepository extends JpaRepository, JpaSpecificationExecutor { + Optional findByProjectCodeAndQuestionUniqueKeyNotAndQuestionIDAndIsDelete(String projectCode, int questionUniqueKey, String questionID, int isDelete); + + QuestionEntity findFirstByProjectCodeOrderByQuestionOrderDesc(String projectCode); + + QuestionEntity findFirstByProjectCodeOrderByQuestionUniqueKeyDesc(String projectCode); + + QuestionEntity findFirstByProjectCodeAndQuestionIDAndIsDelete(String projectCode, String questionID, int isDelete); + + QuestionEntity findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(String projectCode, int questionUniqueKey, int isDelete); + + boolean existsByProjectCodeAndQuestionIDAndIsDelete(String projectCode, String questionId, int isDelete); + + List findAllByProjectCodeAndQuestionOrderGreaterThanAndIsDeleteOrderByQuestionOrderAsc(String projectCode, int questionOrder, int isDelete); + + List findAllByProjectCodeAndIsDelete(String projectCode, int isDelete); +} diff --git a/src/main/java/com/krt/newssak/repository/quota/QuotaCellRepository.java b/src/main/java/com/krt/newssak/repository/quota/QuotaCellRepository.java new file mode 100644 index 0000000..2103972 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/quota/QuotaCellRepository.java @@ -0,0 +1,11 @@ +package com.krt.newssak.repository.quota; + +import com.krt.newssak.entity.quota.QuotaCellEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface QuotaCellRepository extends JpaRepository, JpaSpecificationExecutor { + List findAllByProjectCodeAndQuotaCodeOrderByIdx(String projectCode, int quotaCode); +} diff --git a/src/main/java/com/krt/newssak/repository/quota/QuotaQueryRepository.java b/src/main/java/com/krt/newssak/repository/quota/QuotaQueryRepository.java new file mode 100644 index 0000000..b0f84cd --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/quota/QuotaQueryRepository.java @@ -0,0 +1,24 @@ +package com.krt.newssak.repository.quota; + +import com.krt.newssak.entity.quota.QQuotaCellEntity; +import com.krt.newssak.entity.quota.QuotaCellEntity; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +@RequiredArgsConstructor +public class QuotaQueryRepository { + private final JPAQueryFactory queryFactory; + private QQuotaCellEntity quotaCellEntity = QQuotaCellEntity.quotaCellEntity; + + public List findAllByQuotaCellIdxIn(List quotaCellIdxList){ + return queryFactory.select(quotaCellEntity) + .from(quotaCellEntity) + .where(quotaCellEntity.idx.in(quotaCellIdxList)) + .orderBy(quotaCellEntity.idx.asc()) + .fetch(); + } +} diff --git a/src/main/java/com/krt/newssak/repository/quota/QuotaRepository.java b/src/main/java/com/krt/newssak/repository/quota/QuotaRepository.java new file mode 100644 index 0000000..205e2e6 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/quota/QuotaRepository.java @@ -0,0 +1,15 @@ +package com.krt.newssak.repository.quota; + +import com.krt.newssak.entity.quota.QuotaEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface QuotaRepository extends JpaRepository, JpaSpecificationExecutor { + List findAllByProjectCode(String projectCode); + + QuotaEntity findFirstByProjectCodeAndQuotaCode(String projectCode, int quotaCode); + + QuotaEntity findFirstByProjectCodeOrderByQuotaCodeDesc(String projectCode); +} diff --git a/src/main/java/com/krt/newssak/repository/survey/SurveyDataRepository.java b/src/main/java/com/krt/newssak/repository/survey/SurveyDataRepository.java new file mode 100644 index 0000000..c873b13 --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/survey/SurveyDataRepository.java @@ -0,0 +1,14 @@ +package com.krt.newssak.repository.survey; + + +import com.krt.newssak.entity.survey.SurveyDataEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface SurveyDataRepository extends JpaRepository, JpaSpecificationExecutor { + + SurveyDataEntity findFirstByProjectCodeAndAnswerIDAndQuestionUniqueKeyAndAnswerDataContains(String projectCode, String answerId, int questionUniqueKey, String token); + +} diff --git a/src/main/java/com/krt/newssak/repository/survey/SurveyRespondentRepository.java b/src/main/java/com/krt/newssak/repository/survey/SurveyRespondentRepository.java new file mode 100644 index 0000000..c40c34b --- /dev/null +++ b/src/main/java/com/krt/newssak/repository/survey/SurveyRespondentRepository.java @@ -0,0 +1,14 @@ +package com.krt.newssak.repository.survey; + + +import com.krt.newssak.entity.survey.SurveyRespondentEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface SurveyRespondentRepository extends JpaRepository, JpaSpecificationExecutor { + SurveyRespondentEntity findFirstByProjectCodeAndAnswerId(String projectCode, String answerID); + + List findByProjectCodeAndAnswerIdContains(String projectCode, String answerId); +} diff --git a/src/main/java/com/krt/newssak/service/CapiService.java b/src/main/java/com/krt/newssak/service/CapiService.java new file mode 100644 index 0000000..4ed8bcd --- /dev/null +++ b/src/main/java/com/krt/newssak/service/CapiService.java @@ -0,0 +1,235 @@ +package com.krt.newssak.service; + +import com.krt.newssak.dto.capi.*; +import com.krt.newssak.dto.project.ProjectDto; +import com.krt.newssak.entity.capi.InterviewerAssignEntity; +import com.krt.newssak.entity.capi.InterviewerDeleteRequestEntity; +import com.krt.newssak.entity.capi.InterviewerInfoEntity; +import com.krt.newssak.entity.project.ProjectEntity; +import com.krt.newssak.entity.survey.SurveyRespondentEntity; +import com.krt.newssak.exception.ApiException; +import com.krt.newssak.exception.ExceptionEnum; +import com.krt.newssak.repository.capi.CapiAssignRepository; +import com.krt.newssak.repository.capi.CapiQueryRepository; +import com.krt.newssak.repository.capi.CapiRepository; +import com.krt.newssak.repository.capi.CapiSurveyDataDeleteRequestRepository; +import com.krt.newssak.repository.project.ProjectRepository; +import com.krt.newssak.repository.survey.SurveyRespondentRepository; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import org.apache.poi.hssf.usermodel.HSSFDataFormat; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.stereotype.Service; + +import java.io.OutputStream; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.stream.Collectors; + +@Service +@RequiredArgsConstructor +public class CapiService { + + private final CapiRepository capiRepository; + private final CapiAssignRepository capiAssignRepository; + private final CapiSurveyDataDeleteRequestRepository capiSurveyDataDeleteRequestRepository; + private final ProjectRepository projectRepository; + private final SurveyRespondentRepository surveyRespondentRepository; + + private final CapiQueryRepository capiQueryRepository; + + + public List getProjectList() { + List projectEntityList = new ArrayList<>(); + + projectEntityList = projectRepository.findByIsDelete(0); + + return projectEntityList.stream().map(ProjectDto::of).collect(Collectors.toList()); + } + + public void saveInterviewer(List saveInterviewerRequestDtos) { + + //현재 등록된 면접원 리스트 + List currentInterviewerInfoEntityList = capiRepository.findAllByOrderByCodeDesc(); + + //면접원 저장 + List insertInterviewerInfoEntityList = new ArrayList<>(); + + //면접원 코드 (숫자 차례대로) + int interviewerLastNumber = currentInterviewerInfoEntityList.size() == 0 ? 1 : Integer.parseInt(currentInterviewerInfoEntityList.get(0).getCode().replace("P","")); + + int index = 1; + for(SaveInterviewerRequestDto saveInterviewerRequestDto : saveInterviewerRequestDtos){ + String interviewerCode = "P"+String.format("%07d", (interviewerLastNumber + (index++)) ); + saveInterviewerRequestDto.setCode(interviewerCode); + + insertInterviewerInfoEntityList.add(InterviewerInfoEntity.toEntity(saveInterviewerRequestDto)); + } + + + //코드/ID 중복리스트 + List idAndPwDupList = insertInterviewerInfoEntityList.stream() + .filter(inList -> currentInterviewerInfoEntityList.stream().anyMatch(cuList -> inList.getInterviewerId().equals(cuList.getInterviewerId()) + && inList.getInterviewerPwd().equals(cuList.getInterviewerPwd()) + && inList.getIdx() == 0)).collect(Collectors.toList()); + + //저장할 리스트 중복체크 + List insertDupList = saveInterviewerRequestDtos.stream() + .filter(list1 -> saveInterviewerRequestDtos.stream() + .anyMatch(list2 -> !list1.getCode().equals(list2.getCode()) && list1.getId().equals(list2.getId()) && list1.getPwd().equals(list2.getPwd()))) + .collect(Collectors.toList()); + + //에러처리 + if(idAndPwDupList.size() > 0){ + throw new ApiException(ExceptionEnum.INTERVIEWER_ID_DUPLICATE); + } + + if(insertDupList.size() > 0){ + throw new ApiException(ExceptionEnum.INTERVIEWER_ID_DUPLICATE); + } + + capiRepository.saveAll(insertInterviewerInfoEntityList); + } + + public List getInterviewers() { + + List interviewerInfoEntityList = capiRepository.findAll(); + + return interviewerInfoEntityList.stream().map(GetInterviewerResponseDto::of).collect(Collectors.toList()); + } + + public void deleteInterviewer(DeleteInterviewerRequestDto deleteInterviewerRequestDto) { + capiRepository.deleteAllById(deleteInterviewerRequestDto.getDeleteIdxList()); + } + + public Map getInterviewerAllocationStatus(GetInterviewerAllocationStatusRequestDto getInterviewerAllocationStatusRequestDto) { + List getInterviewerAssignEntityList = capiAssignRepository.findByProjectCode(getInterviewerAllocationStatusRequestDto.getProjectCode()); + List getInterviewerInfoEntityList = capiRepository.findAll(); + + List interviewerResponseDtoList = getInterviewerInfoEntityList.stream() + .filter(i -> getInterviewerAssignEntityList.stream().noneMatch(j -> i.getCode().equals(j.getInterviewerId()))) + .map(GetInterviewerResponseDto::of).collect(Collectors.toList()); + + List interviewerAssignResponseDtoList = new ArrayList<>(); + + for(InterviewerInfoEntity interviewerInfoEntity : getInterviewerInfoEntityList){ + for(InterviewerAssignEntity interviewerAssignEntity : getInterviewerAssignEntityList){ + if(interviewerInfoEntity.getCode().equals(interviewerAssignEntity.getInterviewerId())){ + GetInterviewerResponseDto getInterviewerResponseDto = GetInterviewerResponseDto.of(interviewerInfoEntity); + getInterviewerResponseDto.setIdx(interviewerAssignEntity.getIdx()); + interviewerAssignResponseDtoList.add(getInterviewerResponseDto); + } + } + } + + interviewerResponseDtoList.sort(Comparator.comparing(GetInterviewerResponseDto::getId)); + interviewerAssignResponseDtoList.sort(Comparator.comparing(GetInterviewerResponseDto::getId)); + + Map allocationStatusList = new HashMap<>(); + + allocationStatusList.put("assignList", interviewerAssignResponseDtoList); + allocationStatusList.put("interviewerList", interviewerResponseDtoList); + + return allocationStatusList; + } + + public void saveInterviewerAllocation(SaveInterviewerAllocationRequestDto saveInterviewerAllocationRequestDto) { + + //추가 + if(saveInterviewerAllocationRequestDto.getSaveAllocationList().size() > 0){ + List saveInterviewerAssignList = saveInterviewerAllocationRequestDto.getSaveAllocationList().stream().map(InterviewerAssignEntity::toEntity).collect(Collectors.toList()); + + capiAssignRepository.saveAll(saveInterviewerAssignList); + } + + //삭제 + if(saveInterviewerAllocationRequestDto.getDeleteIdxList().size() > 0){ + capiAssignRepository.deleteAllById(saveInterviewerAllocationRequestDto.getDeleteIdxList()); + } + } + + public List getInterviewerSurveyStatus(GetInterviewerSurveyStatusRequestDto getInterviewerSurveyStatusRequestDto) { + + return capiQueryRepository.findInterviewerByStatusCount(getInterviewerSurveyStatusRequestDto); + } + + + public List getSurveyDataDeleteRequestList(GetDeleteSurveyReqDataRequestDto getDeleteSurveyReqDataRequestDto) { + return capiQueryRepository.findSurveyDataDeleteRequestList(getDeleteSurveyReqDataRequestDto); + } + + public void surveyDataDeleteAccept(SurveyDataDeleteAcceptRequestDto surveyDataDeleteAcceptRequestDto) { + InterviewerDeleteRequestEntity interviewerDeleteRequestEntity = capiSurveyDataDeleteRequestRepository.findByIdx(surveyDataDeleteAcceptRequestDto.getIdx()); + + if(interviewerDeleteRequestEntity != null && interviewerDeleteRequestEntity.getResult() == 0){ + + //삭제 요청데이터 결과코드 변경 + interviewerDeleteRequestEntity.setResult(surveyDataDeleteAcceptRequestDto.getResult()); + capiSurveyDataDeleteRequestRepository.save(interviewerDeleteRequestEntity); + + //데이터 결과코드 삭제로 변경 + if(surveyDataDeleteAcceptRequestDto.getResult() == 1){ + SurveyRespondentEntity surveyRespondentEntity = surveyRespondentRepository.findFirstByProjectCodeAndAnswerId(interviewerDeleteRequestEntity.getProjectCode(), interviewerDeleteRequestEntity.getAnswerId()); + + surveyRespondentEntity.setAnswerState(999); + surveyRespondentRepository.save(surveyRespondentEntity); + } + }else{ + throw new ApiException(ExceptionEnum.DELETE_REQUEST_DATA_NOT_FOUND); + } + } + + public void interviewerDownloadList(HttpServletResponse response, GetInterviewerSurveyStatusRequestDto listDownloadGetRequestDto) { + List headerList = new ArrayList<>(Arrays.asList("면접원코드","면접원명","진행중","완료","스크린","쿼터")); + List statusList = capiQueryRepository.findInterviewerByStatusCount(listDownloadGetRequestDto); + + try { + + Workbook workbook = new XSSFWorkbook(); + Sheet sheet = workbook.createSheet("면접원별 현황"); + + //숫자 포맷은 아래 numberCellStyle을 적용시킬 것이다다 + CellStyle numberCellStyle = workbook.createCellStyle(); + numberCellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0")); + + //파일명 + String fileName = listDownloadGetRequestDto.getProjectCode() + " 면접원 현황 리스트"; + fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8); + fileName = fileName.replaceAll("\\+", "%20"); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx"); + + //헤더 + Row row = sheet.createRow(0); + + for (int i = 0; i < headerList.size(); i++) { + Cell cell = row.createCell(i); + cell.setCellValue(headerList.get(i)); + } + + //바디 + for (int i = 0; i < statusList.size(); i++) { + row = sheet.createRow(i + 1); + + int cellIndex = 0; + + List valuesList = statusList.get(i).fieldValuesList(); + + for(String value : valuesList){ + Cell cell = row.createCell(cellIndex++); + cell.setCellValue(value); + } + } + + OutputStream fileOut = response.getOutputStream(); + workbook.write(fileOut); + fileOut.close(); + + }catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/krt/newssak/service/CustomUserDetailsService.java b/src/main/java/com/krt/newssak/service/CustomUserDetailsService.java new file mode 100644 index 0000000..88582cb --- /dev/null +++ b/src/main/java/com/krt/newssak/service/CustomUserDetailsService.java @@ -0,0 +1,46 @@ +package com.krt.newssak.service; + +import com.krt.newssak.dto.member.CustomUserDetails; +import com.krt.newssak.entity.member.MemberEntity; +import com.krt.newssak.exception.ApiException; +import com.krt.newssak.exception.ExceptionEnum; +import com.krt.newssak.repository.member.MemberRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; + +import java.util.stream.Collectors; + +@Service +@RequiredArgsConstructor +public class CustomUserDetailsService implements UserDetailsService { + + private final MemberRepository memberRepository; + private final PasswordEncoder passwordEncoder; + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { +// System.out.println(username + "<< username 값"); + if(!username.contains("@")){ + username += "@"; + } + MemberEntity member = memberRepository.findByIdStartsWith(username) + .orElseThrow(() -> new ApiException(ExceptionEnum.USER_NOT_FOUND)); + + return new CustomUserDetails(member, passwordEncoder); + } + + // 해당하는 User 의 데이터가 존재한다면 UserDetails 객체로 만들어서 리턴 + private UserDetails createUserDetails(MemberEntity member) { + return User.builder() + .username(member.getId()) + .password(passwordEncoder.encode(member.getPassword())) + .roles("ADMIN") + .build(); + } + +} diff --git a/src/main/java/com/krt/newssak/service/DataManageService.java b/src/main/java/com/krt/newssak/service/DataManageService.java new file mode 100644 index 0000000..9facc38 --- /dev/null +++ b/src/main/java/com/krt/newssak/service/DataManageService.java @@ -0,0 +1,39 @@ +package com.krt.newssak.service; + +import com.krt.newssak.dto.datamange.*; +import com.krt.newssak.repository.question.QuestionQueryRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +@Transactional +@RequiredArgsConstructor +public class DataManageService { + + private final QuestionQueryRepository questionQueryRepository; + +// private final QuestionRepository questionRepository; + + public List getAllData(GetDataRequestDto getDataRequestDto) { + return questionQueryRepository.selectAnswerData(getDataRequestDto); + } + + public long modifyData(ModifyDataRequestDto modifyDataRequestDto) { + return questionQueryRepository.updateAnswerData(modifyDataRequestDto); + } + + public long deleteData(DeleteDataRequestDto deleteDataRequestDto) { + return questionQueryRepository.deleteAnswerData(deleteDataRequestDto); + } + + public List getAnswerUser(GetAnswerUserRequestDto getAnswerUserRequestDto) { + return questionQueryRepository.getAnswerUser(getAnswerUserRequestDto); + } + + public long changeAnswerStatus(ChangeStatusRequestDto changeStatusRequestDto) { + return questionQueryRepository.changeAnswerStatus(changeStatusRequestDto); + } +} diff --git a/src/main/java/com/krt/newssak/service/HardCodeService.java b/src/main/java/com/krt/newssak/service/HardCodeService.java new file mode 100644 index 0000000..55a2162 --- /dev/null +++ b/src/main/java/com/krt/newssak/service/HardCodeService.java @@ -0,0 +1,64 @@ +package com.krt.newssak.service; + +import com.krt.newssak.dto.hardcode.HardCodeAndHistoryDto; +import com.krt.newssak.dto.hardcode.HardCodeDto; +import com.krt.newssak.dto.hardcode.HardCodeHistoryDto; +import com.krt.newssak.dto.hardcode.HardCodeRequestInfoDto; +import com.krt.newssak.entity.hardcode.HardCodeEntity; +import com.krt.newssak.entity.hardcode.HardCodeHistoryEntity; +import com.krt.newssak.repository.hardcode.HardCodeHistoryRepository; +import com.krt.newssak.repository.hardcode.HardCodeRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.stream.Collectors; + +@Service +@Transactional +@RequiredArgsConstructor +public class HardCodeService { + + private final HardCodeRepository hardCodeRepository; + private final HardCodeHistoryRepository hardCodeHistoryRepository; + + public void saveHardCode(HardCodeDto hardCodeDto) throws Exception { + //히스토리 저장 + HardCodeHistoryDto hardCodeHistoryDto = new HardCodeHistoryDto().toHardCodeDto(hardCodeDto); + hardCodeHistoryRepository.save(hardCodeHistoryDto.toEntity(hardCodeHistoryDto)); + + //하드코딩 저장 + hardCodeRepository.save(hardCodeDto.toEntity(hardCodeDto)); + } + + public HardCodeAndHistoryDto getHardCode(HardCodeRequestInfoDto hardCodeRequestInfoDto) { + HardCodeAndHistoryDto hardCodeAndHistoryDto = new HardCodeAndHistoryDto(); + + //하드코딩 정보 + HardCodeEntity hardCodeEntity = hardCodeRepository.findByProjectCodeAndQuestionUniqueKeyAndHardCodeTypeOrderByRegDateDesc( + hardCodeRequestInfoDto.getProjectCode(), + hardCodeRequestInfoDto.getQuestionUniqueKey(), + hardCodeRequestInfoDto.getType() + ); + + if(hardCodeEntity != null) + hardCodeAndHistoryDto.setHardCodeDto(hardCodeEntity.of(hardCodeEntity)); + + //히스토리 정보 + List hardCodeHistoryEntityList = hardCodeHistoryRepository.findByProjectCodeAndQuestionUniqueKeyAndHardCodeTypeOrderByRegDateDesc( + hardCodeRequestInfoDto.getProjectCode(), + hardCodeRequestInfoDto.getQuestionUniqueKey(), + hardCodeRequestInfoDto.getType() + ); + + if(hardCodeHistoryEntityList.size() > 0) { + hardCodeAndHistoryDto.setHardCodeHistoryDtoList(hardCodeHistoryEntityList.stream() + .map(HardCodeHistoryEntity::of) + .collect(Collectors.toList()) + ); + } + + return hardCodeAndHistoryDto; + } +} diff --git a/src/main/java/com/krt/newssak/service/IpAccessControlService.java b/src/main/java/com/krt/newssak/service/IpAccessControlService.java new file mode 100644 index 0000000..47ac8f1 --- /dev/null +++ b/src/main/java/com/krt/newssak/service/IpAccessControlService.java @@ -0,0 +1,22 @@ +package com.krt.newssak.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.security.web.util.matcher.IpAddressMatcher; +import org.springframework.stereotype.Service; + +import java.util.List; + +@RequiredArgsConstructor +@Service +public class IpAccessControlService { + public boolean isAccessible(String ipAddress) { + List ipAddressMatchers = List.of( + new IpAddressMatcher("::1/24"), + new IpAddressMatcher("1.235.195.0/24"), + new IpAddressMatcher("211.254.145.128/25"), + new IpAddressMatcher("175.45.203.213/32") + ); + //System.out.println(ipAddress); + return ipAddressMatchers.stream().anyMatch(matcher -> matcher.matches(ipAddress)); + } +} diff --git a/src/main/java/com/krt/newssak/service/KiwiService.java b/src/main/java/com/krt/newssak/service/KiwiService.java new file mode 100644 index 0000000..94c6e9b --- /dev/null +++ b/src/main/java/com/krt/newssak/service/KiwiService.java @@ -0,0 +1,63 @@ +package com.krt.newssak.service; + +import com.krt.newssak.dto.kiwi.request.AllProjectCodeList; +import com.krt.newssak.dto.kiwi.request.DelSurveyDataInfo; +import com.krt.newssak.dto.kiwi.response.AllSurveyNotInKiwi; +import com.krt.newssak.dto.kiwi.response.GetResponseProjectInfo; +import com.krt.newssak.dto.kiwi.response.exampleListByKpKey; +import com.krt.newssak.entity.survey.SurveyDataEntity; +import com.krt.newssak.entity.survey.SurveyRespondentEntity; +import com.krt.newssak.repository.kiwi.KiwiQueryRepository; +import com.krt.newssak.repository.survey.SurveyDataRepository; +import com.krt.newssak.repository.survey.SurveyRespondentRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +@Transactional +@RequiredArgsConstructor +public class KiwiService { + + private final KiwiQueryRepository kiwiQueryRepository; + private final SurveyDataRepository surveyDataRepository; + private final SurveyRespondentRepository surveyRespondentRepository; + + public List getAllProjectList(AllProjectCodeList allProjectCodeList) { + return kiwiQueryRepository.getAllProjectList(allProjectCodeList); + } + + public GetResponseProjectInfo getProjectInfo(String pkey) { + return kiwiQueryRepository.getProjectInfo(pkey); + } + + public List getAllQuestionList(String pkey) { + return kiwiQueryRepository.getAllQuestionList(pkey); + } + + public String getSurveyAnswerAvgTime(String pkey) { + return kiwiQueryRepository.getSurveyAnswerAvgTime(pkey); + } + + public boolean delSurveyData(DelSurveyDataInfo delSurveyDataInfo) { + + SurveyDataEntity surveyDataEntity = surveyDataRepository.findFirstByProjectCodeAndAnswerIDAndQuestionUniqueKeyAndAnswerDataContains(delSurveyDataInfo.getPkey(), delSurveyDataInfo.getSid(), 1, delSurveyDataInfo.getToken()); + + if(surveyDataEntity != null){ + + SurveyRespondentEntity surveyRespondentEntity = surveyRespondentRepository.findFirstByProjectCodeAndAnswerId(delSurveyDataInfo.getPkey(), delSurveyDataInfo.getSid()); + + surveyRespondentEntity.setAnswerState(999); + surveyRespondentRepository.save(surveyRespondentEntity); + + kiwiQueryRepository.delSurveyData(delSurveyDataInfo); + }else{ + //exception + return false; + } + + return true; + } +} diff --git a/src/main/java/com/krt/newssak/service/ListService.java b/src/main/java/com/krt/newssak/service/ListService.java new file mode 100644 index 0000000..839179f --- /dev/null +++ b/src/main/java/com/krt/newssak/service/ListService.java @@ -0,0 +1,172 @@ +package com.krt.newssak.service; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.newssak.dto.list.*; +import com.krt.newssak.entity.list.ListContentEntity; +import com.krt.newssak.entity.list.ListHeaderEntity; +import com.krt.newssak.repository.list.ListContentRepository; +import com.krt.newssak.repository.list.ListHeaderRepository; +import jakarta.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import org.apache.poi.hssf.usermodel.HSSFDataFormat; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.OutputStream; +import java.lang.reflect.Type; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.stream.Collectors; + +@Service +@Transactional +@RequiredArgsConstructor +public class ListService { + + private final ListHeaderRepository listHeaderRepository; + private final ListContentRepository listContentRepository; + + + public void saveListHeader(ListHeaderSaveRequestDto listHeaderSaveRequestDto) { + ListHeaderEntity listHeaderEntity = listHeaderRepository.findFirstByProjectCodeOrderByOrderNoDesc(listHeaderSaveRequestDto.getProjectCode()); + + if(listHeaderEntity == null){ + listHeaderSaveRequestDto.setOrderNo(1); + }else{ + if(listHeaderSaveRequestDto.getOrderNo() < 1){ + listHeaderSaveRequestDto.setOrderNo(listHeaderEntity.getOrderNo() + 1); + } + } + + ListHeaderEntity saveListHeaderEntity = ListHeaderSaveRequestDto.toEntity(listHeaderSaveRequestDto); + + listHeaderRepository.save(saveListHeaderEntity); + } + + public void defaultListHeaderInsert(String projectCode, int regMember){ + ListHeaderEntity defaultListHeaderEntity = ListHeaderEntity.builder() + .projectCode(projectCode) + .orderNo(1) + .name("ID") + .type("1") + .build(); + + listHeaderRepository.save(defaultListHeaderEntity); + } + + public List getListHeader(ListHeaderGetRequestDto listHeaderGetRequestDto) { + List headerResponseDtoList = new ArrayList<>(); + List headerList = listHeaderRepository.findAllByProjectCodeOrderByOrderNo(listHeaderGetRequestDto.getProjectCode()); + + if(headerList.size() > 0){ + headerResponseDtoList = headerList.stream().map(ListHeaderResponseDto::of).collect(Collectors.toList()); + } + + return headerResponseDtoList; + } + + public void deleteHeader(ListHeaderDeleteRequestDto listHeaderDeleteRequestDto) { + listHeaderRepository.deleteAllById(listHeaderDeleteRequestDto.getDeleteIdxList()); + } + + public void saveListContents(ListContentSaveRequestDto listContentSaveRequestDto) { + // 1:등록, 2:교체 + if(listContentSaveRequestDto.getAddUpdateCount() == 2 && listContentSaveRequestDto.getListContent().size() > 0){ + listContentRepository.deleteAllByProjectCode(listContentSaveRequestDto.getListContent().get(0).getProjectCode()); + } + + List listContentEntityList = listContentSaveRequestDto.getListContent().stream().map(ListContentDetailSaveRequestDto::toEntity).collect(Collectors.toList()); + + listContentRepository.saveAll(listContentEntityList); + } + + public List getListContents(ListContentGetRequestDto listContentGetRequestDto) { + List listContentGetResponseDtoList = new ArrayList<>(); + List listContentEntityList = listContentRepository.findAllByProjectCode(listContentGetRequestDto.getProjectCode()); + + if(listContentEntityList.size() > 0){ + listContentGetResponseDtoList = listContentEntityList.stream().map(ListContentGetResponseDto::of).collect(Collectors.toList()); + } + + return listContentGetResponseDtoList; + } + + public void modifyListContents(ListContentModifyRequestDto listContentModifyRequestDto) { + ListContentEntity listContentEntity = listContentRepository.findByIdx(listContentModifyRequestDto.getIdx()); + + Gson gson = new Gson(); + listContentEntity.listContentUpdate(gson.toJson(listContentModifyRequestDto.getListContent())); + + listContentRepository.save(listContentEntity); + } + + public void deleteListContents(ListContentDeleteRequestDto listContentDeleteRequestDto) { + listContentRepository.deleteAllById(listContentDeleteRequestDto.getIdx()); + } + + public void downloadList(HttpServletResponse response, ListDownloadGetRequestDto listDownloadGetRequestDto) { + List listHeaderEntityList = listHeaderRepository.findAllByProjectCodeOrderByOrderNo(listDownloadGetRequestDto.getProjectCode()); + List listContentEntityList = listContentRepository.findAllByProjectCode(listDownloadGetRequestDto.getProjectCode()); + + try { + + Workbook workbook = new XSSFWorkbook(); + Sheet sheet = workbook.createSheet("리스트정보"); + + //숫자 포맷은 아래 numberCellStyle을 적용시킬 것이다다 + CellStyle numberCellStyle = workbook.createCellStyle(); + numberCellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0")); + + //파일명 + final String fileName = listHeaderEntityList.get(0).getProjectCode() + "_리스트"; + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, StandardCharsets.UTF_8) + ".xlsx"); + + //헤더 + Row row = sheet.createRow(0); + + for (int i = 0; i < listHeaderEntityList.size(); i++) { + Cell cell = row.createCell(i); + cell.setCellValue(listHeaderEntityList.get(i).getName()); + } + + //바디 + Gson gson = new Gson(); + Type listContentType = new TypeToken>>(){}.getType(); + + for (int i = 0; i < listContentEntityList.size(); i++) { + row = sheet.createRow(i + 1); //헤더 이후로 데이터가 출력되어야하니 +1 + + List> listInfo = gson.fromJson(listContentEntityList.get(i).getListInfo(), listContentType); + + for (int j = 0; j < listInfo.size(); j++) { + int cellIndex = 0; + + for(Object value : listInfo.get(j).values()){ + Cell cell = row.createCell(cellIndex++); + + if(value.getClass() == Double.class){ + cell.setCellValue(((Double) value).intValue()); + }else{ + cell.setCellValue(String.valueOf(value)); + } + } + } + } + + OutputStream fileOut = response.getOutputStream(); + workbook.write(fileOut); + fileOut.close(); + + }catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/krt/newssak/service/MemberService.java b/src/main/java/com/krt/newssak/service/MemberService.java new file mode 100644 index 0000000..8e782ad --- /dev/null +++ b/src/main/java/com/krt/newssak/service/MemberService.java @@ -0,0 +1,67 @@ +package com.krt.newssak.service; + +import com.krt.newssak.dto.common.TokenInfo; +import com.krt.newssak.dto.member.MemberDto; +import com.krt.newssak.dto.member.MemberTeamInfoDto; +import com.krt.newssak.exception.ApiException; +import com.krt.newssak.exception.ExceptionEnum; +import com.krt.newssak.jwt.JwtTokenProvider; +import com.krt.newssak.repository.member.MemberRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Service; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.stream.Collectors; + +@Service +@RequiredArgsConstructor +public class MemberService { + + private final MemberRepository memberRepository; + private final AuthenticationManagerBuilder authenticationManagerBuilder; + private final JwtTokenProvider jwtTokenProvider; + + public TokenInfo login(String id, String password) { + // 1. Login ID/PW 를 기반으로 Authentication 객체 생성 + // 이때 authentication 는 인증 여부를 확인하는 authenticated 값이 false + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(id, password); + + // 2. 실제 검증 (사용자 비밀번호 체크)이 이루어지는 부분 + // authenticate 매서드가 실행될 때 CustomUserDetailsService 에서 만든 loadUserByUsername 메서드가 실행 + Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); + + // 3. 인증 정보를 기반으로 JWT 토큰 생성 + TokenInfo tokenInfo = jwtTokenProvider.generateToken(authentication); + + return tokenInfo; + } + + public MemberDto getInfo(String id) { + MemberDto member = memberRepository.findById(id) + .map(MemberDto::of) + .orElseThrow(() -> new ApiException(ExceptionEnum.USER_NOT_FOUND)); + + if(member.getTeamInfo().getCode() == 108){ + member.setIs_admin(1); + }else{ + member.setIs_admin(0); + } + return member; + } + + public MemberDto getInfoWithDetails(LinkedHashMap details){ + MemberDto member = MemberDto.of(details); + + return member; + } + + public List getAllList(){ + List memberList = memberRepository.findAll().stream().map(MemberDto::of).collect(Collectors.toList()); + + return memberList; + } +} diff --git a/src/main/java/com/krt/newssak/service/ProjectService.java b/src/main/java/com/krt/newssak/service/ProjectService.java new file mode 100644 index 0000000..62c9ada --- /dev/null +++ b/src/main/java/com/krt/newssak/service/ProjectService.java @@ -0,0 +1,334 @@ +package com.krt.newssak.service; + +import com.krt.newssak.dto.project.*; +import com.krt.newssak.entity.member.MemberProjectManagerEntity; +import com.krt.newssak.entity.project.*; +import com.krt.newssak.enums.DefaultParameterEnum; +import com.krt.newssak.enums.DefaultRedirectEnum; +import com.krt.newssak.enums.DefaultResponseEnum; +import com.krt.newssak.enums.DefaultStyleOptionEnum; +import com.krt.newssak.exception.ApiException; +import com.krt.newssak.exception.ExceptionEnum; +import com.krt.newssak.repository.member.MemberProjectManagerRepository; +import com.krt.newssak.repository.project.*; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + + +@Service +@Transactional +@RequiredArgsConstructor +public class ProjectService { + + private final ProjectRepository projectRepository; + private final ProjectHashTagRepository projectHashTagRepository; + private final ProjectQueryRepository projectQueryRepository; + private final ProjectParameterRepository projectParameterRepository; + private final ProjectRedirectRepository projectRedirectRepository; + private final ProjectStyleRepository projectStyleRepository; + private final ProjectResponseRepository projectResponseRepository; + private final MemberProjectManagerRepository memberProjectManagerRepository; + private final QuestionService questionService; + private final ListService listService; + + @Transactional(readOnly = true) + public Page getProjectList(ProjectSearchDto projectSearchDto, Pageable pageable) { + return projectQueryRepository.findBySearchDto(projectSearchDto, pageable); + } + + @Transactional(readOnly = true) + public int checkDuplicateProjectCode(String projectCode){ + //////반환값 코드로 변경 0:생성가능 , 1: 프로젝트 코드 중복 9:삭제된 프로젝트 코드 + if(projectRepository.findByCodeAndIsDelete(projectCode,0).stream().count() > 0) { + return 1; + } + if(projectRepository.findByCodeAndIsDelete(projectCode,1).stream().count() > 0) { + return 9; + } + return 0; + } + + @Transactional(readOnly = true) + public List getProjectParameter(String projectCode){ + return projectParameterRepository.findByProjectCode(projectCode) + .stream() + .map(ProjectParameterDto::of) + .collect(Collectors.toList()); + } + + @Transactional(readOnly = true) + public List getProjectRedirect(String project_code){ + return projectRedirectRepository.findByProjectCode(project_code) + .stream() + .map(ProjectRedirectDto::of) + .collect(Collectors.toList()); + } + + @Transactional(readOnly = true) + public ProjectOptionDto getProjectResponse(String project_code){ + List optionElementDto = projectResponseRepository.findByProjectCode(project_code) + .stream() + .map(OptionElementDto::of) + .collect(Collectors.toList()); + + return ProjectOptionDto.builder() + .project_code(project_code) + .optionList(optionElementDto) + .build(); + } + + @Transactional(readOnly = true) + public ProjectOptionDto getProjectStyle(String project_code){ + List optionElementDto = projectStyleRepository.findByProjectCodeOrderByStyleCode(project_code) + .stream() + .map(OptionElementDto::of) + .collect(Collectors.toList()); + + return ProjectOptionDto.builder() + .project_code(project_code) + .optionList(optionElementDto) + .build(); + } + + public long upsertProject(ProjectUpsertDto projectUpsertDto){ + long upsertCount = 0; + String projectCode = projectUpsertDto.getProject_code(); + int regMember = projectUpsertDto.getReg_member(); + + //프로젝트 매니저 (전체 삭제 후 추가) + projectQueryRepository.deleteManager(projectCode); + + for(ProjectManagerDto pm : projectUpsertDto.getPm_list()){ //batch insert 적용 필요 + MemberProjectManagerEntity projectManagerEntity = MemberProjectManagerEntity.builder() + .project_code(projectCode) + .member_code(pm.getMember_code()) + .role_code(pm.getRole_code()) + .build(); + + memberProjectManagerRepository.save(projectManagerEntity); + } + + //해시태그 (전체 삭제 후 추가) + projectQueryRepository.deleteHashTag(projectCode); + + for(String tag : projectUpsertDto.getHashtag_list()){ //batch insert 적용 필요 + ProjectHashtagEntity projectHashtagEntity = ProjectHashtagEntity.builder() + .projectCode(projectCode) + .hashtag(tag) + .regMember(regMember) + .build(); + + projectHashTagRepository.save(projectHashtagEntity); + } + + //프로젝트 있을 시, 업데이트 + if(projectUpsertDto.getIs_update() == 1){ + insertDefaultStyle(projectCode, projectUpsertDto.getProject_company(), 1); + + return projectQueryRepository.updateProjectInfo(projectUpsertDto); + } + + if(projectRepository.findByCodeAndIsDelete(projectCode,0).stream().count() == 0){ + //프로젝트 없을 시, 추가 + ProjectEntity projectEntity = ProjectEntity.of(projectUpsertDto); + + projectRepository.save(projectEntity); + + //////프로젝트 생성 시 필요한 기본 정보들 생성 시작 + insertDefaultParameter(projectCode, regMember); + + insertDefaultRedirect(projectCode, regMember); + + insertDefaultResponse(projectCode); + + insertDefaultStyle(projectCode, projectUpsertDto.getProject_company(), 0); + + questionService.insertDefaultQuestion(projectCode, regMember); + + listService.defaultListHeaderInsert(projectUpsertDto.getProject_code(), projectUpsertDto.getReg_member()); + //////프로젝트 생성 시 필요한 기본 정보들 생성 끝 + upsertCount = 1; + } + + return upsertCount; + } + + public boolean insertProjectParameter(ProjectParameterDto projectParameterDto){ + ProjectParameterEntity projectParameterEntity = ProjectParameterEntity.of(projectParameterDto); + projectParameterRepository.save(projectParameterEntity); + + return true; + } + + public long deleteProjectParameter(ProjectParameterDeleteDto projectParameterDeleteDto){ + + return projectQueryRepository.deleteParameter(projectParameterDeleteDto.getProject_code(), projectParameterDeleteDto.getParameter_name()); + } + + public boolean upsertProjectRedirect(ProjectRedirectDto projectRedirectDto){ + ProjectRedirectEntity projectRedirectEntity = ProjectRedirectEntity.of(projectRedirectDto); + projectRedirectRepository.save(projectRedirectEntity); + + return true; + } + + public boolean upsertProjectResponse(ProjectOptionDto projectOptionDto){ + List projectResponseList = new ArrayList<>(); + for(OptionElementDto optionElementDto : projectOptionDto.getOptionList()){ + projectResponseList.add(ProjectResponseEntity.of(projectOptionDto.getProject_code(), optionElementDto)); + } + projectResponseRepository.saveAll(projectResponseList); + + return true; + } + + public boolean upsertProjectStyle(ProjectOptionDto projectOptionDto){ + List projectStyleList = new ArrayList<>(); + for(OptionElementDto optionElementDto : projectOptionDto.getOptionList()){ + projectStyleList.add(ProjectStyleEntity.of(projectOptionDto.getProject_code(), optionElementDto)); + } + projectStyleRepository.saveAll(projectStyleList); + return true; + } + public long deleteProjectRedirect(ProjectRedirectDeleteDto projectRedirectDeleteDto){ + + return projectQueryRepository.deleteRedirect(projectRedirectDeleteDto.getProject_code(), projectRedirectDeleteDto.getPanel_code()); + } + + public void insertDefaultParameter(String projectCode, int regMember){ + List projectParameterEntityList = new ArrayList<>(); + for(DefaultParameterEnum dp: DefaultParameterEnum.values()){ //batch insert 적용 필요 + projectParameterEntityList.add( + ProjectParameterEntity.builder() + .projectCode(projectCode) + .parameterName(dp.getParameterName()) + .isDefault(1) + .regMember(regMember) + .build() + ); + } + projectParameterRepository.saveAll(projectParameterEntityList); + } + + public void insertDefaultRedirect(String projectCode, int regMember){ + //디폴트 Redirect는 KRI에서만 사용하며 새싹을 타사에 판매할 시 해당 회사에 맞는 커스터마이징 혹은 삭제 필요 + List projectRedirectEntityList = new ArrayList<>(); + for(DefaultRedirectEnum dr : DefaultRedirectEnum.values()){ + projectRedirectEntityList.add(ProjectRedirectEntity.of(projectCode, regMember, dr)); + } + projectRedirectRepository.saveAll(projectRedirectEntityList); + } + + public void insertDefaultStyle(String projectCode, int companyCode, int updateCount){ + List projectStyleList = new ArrayList<>(); + for(DefaultStyleOptionEnum dso : DefaultStyleOptionEnum.values()){ + String[] styleValueArray = dso.getValues(); + String styleValue = styleValueArray[0]; + + if(styleValueArray.length > 1){ + styleValue = styleValueArray[companyCode-1]; + } + + if(updateCount == 1){ + if(Arrays.asList(101,104).contains(dso.getCode())){ + projectStyleList.add( + ProjectStyleEntity.builder() + .projectCode(projectCode) + .styleCode((short) dso.getCode()) + .styleValue(styleValue) + .build() + ); + } + }else{ + projectStyleList.add( + ProjectStyleEntity.builder() + .projectCode(projectCode) + .styleCode((short) dso.getCode()) + .styleValue(styleValue) + .build() + ); + } + } + projectStyleRepository.saveAll(projectStyleList); + } + + public void insertDefaultResponse(String projectCode){ + List projectResponseList = new ArrayList<>(); + for(DefaultResponseEnum ro : DefaultResponseEnum.values()) { + projectResponseList.add( + ProjectResponseEntity.builder() + .projectCode(projectCode) + .optionCode(ro.getCode()) + .optionValue(String.valueOf(ro.getStatus())) + .build() + ); + } + projectResponseRepository.saveAll(projectResponseList); + } + + public long deleteProject(String projectCode){ + return projectQueryRepository.updateIsDelete(projectCode); + } + + public long updateProjectState(ProjectStateDto projectStateDto){ + return projectQueryRepository.updateProjectState(projectStateDto.getProject_code(), projectStateDto.getProject_state()); + } + + public ProjectInfoDto getProjectInfo(String project_code) { + ProjectInfoDto projectInfoDto = projectRepository.findByCodeAndIsDelete(project_code, 0) + .map(ProjectInfoDto::of) + .orElseThrow(() -> new ApiException(ExceptionEnum.USER_NOT_FOUND)); + + projectInfoDto = projectQueryRepository.getProjectInfo(projectInfoDto, project_code); + + + return projectInfoDto; + } + + public ProjectByStatusByCountDto getStatusByCount(String project_code) { + return projectQueryRepository.getProjectByStatusByCount(project_code); + } + + public void copyProject(ProjectCopyRequestDto projectCopyRequestDto) throws Exception { + + Optional projectEntity = projectRepository.findByCodeAndIsDelete(projectCopyRequestDto.getCopyProjectCode(), 0); + + if(projectEntity.isPresent()){ + //프로젝트 + projectQueryRepository.projectCopy(projectCopyRequestDto); + //프로젝트 파일 + projectQueryRepository.projectFileCopy(projectCopyRequestDto); + //프로젝트 해시태그 + projectQueryRepository.projectHashTagCopy(projectCopyRequestDto); + //프로젝트 리다이렉트 + projectQueryRepository.projectRedirectCopy(projectCopyRequestDto); + //프로젝트 파라미터 + projectQueryRepository.projectParameterCopy(projectCopyRequestDto); + //프로젝트 응답옵션 + projectQueryRepository.projectResponseCopy(projectCopyRequestDto); + //프로젝트 스타일 + projectQueryRepository.projectStyleCopy(projectCopyRequestDto); + //문항, 보기, 옵션 + projectQueryRepository.projectQuestionCopy(projectCopyRequestDto); + //문항블록, 문항 블록 옵션 + projectQueryRepository.projectQuestionBlockCopy(projectCopyRequestDto); + //하드코드 + projectQueryRepository.projectHardCodeCopy(projectCopyRequestDto); + //쿼터 + projectQueryRepository.projectQuotaCopy(projectCopyRequestDto); + }else{ + throw new NullPointerException(); + } + + + } +} diff --git a/src/main/java/com/krt/newssak/service/QuestionService.java b/src/main/java/com/krt/newssak/service/QuestionService.java new file mode 100644 index 0000000..7705464 --- /dev/null +++ b/src/main/java/com/krt/newssak/service/QuestionService.java @@ -0,0 +1,550 @@ +package com.krt.newssak.service; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.krt.newssak.dto.autorecode.GetAutoRecodeRequestDto; +import com.krt.newssak.dto.autorecode.GetAutoRecodeResponseDto; +import com.krt.newssak.dto.autorecode.SaveAutoRecodeRequestDto; +import com.krt.newssak.dto.question.*; +import com.krt.newssak.entity.autorecode.AutoRecodeEntity; +import com.krt.newssak.entity.question.*; +import com.krt.newssak.enums.DefaultQuestionEnum; +import com.krt.newssak.repository.autorecode.AutoRecodeRepository; +import com.krt.newssak.repository.question.*; +import com.krt.newssak.util.RegexLabel; +import com.krt.newssak.util.RegexLogic; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import jakarta.persistence.Query; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.function.Consumer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +@Service +@Transactional +@RequiredArgsConstructor +public class QuestionService { + + @PersistenceContext + private EntityManager entityManager ; + + private final QuestionQueryRepository questionQueryRepository; + private final QuestionRepository questionRepository; + private final QuestionLabelRepository questionLabelRepository; + private final QuestionOptionRepository questionOptionRepository; + private final QuestionLogicRepository questionLogicRepository; + private final AutoRecodeRepository autoRecodeRepository; + private final QuestionBlockRepository questionBlockRepository; + private final QuestionBlockCollectionRepository questionBlockCollectionRepository; + private final QuestionBlockOptionRepository questionBlockOptionRepository; + + private final RegexLabel regexLabel; + + @Transactional(readOnly = true) + public boolean getDuplicateQuestionID(String projectCode, int questionUniqueKey, String questionID){ + return questionRepository.findByProjectCodeAndQuestionUniqueKeyNotAndQuestionIDAndIsDelete(projectCode,questionUniqueKey, questionID,0).stream().count() > 0; + } + + public int upsertQuestion(QuestionUpsertDto questionUpsertDto){ + + if(!questionUpsertDto.getQuestion_id().equals("INDEX") && (questionUpsertDto.getQuestion_order() == 0 || questionUpsertDto.getQuestion_order() == 9999)){ + questionUpsertDto.setQuestion_order(getMaxQuestionOrder(questionUpsertDto.getProject_code())); + } + + QuestionEntity questionEntity = QuestionEntity.toEntity(questionUpsertDto); + + if(questionUpsertDto.getIs_update() == 0){ + if(getDuplicateQuestionID(questionUpsertDto.getProject_code(),questionUpsertDto.getQuestion_unique_key(), questionUpsertDto.getQuestion_id())) return 999; + //insert인 경우 UniqueKey Max값 가져오기 + int questionUniqueKey = getMaxQuestionUniqueKey(questionUpsertDto.getProject_code()); + + questionEntity.setQuestionUniqueKey(questionUniqueKey); + questionUpsertDto.setQuestion_unique_key(questionUniqueKey); + + if(questionUpsertDto.getQuestion_order() > 0){ + questionQueryRepository.increaseQuestionOrder(questionUpsertDto.getProject_code(), questionUpsertDto.getQuestion_order()); + } + } + + questionRepository.save(questionEntity); + + //question label 3종 + Gson gson = new Gson(); + if(questionUpsertDto.getScalar_label() != null){ + questionUpsertDto.getScalar_label().getLabel_option().setAccept_question(getQuestionUniqueKeyWithQuestionId(questionUpsertDto.getProject_code(), questionUpsertDto.getScalar_label().getLabel_option().getAccept_question())); + questionUpsertDto.getScalar_label().getLabel_option().setExcept_question(getQuestionUniqueKeyWithQuestionId(questionUpsertDto.getProject_code(), questionUpsertDto.getScalar_label().getLabel_option().getExcept_question())); + + QuestionLabelEntity scalarLabelEntity = QuestionLabelEntity.of( + questionUpsertDto.getProject_code(), + questionUpsertDto.getQuestion_unique_key(), + 1, + gson.toJson(questionUpsertDto.getScalar_label().getLabel_info()), + gson.toJson(questionUpsertDto.getScalar_label().getLabel_option()) + ); + questionLabelRepository.save(scalarLabelEntity); + } + + if(questionUpsertDto.getMatrix_label() != null){ + questionUpsertDto.getMatrix_label().getLabel_option().setAccept_question(getQuestionUniqueKeyWithQuestionId(questionUpsertDto.getProject_code(), questionUpsertDto.getMatrix_label().getLabel_option().getAccept_question())); + questionUpsertDto.getMatrix_label().getLabel_option().setExcept_question(getQuestionUniqueKeyWithQuestionId(questionUpsertDto.getProject_code(), questionUpsertDto.getMatrix_label().getLabel_option().getExcept_question())); + + QuestionLabelEntity matrixLabelEntity = QuestionLabelEntity.of( + questionUpsertDto.getProject_code(), + questionUpsertDto.getQuestion_unique_key(), + 2, + gson.toJson(questionUpsertDto.getMatrix_label().getLabel_info()), + gson.toJson(questionUpsertDto.getMatrix_label().getLabel_option()) + ); + questionLabelRepository.save(matrixLabelEntity); + } + + if(questionUpsertDto.getTensor_label() != null){ + questionUpsertDto.getTensor_label().getLabel_option().setAccept_question(getQuestionUniqueKeyWithQuestionId(questionUpsertDto.getProject_code(), questionUpsertDto.getTensor_label().getLabel_option().getAccept_question())); + questionUpsertDto.getTensor_label().getLabel_option().setExcept_question(getQuestionUniqueKeyWithQuestionId(questionUpsertDto.getProject_code(), questionUpsertDto.getTensor_label().getLabel_option().getExcept_question())); + + QuestionLabelEntity tensorLabelEntity = QuestionLabelEntity.of( + questionUpsertDto.getProject_code(), + questionUpsertDto.getQuestion_unique_key(), + 3, + gson.toJson(questionUpsertDto.getTensor_label().getLabel_info()), + gson.toJson(questionUpsertDto.getTensor_label().getLabel_option()) + ); + questionLabelRepository.save(tensorLabelEntity); + } + + //question option + if(questionUpsertDto.getQuestion_option() != null && questionUpsertDto.getQuestion_option().size() > 0){ + QuestionOptionEntity questionOptionEntity = QuestionOptionEntity.of(questionUpsertDto); + + questionOptionRepository.save(questionOptionEntity); + } + + //question block option + if(questionUpsertDto.getQuestion_block_option() != null && questionUpsertDto.getQuestion_block_option().size() > 0){ + List blockOptionChangeList = new ArrayList<>(); + for(QuestionOptionValueJsonDto option : questionUpsertDto.getQuestion_block_option()){ + if(option.getOption_code().equals("10") && option.getType_code().equals("01") && option.getDetail_code().equals("03")){ + option.setValue(String.valueOf(questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(questionUpsertDto.getProject_code(), option.getValue(), 0).getQuestionUniqueKey())); + } + + blockOptionChangeList.add(option); + } + + questionUpsertDto.setQuestion_block_option(blockOptionChangeList); + + QuestionBlockOptionEntity questionBlockOptionEntity = QuestionBlockOptionEntity.of(questionUpsertDto); + + questionBlockOptionRepository.save(questionBlockOptionEntity); + } + + //question piping + regexLabel.questionIdToUniqueKeyLabelChange(questionUpsertDto); + + return questionEntity.getQuestionUniqueKey(); + } + + public long deleteQuestion(QuestionDeleteDto questionDeleteDto){ + + questionQueryRepository.deleteQuestionBlockCollection(questionDeleteDto); + + return questionQueryRepository.updateIsDelete(questionDeleteDto); + } + + public long copyQuestion(QuestionCopyDto questionCopyDto){ + int totalCopyCount = 0; + String projectCode = questionCopyDto.getProject_code(); + try { + for (int targetUniqueKey : questionCopyDto.getQuestion_unique_key()){ + QuestionEntity targetQuestion = questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, targetUniqueKey,0); + QuestionOptionEntity targetOption = questionOptionRepository.findByProjectCodeAndQuestionUniqueKey(projectCode, targetUniqueKey); + List targetLabelList = questionLabelRepository.findAllByProjectCodeAndQuestionUniqueKey(projectCode, targetUniqueKey); + List targetRecodeList = autoRecodeRepository.findAllByProjectCodeAndQuestionUniqueKey(projectCode, targetUniqueKey); + + String originalQID = ""; + if(targetQuestion != null){ + originalQID = targetQuestion.getQuestionID(); + } + + for (int i = 0; i < questionCopyDto.getCopy_set_count(); i++){ + int newUniqueKey = getMaxQuestionUniqueKey(projectCode); + int maxOrder = getMaxQuestionOrder(projectCode); + + if(targetQuestion != null){ + int copyCode = i+1; + while(questionRepository.existsByProjectCodeAndQuestionIDAndIsDelete(projectCode, originalQID + "_" + copyCode, 0)){ + copyCode++; + } + + String newQID = originalQID + "_" + copyCode; + Consumer setUniqueKeyAndOrder = entity -> { + entity.setQuestionUniqueKey(newUniqueKey); + entity.setQuestionID(newQID); + entity.setQuestionOrder(maxOrder); + }; + copyModifyAndSave(targetQuestion,setUniqueKeyAndOrder); + } + + if(targetOption != null){ + Consumer setUniqueKey = entity -> { + entity.setQuestionUniqueKey(newUniqueKey); + }; + copyModifyAndSave(targetOption,setUniqueKey); + } + + for (QuestionLabelEntity targetLabel : targetLabelList){ + if(targetLabel != null){ + Consumer setUniqueKey = entity -> { + entity.setQuestionUniqueKey(newUniqueKey); + }; + copyModifyAndSave(targetLabel,setUniqueKey); + } + } + + for (AutoRecodeEntity targetRecode : targetRecodeList){ + if(targetRecode != null){ + Consumer setUniqueKey = entity -> { + entity.setQuestionUniqueKey(newUniqueKey); + }; + copyModifyAndSave(targetRecode,setUniqueKey); + } + } + + totalCopyCount ++; + } + } + } + catch (Exception ex){ + System.out.println(ex.getMessage()); + } + return totalCopyCount; + } + + public boolean reorderQuestion(QuestionReorderDto questionReorderDto){ + try { + List questionEntityList = questionRepository.findAllByProjectCodeAndIsDelete(questionReorderDto.getProject_code(), 0); + List questionOrderDtoList = questionReorderDto.getQuestion_order_list(); + + for(QuestionEntity questionEntity : questionEntityList){ + List matchOrderList = questionOrderDtoList.stream() + .filter(x -> x.getQuestion_unique_key() == questionEntity.getQuestionUniqueKey()) + .toList(); + + if(!matchOrderList.isEmpty()){ + questionEntity.setQuestionOrder(matchOrderList.get(0).getQuestion_order()); + } + } + + questionRepository.saveAll(questionEntityList); + return true; + } + catch (Exception ex){ + return false; + } + } + + @Transactional + public T copyModifyAndSave(T originalEntity, Consumer modifyFunction) throws Exception { + // 엔티티 분리 + entityManager.detach(originalEntity); + + // 수정 함수 적용 + modifyFunction.accept(originalEntity); + + // 새 엔티티 저장 + entityManager.persist(originalEntity); + return originalEntity; + } + + public long upsertQuestionLogic(QuestionLogicDto questionLogicDto){ + + long upsertCount = 0; + String beforeLogic = "[]"; + String afterLogic = "[]"; + Gson gson = new GsonBuilder().disableHtmlEscaping().create(); + + if(!questionLogicDto.getBefore_logic().stream().toList().isEmpty()){ + List modifyBeforeLogic = modifyQuestionId(questionLogicDto.getProject_code(), questionLogicDto.getBefore_logic()); + beforeLogic = gson.toJson(modifyBeforeLogic); + } + if(!questionLogicDto.getAfter_logic().stream().toList().isEmpty()){ + List modifyAfterLogic = modifyQuestionId(questionLogicDto.getProject_code(), questionLogicDto.getAfter_logic()); + afterLogic = gson.toJson(modifyAfterLogic); + } + + QuestionLogicEntity questionLogicEntity = QuestionLogicEntity.of( + questionLogicDto.getProject_code(), + questionLogicDto.getQuestion_unique_key(), + beforeLogic, + afterLogic, + questionLogicDto.getReg_member() + ); + + questionLogicRepository.save(questionLogicEntity); + upsertCount = 1; + + return upsertCount; + } + + @Transactional(readOnly = true) + public QuestionLogicDto getQuestionLogic(String projectCode, int questionUniqueKey){ + + Gson gson = new Gson(); + + try { + QuestionLogicEntity questionLogicEntity = questionLogicRepository.findByProjectCodeAndQuestionUniqueKey(projectCode,questionUniqueKey); + List beforeLogic = new ArrayList<>(); + List afterLogic = new ArrayList<>(); + + if(!Objects.equals(questionLogicEntity.getBeforeLogic(), "[]") && !questionLogicEntity.getBeforeLogic().isEmpty()) { + beforeLogic = gson.fromJson(questionLogicEntity.getBeforeLogic(), new TypeToken>(){}.getType()); + beforeLogic = recoverQuestionId(projectCode, beforeLogic); + } + if(!Objects.equals(questionLogicEntity.getAfterLogic(), "[]") && !questionLogicEntity.getAfterLogic().isEmpty()) { + afterLogic = gson.fromJson(questionLogicEntity.getAfterLogic(), new TypeToken>(){}.getType()); + afterLogic = recoverQuestionId(projectCode, afterLogic); + } + + return new QuestionLogicDto( + questionLogicEntity.getProjectCode(), + questionLogicEntity.getQuestionUniqueKey(), + beforeLogic, + afterLogic, + questionLogicEntity.getRegMember() + ); + } + catch (Exception ex){ + return new QuestionLogicDto(); + } + } + + public void insertDefaultQuestion(String projectCode, int regMember){ + + for(DefaultQuestionEnum dq : DefaultQuestionEnum.values()){ + QuestionUpsertDto questionUpsertDto = QuestionUpsertDto.builder() + .project_code(projectCode) + .question_id(dq.getQuestionId()) + .question_order(dq.getQuestionOrder()) + .question_title(dq.getQuestionTitle()) + .question_description(dq.getQuestionDescription()) + .question_name(dq.getQuestionId()) + .reg_member(regMember) + .build(); + + upsertQuestion(questionUpsertDto); + } + } + + @Transactional(readOnly = true) + public int getMaxQuestionOrder(String projectCode) { + return questionRepository.findFirstByProjectCodeOrderByQuestionOrderDesc(projectCode).getQuestionOrder()+1; + } + + @Transactional(readOnly = true) + public int getMaxQuestionUniqueKey(String projectCode) { + + QuestionEntity questionEntity = questionRepository.findFirstByProjectCodeOrderByQuestionUniqueKeyDesc(projectCode); + + if(questionEntity == null) + return 1; + else + return questionEntity.getQuestionUniqueKey() + 1; + } + + @Transactional(readOnly = true) + public String getQuestionUniqueKeyWithQuestionId(String projectCode, String questionId){ + + String questionUniqueKeyString = ""; + String matchQID = questionId.replaceAll("(\\[.*?\\])?(\\((.*?)\\))?(\\{(.*?)\\})?", ""); + + QuestionEntity questionEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(projectCode, matchQID,0); + if(questionEntity != null){ + questionUniqueKeyString = questionId.replaceFirst(matchQID, String.valueOf(questionEntity.getQuestionUniqueKey())); + } + return questionUniqueKeyString; + } + + @Transactional(readOnly = true) + public List modifyQuestionId(String projectCode, List logicList){ + + Pattern questionIdPattern = Pattern.compile(RegexLogic.questionIdRegex); + + for(QuestionLogicJsonDto logicDto : logicList){ + Matcher questionIdMatcher = questionIdPattern.matcher(logicDto.getLogic()); + StringBuilder modifyLogic = new StringBuilder(); + + //로직 변조 시작 + while (questionIdMatcher.find()) { + String replacement = questionIdMatcher.group(); + if(!replacement.equalsIgnoreCase("AND") && !replacement.equalsIgnoreCase("OR")){ + QuestionEntity getQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(projectCode, replacement.toUpperCase(), 0); + if(getQuestionEntity != null){ + replacement = "[UK:"+getQuestionEntity.getQuestionUniqueKey()+"]"; + } + } + questionIdMatcher.appendReplacement(modifyLogic, replacement); + } + questionIdMatcher.appendTail(modifyLogic); + logicDto.setLogic(modifyLogic.toString()); + //로직 변조 끝 + + /////page 변조 + QuestionEntity getQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(projectCode, logicDto.getPage(), 0); + if(getQuestionEntity != null){ + logicDto.setPage("[UK:"+getQuestionEntity.getQuestionUniqueKey()+"]"); + } + } + return logicList; + } + + @Transactional(readOnly = true) + public List recoverQuestionId(String projectCode, List logicList){ + + Pattern questionUniqueKeyPattern = Pattern.compile(RegexLogic.questionUniqueKeyRegex); + + for(QuestionLogicJsonDto logicDto : logicList){ + Matcher questionUniqueKeyMatcher = questionUniqueKeyPattern.matcher(logicDto.getLogic()); + StringBuilder recoverLogic = new StringBuilder(); + + //로직 복구 시작 + while (questionUniqueKeyMatcher.find()) { + String replacement = questionUniqueKeyMatcher.group(); + int questionUniqueKey = Integer.parseInt(replacement.replace("[UK:","").replace("]","")); + ///////////여기서 [uk:QuestionUK]들을 발라내어 QID로 변환 + QuestionEntity getQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, questionUniqueKey,0); + if(getQuestionEntity != null){ + replacement = getQuestionEntity.getQuestionID(); + } + questionUniqueKeyMatcher.appendReplacement(recoverLogic, replacement); + } + questionUniqueKeyMatcher.appendTail(recoverLogic); + logicDto.setLogic(recoverLogic.toString()); + //로직 복구 끝 + + //page 복구 + int questionUniqueKey = Integer.parseInt(logicDto.getPage().replace("[UK:","").replace("]","")); + QuestionEntity getQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, questionUniqueKey, 0); + if(getQuestionEntity != null){ + logicDto.setPage(getQuestionEntity.getQuestionID()); + } + } + + return logicList; + } + + @Transactional(readOnly = true) + public void logicVerify(String projectCode, String logicString) throws Exception{ + //todo 2023-12-05 박준성 기술부채 : =1=2=3=4 이런거 끝에 /나 ,로 끝나는 거 숫자만 있는 것 못잡음 + //todo 2023-12-06 박준성 기술부채 : sq5=sq6의 값처럼 문항의 값과 값을 비교 하는 쿼리 동작할 수 있게 수정 필요 + + //////////// 치명적인 문자열이 있는지 한번 검사 + String[] criticalStringArray = new String[]{"TRUNCATE","DELETE","UPDATE","DROP","INSERT"}; + for(String criticalString : criticalStringArray){ + if(logicString.toUpperCase().contains(criticalString)){ + throw new Exception("Logic has critical string!!"); + } + } + + ///////////네이티브 쿼리 이용/////////// + //////////매우 동적으로 Where문이 작성 되기 때문에 JPQL,QueryDSL 등으로 극복 불가능 + String useQid = RegexLogic.getUseQid(logicString); + //todo 2023-12-21 박준성 기술부채 : Tensor, Matrix에 AND 조건을 줄수 없음 + logicString = RegexLogic.makeSyntaxString(logicString); + + String logicQuery = ""; + logicQuery += " select ANS_ID " + System.lineSeparator(); + logicQuery += " from " + System.lineSeparator(); + logicQuery += " ( " + System.lineSeparator(); + logicQuery += " select 'LOGIC_VERIFY' as ANS_ID " + System.lineSeparator(); + logicQuery += " , JSON_OBJECTAGG(q.Q_ID, null) as ANS_DATA " + System.lineSeparator(); + logicQuery += " from question q " + System.lineSeparator(); + logicQuery += " where q.PRJ_CD ='" + projectCode + "' and q.Q_ID in (" + useQid + ")" + System.lineSeparator(); //조건에 들어가는 Q_ID들 + logicQuery += " ) a " + System.lineSeparator(); + logicQuery += " where 1=1 " + System.lineSeparator(); + + if(!logicString.isEmpty()) { + logicQuery += " and " + logicString; + } + + Query query = entityManager.createNativeQuery(logicQuery); + query.getResultList(); + + entityManager.clear(); + entityManager.close(); + } + + public int setBlockQuestion(QuestionBlockRequestDto questionBlockRequestDto){ + + QuestionBlockEntity maxBlockEntity = questionBlockRepository.findFirstByProjectCodeOrderByBlockCodeDesc(questionBlockRequestDto.getProject_code()); + + if(questionBlockRequestDto.getBlock_code() > 0){ + questionBlockCollectionRepository.deleteAllInBatch(questionBlockCollectionRepository.findAllByProjectCodeAndBlockCode(questionBlockRequestDto.getProject_code(), questionBlockRequestDto.getBlock_code())); + }else{ + if(maxBlockEntity != null){ + questionBlockRequestDto.setBlock_code(maxBlockEntity.getBlockCode()+1); + }else{ + questionBlockRequestDto.setBlock_code(1); + } + } + + questionBlockRequestDto.setBlock_name("Block " + questionBlockRequestDto.getBlock_code()); + + int maxBlockCode = questionBlockRepository.save(QuestionBlockEntity.toEntity(questionBlockRequestDto)).getBlockCode(); + + //blockCollection 추가 + List questionBlockList = new ArrayList<>(); + + for(Integer questionUniqueKey : questionBlockRequestDto.getBlock_list()){ + questionBlockList.add(QuestionBlockCollectEntity.builder() + .projectCode(questionBlockRequestDto.getProject_code()) + .blockCode(maxBlockCode) + .questionUniqueKey(questionUniqueKey) + .regMember(questionBlockRequestDto.getReg_member()) + .build() + ); + } + + questionBlockCollectionRepository.saveAll(questionBlockList); + + return 1; + } + + public List getBlockQuestion(String project_code) { + + List questionBlockEntityList = questionBlockRepository.findAllByProjectCode(project_code); + + return questionBlockEntityList.stream().map(QuestionBlockResponseDto::of).collect(Collectors.toList()); + } + + public int deleteBlockQuestion(QuestionBlockDeleteRequestDto questionBlockDeleteRequestDto) { + + int result = questionBlockRepository.deleteByProjectCodeAndBlockCode(questionBlockDeleteRequestDto.getProject_code(), questionBlockDeleteRequestDto.getBlock_code()); + + questionBlockCollectionRepository.deleteAllInBatch(questionBlockCollectionRepository.findAllByProjectCodeAndBlockCode(questionBlockDeleteRequestDto.getProject_code(), questionBlockDeleteRequestDto.getBlock_code())); + + return result; + } + + public int saveAutoRecode(List saveAutoRecodeRequestDto) { + autoRecodeRepository.deleteByProjectCodeAndQuestionUniqueKey(saveAutoRecodeRequestDto.get(0).getProjectCode(), saveAutoRecodeRequestDto.get(0).getQuestionUniqueKey()); + autoRecodeRepository.saveAll(saveAutoRecodeRequestDto.stream().map(AutoRecodeEntity::toEntity).collect(Collectors.toList())); + + return 1; + } + + public List getAutoRecode(GetAutoRecodeRequestDto getAutoRecodeRequestDto) { + List getAutoRecodeResponseDtoList = autoRecodeRepository.findAllByProjectCodeAndQuestionUniqueKey(getAutoRecodeRequestDto.getProjectCode(), getAutoRecodeRequestDto.getQuestionUniqueKey()).stream() + .map(GetAutoRecodeResponseDto::of) + .collect(Collectors.toList()); + + return getAutoRecodeResponseDtoList; + } +} diff --git a/src/main/java/com/krt/newssak/service/QuotaService.java b/src/main/java/com/krt/newssak/service/QuotaService.java new file mode 100644 index 0000000..b2a54be --- /dev/null +++ b/src/main/java/com/krt/newssak/service/QuotaService.java @@ -0,0 +1,82 @@ +package com.krt.newssak.service; + +import com.krt.newssak.dto.quota.QuotaCellDto; +import com.krt.newssak.dto.quota.QuotaDeleteDto; +import com.krt.newssak.dto.quota.QuotaListDto; +import com.krt.newssak.dto.quota.QuotaUpsertDto; +import com.krt.newssak.entity.quota.QuotaCellEntity; +import com.krt.newssak.entity.quota.QuotaEntity; +import com.krt.newssak.repository.quota.QuotaCellRepository; +import com.krt.newssak.repository.quota.QuotaQueryRepository; +import com.krt.newssak.repository.quota.QuotaRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +@Transactional +@RequiredArgsConstructor +public class QuotaService { + private final QuotaQueryRepository quotaQueryRepository; + private final QuotaRepository quotaRepository; + private final QuotaCellRepository quotaCellRepository; + + @Transactional(readOnly = true) + public List getQuotaList(String projectCode){ + return quotaRepository.findAllByProjectCode(projectCode).stream().map(QuotaListDto ::of).toList(); + } + + @Transactional(readOnly = true) + public List getQuotaInfo(String projectCode, int quotaCode){ + return quotaCellRepository.findAllByProjectCodeAndQuotaCodeOrderByIdx(projectCode, quotaCode).stream().map(QuotaCellDto ::of).toList(); + } + + public boolean setQuota(QuotaUpsertDto quotaUpsertDto){ + System.out.println(quotaUpsertDto); + try { + if(quotaUpsertDto.getQuotaCode() == 0){ + QuotaEntity lastQuota = quotaRepository.findFirstByProjectCodeOrderByQuotaCodeDesc(quotaUpsertDto.getProjectCode()); + int setQuotaCode = 1; + if(lastQuota != null){ + setQuotaCode = lastQuota.getQuotaCode() + 1; + } + quotaUpsertDto.setQuotaCode(setQuotaCode); + } + + if(quotaUpsertDto.getIsNew() == 1){ //추가 + + quotaRepository.save(QuotaEntity.toEntity(quotaUpsertDto)); + quotaCellRepository.saveAll(quotaUpsertDto.getQuotaCellList().stream().map(x -> QuotaCellEntity.toEntity(quotaUpsertDto.getProjectCode(), quotaUpsertDto.getQuotaCode(), x)).toList()); + }else { //수정 + QuotaEntity updateEntity = QuotaEntity.toEntity(quotaUpsertDto); + quotaRepository.save(updateEntity); + + List quotaCellDto = quotaUpsertDto.getQuotaCellList(); + List updateCellList = quotaCellDto.stream().map(e -> QuotaCellEntity.toEntity(quotaUpsertDto.getProjectCode(), quotaUpsertDto.getQuotaCode(), e)).toList(); + + quotaCellRepository.deleteAll(quotaCellRepository.findAllByProjectCodeAndQuotaCodeOrderByIdx(quotaUpsertDto.getProjectCode(), quotaUpsertDto.getQuotaCode())); + + quotaCellRepository.saveAll(updateCellList); + } + + return true; + } + catch (Exception ex){ + return false; + } + } + + public boolean deleteQuota(QuotaDeleteDto quotaDeleteDto){ + try { + quotaRepository.delete(quotaRepository.findFirstByProjectCodeAndQuotaCode(quotaDeleteDto.getProjectCode(),quotaDeleteDto.getQuotaCode())); + quotaCellRepository.deleteAll(quotaCellRepository.findAllByProjectCodeAndQuotaCodeOrderByIdx(quotaDeleteDto.getProjectCode(),quotaDeleteDto.getQuotaCode())); + + return true; + } + catch (Exception ex){ + return false; + } + } +} diff --git a/src/main/java/com/krt/newssak/service/WebSocketService.java b/src/main/java/com/krt/newssak/service/WebSocketService.java new file mode 100644 index 0000000..01ff422 --- /dev/null +++ b/src/main/java/com/krt/newssak/service/WebSocketService.java @@ -0,0 +1,91 @@ +package com.krt.newssak.service; + +import com.krt.newssak.dto.websocket.QuestionSettingWSInfo; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class WebSocketService { + + private final HashMap> sessionList = new HashMap<>(); + + public ArrayList sessionAdd(QuestionSettingWSInfo questionSettingWSInfoAdd) { + if(sessionList.get(questionSettingWSInfoAdd.getProjectCode()) == null){ //플젝코드 없을 시, 생성 + sessionList.put(questionSettingWSInfoAdd.getProjectCode(), new ArrayList<>(Collections.singletonList(questionSettingWSInfoAdd))); + }else{ //플젝코드 존재할 시, 리스트에 추가 + sessionList.get(questionSettingWSInfoAdd.getProjectCode()).add(questionSettingWSInfoAdd); + } + + return sessionList.get(questionSettingWSInfoAdd.getProjectCode()); + } + + public ArrayList sessionGet(String projectCode){ + System.out.println(sessionList); + return sessionList.get(projectCode); + } + + public String getProjectCode(String deleteSessionId){ + for(ArrayList projectSessionList : sessionList.values()){ + List questionSettingWSInfo = projectSessionList.stream() + .filter(x -> x.getSessionId().equals(deleteSessionId)) + .toList(); + + if(!questionSettingWSInfo.isEmpty()){ + return questionSettingWSInfo.get(0).getProjectCode(); + } + } + + return ""; + } + + public ArrayList sessionDelete(String projectCode, String deleteSessionId) { + ArrayList projectSessionList = sessionList.get(projectCode); + + if(projectSessionList == null) return new ArrayList<>(); + + projectSessionList.stream() + .filter(x -> x.getSessionId().equals(deleteSessionId)) + .collect(Collectors.toList()).forEach(x -> { + sessionList.get(projectCode).remove(x); + }); + + return sessionList.get(projectCode); + } + + public ArrayList questionChange(QuestionSettingWSInfo questionSettingWSInfoAdd) { + sessionList.get(questionSettingWSInfoAdd.getProjectCode()).stream() + .filter(x -> x.getId().equals(questionSettingWSInfoAdd.getId())) + .collect(Collectors.toList()).forEach(x -> { + x.setQuestionUK(questionSettingWSInfoAdd.getQuestionUK()); + x.setMessageText(null); + }); + + return sessionList.get(questionSettingWSInfoAdd.getProjectCode()); + } + + public ArrayList messageChange(QuestionSettingWSInfo questionSettingWSInfoAdd) { + sessionList.get(questionSettingWSInfoAdd.getProjectCode()).stream() + .filter(x -> x.getId().equals(questionSettingWSInfoAdd.getId())) + .collect(Collectors.toList()).forEach(x -> { + x.setMessageText(questionSettingWSInfoAdd.getMessageText()); + x.setQuestionUK(null); + }); + + return sessionList.get(questionSettingWSInfoAdd.getProjectCode()); + } + + public void listStatusReset(QuestionSettingWSInfo questionSettingWSInfoAdd) { + sessionList.get(questionSettingWSInfoAdd.getProjectCode()).stream() + .filter(x -> x.getId().equals(questionSettingWSInfoAdd.getId())) + .collect(Collectors.toList()).forEach(x -> { + x.setMessageText(null); + x.setQuestionUK(null); + }); + } + +} diff --git a/src/main/java/com/krt/newssak/util/Common.java b/src/main/java/com/krt/newssak/util/Common.java new file mode 100644 index 0000000..8a38b23 --- /dev/null +++ b/src/main/java/com/krt/newssak/util/Common.java @@ -0,0 +1,16 @@ +package com.krt.newssak.util; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +public class Common { + public static String getNow(DateTimeFormatter setFormatter){ + LocalDateTime now = LocalDateTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + if(setFormatter != null){ + formatter = setFormatter; + } + + return now.format(formatter); + } +} diff --git a/src/main/java/com/krt/newssak/util/IpUtil.java b/src/main/java/com/krt/newssak/util/IpUtil.java new file mode 100644 index 0000000..f6c7a3d --- /dev/null +++ b/src/main/java/com/krt/newssak/util/IpUtil.java @@ -0,0 +1,56 @@ +package com.krt.newssak.util; + +import jakarta.servlet.http.HttpServletRequest; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; + +public class IpUtil { + private static final String[] IP_HEADER_CANDIDATES = { + "Proxy-Client-IP", + "WL-Proxy-Client-IP", + "HTTP_X_FORWARDED_FOR", + "HTTP_X_FORWARDED", + "HTTP_X_CLUSTER_CLIENT_IP", + "HTTP_CLIENT_IP", + "HTTP_FORWARDED_FOR", + "HTTP_FORWARDED", + "HTTP_VIA", + "REMOTE_ADDR" + }; + + public static String getClientIp(HttpServletRequest request) { + String ip = getIpXFF(request); + + for (String ipHeader: List.of(IP_HEADER_CANDIDATES)) { + ip = request.getHeader(ipHeader); + if (!notValidIp(ip)) return ip; + } + + return ip != null ? ip : request.getRemoteAddr(); + } + + private static String getIpXFF(HttpServletRequest request) { + String ip = request.getHeader("X-Forwarded-For"); + + if (isMultipleIpXFF(ip)) { + ip = getClientIpWhenMultipleIpXFF(ip); + } + + return ip; + } + + private static boolean notValidIp(String ip) { + return ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip); + } + + private static boolean isMultipleIpXFF(String ip) { + // return ip.contains(","); + return StringUtils.contains(ip, ","); // null-safe + } + + private static String getClientIpWhenMultipleIpXFF(String ipList) { + // return ips.split(",")[0]; + return StringUtils.split(ipList, ",")[0]; // null-safe + } +} diff --git a/src/main/java/com/krt/newssak/util/RegexLabel.java b/src/main/java/com/krt/newssak/util/RegexLabel.java new file mode 100644 index 0000000..61d548e --- /dev/null +++ b/src/main/java/com/krt/newssak/util/RegexLabel.java @@ -0,0 +1,136 @@ +package com.krt.newssak.util; + +import com.google.gson.Gson; +import com.krt.newssak.dto.question.QuestionLabelInfoDto; +import com.krt.newssak.dto.question.QuestionUpsertDto; +import com.krt.newssak.entity.question.QuestionEntity; +import com.krt.newssak.entity.question.QuestionLabelEntity; +import com.krt.newssak.exception.ApiException; +import com.krt.newssak.exception.ExceptionEnum; +import com.krt.newssak.repository.question.QuestionLabelRepository; +import com.krt.newssak.repository.question.QuestionRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +@Component +@RequiredArgsConstructor +public class RegexLabel { + + private final QuestionRepository questionRepository; + private final QuestionLabelRepository questionLabelRepository; + + //piping Regex + private final Pattern pipingRegex = Pattern.compile("((\\{){1}[\\w:]{1,}((\\[){1}(\\w\\|?){1,}(\\]){1})?(\\}){1})"); + //questionId Regex + private final Pattern questionIdRegex = Pattern.compile("\\b([A-Za-z]\\w:\\d+)+(?![^\\[]*\\])"); + + //응답값 치환 필요한 라벨을 QID -> UK로 변경 + public String questionIdToUniqueKeyLabelReplace(String projectCode, String text) { + Pattern pipingRegex = Pattern.compile("((\\{){1}\\w{1,}((\\[){1}(\\w\\|?){1,}(\\]){1})?(\\}){1})"); + Pattern questionIdRegex = Pattern.compile("\\b([A-Za-z]\\w+)+(?![^\\[]*\\])"); + + Matcher textMatcher = pipingRegex.matcher(text); + StringBuilder stringBuilder = new StringBuilder(); + + while(textMatcher.find()) { + String regexText = textMatcher.group(); + Matcher questionIdMatcher = questionIdRegex.matcher(regexText); + + if(questionIdMatcher.find()) { + String regexQuestionId = questionIdMatcher.group(); + + QuestionEntity questionEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(projectCode, regexQuestionId, 0); + String questionUniqueKey = ""; + + if(questionEntity != null){ + questionUniqueKey = String.valueOf(questionEntity.getQuestionUniqueKey()); + }else { + throw new ApiException(ExceptionEnum.QUESTION_NOT_FOUND); + } + + + textMatcher.appendReplacement(stringBuilder, regexText.replace(regexQuestionId, "UK:"+questionUniqueKey)); + } + } + + textMatcher.appendTail(stringBuilder); + + return stringBuilder.toString(); + } + + //응답값 파이핑 변환 + public void questionIdToUniqueKeyLabelChange(QuestionUpsertDto questionUpsertDto) { + String projectCode = questionUpsertDto.getProject_code(); + //타이틀 + questionUpsertDto.setQuestion_title(questionIdToUniqueKeyLabelReplace(projectCode, questionUpsertDto.getQuestion_title())); + //안내문 + questionUpsertDto.setQuestion_description(questionIdToUniqueKeyLabelReplace(projectCode, questionUpsertDto.getQuestion_description())); + + QuestionEntity questionEntity = QuestionEntity.toEntity(questionUpsertDto); + questionRepository.save(questionEntity); + + //라벨(Tensor) + Gson gson = new Gson(); + int index = 0; + + if(questionUpsertDto.getTensor_label() != null) { + for(QuestionLabelInfoDto qli : questionUpsertDto.getTensor_label().getLabel_info()) { + qli.setLabel(questionIdToUniqueKeyLabelReplace(projectCode, qli.getLabel())); + questionUpsertDto.getTensor_label().getLabel_info().set(index++, qli); + } + + QuestionLabelEntity LabelEntity = QuestionLabelEntity.of( + questionUpsertDto.getProject_code(), + questionUpsertDto.getQuestion_unique_key(), + 3, + gson.toJson(questionUpsertDto.getTensor_label().getLabel_info()), + gson.toJson(questionUpsertDto.getTensor_label().getLabel_option()) + ); + + questionLabelRepository.save(LabelEntity); + } + + //라벨(Matrix) + if(questionUpsertDto.getMatrix_label() != null) { + index = 0; + for(QuestionLabelInfoDto qli : questionUpsertDto.getMatrix_label().getLabel_info()) { + qli.setLabel(questionIdToUniqueKeyLabelReplace(projectCode, qli.getLabel())); + questionUpsertDto.getMatrix_label().getLabel_info().set(index++, qli); + } + + QuestionLabelEntity LabelEntity = QuestionLabelEntity.of( + questionUpsertDto.getProject_code(), + questionUpsertDto.getQuestion_unique_key(), + 2, + gson.toJson(questionUpsertDto.getMatrix_label().getLabel_info()), + gson.toJson(questionUpsertDto.getMatrix_label().getLabel_option()) + ); + + questionLabelRepository.save(LabelEntity); + } + + //라벨(Scalar) + if(questionUpsertDto.getScalar_label() != null) { + index = 0; + for(QuestionLabelInfoDto qli : questionUpsertDto.getScalar_label().getLabel_info()) { + qli.setLabel(questionIdToUniqueKeyLabelReplace(projectCode, qli.getLabel())); + questionUpsertDto.getScalar_label().getLabel_info().set(index++, qli); + } + + QuestionLabelEntity LabelEntity = QuestionLabelEntity.of( + questionUpsertDto.getProject_code(), + questionUpsertDto.getQuestion_unique_key(), + 1, + gson.toJson(questionUpsertDto.getScalar_label().getLabel_info()), + gson.toJson(questionUpsertDto.getScalar_label().getLabel_option()) + ); + + questionLabelRepository.save(LabelEntity); + } + + + } +} diff --git a/src/main/java/com/krt/newssak/util/RegexLogic.java b/src/main/java/com/krt/newssak/util/RegexLogic.java new file mode 100644 index 0000000..8c17c29 --- /dev/null +++ b/src/main/java/com/krt/newssak/util/RegexLogic.java @@ -0,0 +1,152 @@ +package com.krt.newssak.util; + +import java.util.ArrayList; +import java.util.List; +import java.util.StringJoiner; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +public class RegexLogic { + ////// "/" -> OR + ////// "," -> AND + static String fullSyntaxRegex = "\\b([A-Za-z]\\w+)+(?![^\\[]*\\])(\\[.*?\\])*\\s*(\\[.*?\\])*\\s*[=<>!]+\\s*(?:[\\d\\/\\,]*(\\\"\\\")*)"; + + public static String questionIdRegex = "\\b([A-Za-z]\\w+)+(?![^\\[]*\\])"; + public static String questionUniqueKeyRegex = "\\[(UK|uk)\\:\\d+\\]"; + + static String positiveAndRegex = "((?)=\\s*\\d+(?:\\,\\d+)+)"; //-> (S_V = 1 and S_V = 2 and S_V = 3) + static String positiveOrRegex = "(?)=\\s*((?:\\d+\\/?)+)(?![^, ]*\\,)"; //-> S_V in (1,2,3) or in (1) + static String positiveNullRegex = "((?)=\\s*\\\"\\\"+)"; //-> S_V is null + + static String negativeAndRegex = "(\\!\\=\\s*((?:\\d+\\,?)+)(?![^\\/ ]*\\/))"; //-> S_V not in (1,2,3) or not in (1) + static String negativeOrRegex = "(\\!\\=\\s*\\d+(?:\\/\\d+)+)"; //-> (S_V != 1 or S_V != 2 or S_V != 3) + static String negativeNullRegex = "(\\!\\=\\s*\\\"\\\"+)"; //-> S_V is not null + + static String greaterLessRegex = "([<>]=?)"; + static String operatorValueRegex = "[=<>!]+\\s*(?:[\\d\\/\\,]*(\\\"\\\")*)"; + static Pattern valuePattern = Pattern.compile("\\d+"); + + public static String getUseQid(String logicString){ + List useQidList = new ArrayList<>(); + Pattern questionIdPattern = Pattern.compile(questionIdRegex); + Matcher questionIdMatcher = questionIdPattern.matcher(logicString); + + while (questionIdMatcher.find()) { + String matchString = questionIdMatcher.group().trim(); + if(!matchString.equalsIgnoreCase("AND") && !matchString.equalsIgnoreCase("OR")){ + useQidList.add("'" + matchString +"'"); + } + } + + return useQidList.stream().distinct().collect(Collectors.joining(",")); + } + + public static String makeSyntaxString(String logicString){ + /////[t{d}][m{d}][r{d}] + ///[t1|m1|r1] -> [t1][m1][r1] + StringBuilder fullSyntaxBuilder = new StringBuilder(); + + String reorderSyntax = logicString.replace("|","]["); + Pattern fullSyntaxPattern = Pattern.compile(fullSyntaxRegex); + Matcher fullSyntaxMatcher = fullSyntaxPattern.matcher(reorderSyntax); + Pattern questionIdPattern = Pattern.compile(questionIdRegex); + Pattern operatorValuePattern = Pattern.compile(operatorValueRegex); + + String[] reservedTargetArray = new String[]{"t","m","r","l"}; + //로직을 한 구문 씩 번역 + while (fullSyntaxMatcher.find()){ + String qid = ""; + StringJoiner fullSyntaxJoiner = new StringJoiner(" AND" + System.lineSeparator()); + + String fullSyntax = fullSyntaxMatcher.group(); + Matcher questionIdMatcher = questionIdPattern.matcher(fullSyntax); + while (questionIdMatcher.find()) { + String matchString = questionIdMatcher.group().trim(); + //해당 구문의 qid를 추출 후 따로 빼놓기 + if(!matchString.equalsIgnoreCase("AND") && !matchString.equalsIgnoreCase("OR")){ + qid = matchString; + break; + } + } + + // Todo : reserved의 AND OR는 뻥튀기 + //T, M, R, L 예약어 관련 쿼리문 작성 + for (String reservedTarget : reservedTargetArray){ + //String reservedOrRegex = "\\[\\s*("+reservedTarget.toLowerCase()+"|"+reservedTarget+")[\\d\\/\\s]+\\s*\\]"; + //String reservedAndRegex = "\\[\\s*("+reservedTarget.toLowerCase()+"|"+reservedTarget+")[\\d\\,\\s]+\\s*\\]"; + Pattern reservedPattern = Pattern.compile("\\s*\\[\\s*("+reservedTarget+"|"+reservedTarget.toUpperCase()+")[\\d\\/\\s]+\\s*\\]\\s*"); + Matcher reservedMatcher = reservedPattern.matcher(fullSyntax); + while (reservedMatcher.find()){ + String reservedString = reservedMatcher.group().trim(); + fullSyntaxJoiner.add("JSON_CONTAINS(a.ANS_DATA -> '\\$.\""+qid+"\"[*].\""+reservedTarget+"\"',json_array("+inValueString(reservedString)+"))"); + } + } + + //값 비교 쿼리 작성 + Matcher operatorValueMatcher = operatorValuePattern.matcher(fullSyntax); + while (operatorValueMatcher.find()) { + String matchString = operatorValueMatcher.group().trim(); + fullSyntaxJoiner.add(replaceLogicValueString(matchString, qid)); + } + + //쿼리문 조립 + String assembleSyntax = System.lineSeparator() + "(" + fullSyntaxJoiner.toString() + ")" + System.lineSeparator(); + //교체 + fullSyntaxMatcher.appendReplacement(fullSyntaxBuilder, assembleSyntax); + } + fullSyntaxMatcher.appendTail(fullSyntaxBuilder); + return fullSyntaxBuilder.toString(); + } + + public static String replaceLogicValueString(String operatorValueString, String qid){ + ///////Range에 대한 것은 추후에 추가 하도록 하자. + String returnString = ""; + Pattern positiveAndPattern = Pattern.compile(positiveAndRegex); + Pattern positiveOrPattern = Pattern.compile(positiveOrRegex); + Pattern positiveNullPattern = Pattern.compile(positiveNullRegex); + Pattern negativeAndPattern = Pattern.compile(negativeAndRegex); + Pattern negativeOrPattern = Pattern.compile(negativeOrRegex); + Pattern negativeNullPattern = Pattern.compile(negativeNullRegex); + Pattern greaterLessPattern = Pattern.compile(greaterLessRegex); + + if(positiveAndPattern.matcher(operatorValueString).matches()){ + returnString = "JSON_CONTAINS(a.ANS_DATA -> '\\$.\"" + qid + "\"[*].\"s\"',json_array(" + inValueString(operatorValueString) + "))"; + } + else if(positiveOrPattern.matcher(operatorValueString).matches()){ + returnString = "JSON_OVERLAPS(a.ANS_DATA -> '\\$.\"" + qid + "\"[*].\"s\"',json_array(" + inValueString(operatorValueString) + "))"; + } + else if(positiveNullPattern.matcher(operatorValueString).matches()){ + returnString = "a.ANS_DATA -> '\\$.\"" + qid + "\"[*].\"s\"' is null"; + } + else if(negativeAndPattern.matcher(operatorValueString).matches()){ + returnString = "JSON_OVERLAPS(a.ANS_DATA -> '\\$.\"" + qid + "\"[*].\"s\"',json_array(" + inValueString(operatorValueString) + ")) = false"; + } + else if(negativeOrPattern.matcher(operatorValueString).matches()){ + returnString = "JSON_CONTAINS(a.ANS_DATA -> '\\$.\"" + qid + "\"[*].\"s\"',json_array(" + inValueString(operatorValueString) + ")) = false"; + } + else if(negativeNullPattern.matcher(operatorValueString).matches()){ + returnString = "a.ANS_DATA -> '\\$.\"" + qid + "\"[*].\"s\"' is not null"; + } + else{ + Matcher greaterLessMatcher = greaterLessPattern.matcher(operatorValueString); + if(greaterLessMatcher.find()){ + String greatLessString = greaterLessMatcher.group(); + returnString = "EXISTS(SELECT 1 FROM JSON_TABLE( a.ANS_DATA -> '\\$.\"" + qid + "\"', '\\$[*]' COLUMNS(s INT PATH '\\$.s')) AS jt WHERE jt.s " + greatLessString + " " + inValueString(operatorValueString) + ") = 1"; + } + } + + return returnString; + } + private static String inValueString(String originString){ + Matcher valueMatcher = valuePattern.matcher(originString); + StringJoiner valueString = new StringJoiner(","); + + while (valueMatcher.find()) { + valueString.add(valueMatcher.group()); + } + + return valueString.toString(); + } + +} diff --git a/src/main/java/com/krt/newssak/util/SecurityUtil.java b/src/main/java/com/krt/newssak/util/SecurityUtil.java new file mode 100644 index 0000000..355fb0d --- /dev/null +++ b/src/main/java/com/krt/newssak/util/SecurityUtil.java @@ -0,0 +1,64 @@ +package com.krt.newssak.util; + +import java.security.MessageDigest; +import java.util.Base64; +import java.util.Base64.*; +import java.util.HexFormat; + +import jakarta.xml.bind.DatatypeConverter; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.util.DigestUtils; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +public class SecurityUtil { + private static final String key = "kriT#3415%130$^$tuDi0_Ds34155100";//32자리 KART에서 사용하는 키 + private static final String iv = key.substring(0, 16); // 16byte의 초기화벡터값 + public static String getCurrentMemberId() { + final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication == null || authentication.getName() == null) { + throw new RuntimeException("No authentication information."); + } + return authentication.getName(); + } + + public static String encrypt(String plainText) throws Exception { + //암호화 모드는 CBC를, 패딩은 PKCS5을 사용 + Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES"); + IvParameterSpec ivParamSpec = new IvParameterSpec(iv.getBytes()); + c.init(Cipher.ENCRYPT_MODE, keySpec, ivParamSpec); + + byte[] encrypted = c.doFinal(plainText.getBytes("UTF-8")); + //base64로 인코딩 + Encoder encoder = Base64.getEncoder(); + return new String(encoder.encode(encrypted)); + } + public static String decrypt(String cipherText) throws Exception { + Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES"); + IvParameterSpec ivParamSpec = new IvParameterSpec(iv.getBytes()); + c.init(Cipher.DECRYPT_MODE, keySpec, ivParamSpec); + + Decoder decoder = Base64.getDecoder(); + byte[] decodedBytes = decoder.decode(cipherText); + byte[] decrypted = c.doFinal(decodedBytes); + return new String(decrypted, "UTF-8"); + } + + public static String md5AndHexUpper(String plainText) throws Exception{ + //MessageDigest 인스턴스 생성(MD5) + MessageDigest md = MessageDigest.getInstance("MD5"); + //해쉬값 업데이트 + md.update(plainText.getBytes()); + //Byte To Hex String + return DatatypeConverter.printHexBinary(md.digest()); + } + public static String md5AndHexLower(String plainText) throws Exception{ + //Byte To Hex String(apache) + return new String(DigestUtils.md5DigestAsHex(plainText.getBytes())); + } +} diff --git a/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..3282e3c --- /dev/null +++ b/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,9 @@ +{ + "properties": [ + { + "name": "jwt.secret", + "type": "java.lang.String", + "description": "Description for jwt.secret." + } + ] +} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..742fbdc --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,41 @@ +server.port=7000 + +server.ssl.enabled=false +#server.ssl.key-store=/opt/kric_com.pfx +#server.ssl.key-store-password=it#51304 +#server.ssl.key-store-type=PKCS12 + +spring.web.resources.static-locations=file:/opt/newssak/ + +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://db-md87m-kr.vpc-pub-cdb.ntruss.com:3306/newssak?serverTimezone=UTC&characterEncoding=UTF-8 +spring.datasource.username=newssak +spring.datasource.password=ns#51304 + +#springdoc.default-consumes-media-type=application/json;charset=UTF-8 +#springdoc.default-produces-media-type=application/json;charset=UTF-8 +#springdoc.packages-to-scan=com.krt.newssak.controller +# +#springdoc.swagger-ui.path=/ +#springdoc.swagger-ui.display-request-duration=true +#springdoc.swagger-ui.groups-order=desc +#springdoc.swagger-ui.tags-sorter=alpha +#springdoc.swagger-ui.disable-swagger-default-url=true +# +#springdoc.api-docs.groups.enabled=true + +#springdoc.swagger-ui.operations-sorter=alpha +#springdoc.api-docs.groups.enabled=true +#springdoc.cache.disabled=true + +spring.mvc.pathmatch.matching-strategy=ant_path_matcher + +#View Query Log +#spring.jpa.properties.hibernate.show_sql=true +#spring.jpa.properties.hibernate.format_sql=true +#spring.jpa.properties.hibernate.use_sql_comments=true +#logging.level.org.hibernate.type.descriptor.sql=trace + +#jwt Secret Key +jwt.secret=VlwEyVBsYt9V7zq57TejMnVUyzblYcfPQye08f7MGVA9XkHa + diff --git a/src/test/java/com/krt/newssak/NewssakApplicationTests.java b/src/test/java/com/krt/newssak/NewssakApplicationTests.java new file mode 100644 index 0000000..f704011 --- /dev/null +++ b/src/test/java/com/krt/newssak/NewssakApplicationTests.java @@ -0,0 +1,13 @@ +package com.krt.newssak; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class NewssakApplicationTests { + + @Test + void contextLoads() { + } + +}