From c3fa979c69fa28bad895d0fb51c5c0bda784a48d Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Tue, 9 Dec 2025 11:53:19 +0900 Subject: [PATCH] first commit --- .gitignore | 37 + build.gradle | 60 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 63375 bytes gradle/wrapper/gradle-wrapper.properties | 7 + gradlew | 248 +++ gradlew.bat | 92 + opt/kric_com.pfx | Bin 0 -> 3205 bytes settings.gradle | 1 + .../IpAccessControlInterceptor.java | 27 + src/main/java/com/krt/sun/SunApplication.java | 19 + .../com/krt/sun/config/QueryDslConfig.java | 20 + .../com/krt/sun/config/SecurityConfig.java | 37 + .../com/krt/sun/config/SwaggerConfig.java | 26 + .../java/com/krt/sun/config/WebConfig.java | 33 + .../krt/sun/controller/CapiController.java | 84 + .../sun/controller/HardCodeController.java | 52 + .../krt/sun/controller/ProjectController.java | 57 + .../sun/controller/QuestionController.java | 54 + .../krt/sun/controller/SurveyController.java | 119 ++ .../krt/sun/dto/capi/CapiLoginRequestDto.java | 13 + .../sun/dto/capi/CapiLoginResponseDto.java | 25 + .../dto/capi/DeleteSurveyDataRequestDto.java | 16 + ...GetInterviewerAssignProjectRequestDto.java | 12 + .../GetInterviewerSurveyDetailRequestDto.java | 13 + .../dto/capi/GetRestartDataRequestDto.java | 13 + .../dto/capi/GetSurveyDetailResponseDto.java | 32 + .../capi/GetSurveyStatusCountResponseDto.java | 41 + .../SurveyDataDeleteCancelRequestDto.java | 13 + .../sun/dto/hardcode/AnswerUserInfoDto.java | 16 + .../dto/hardcode/HardCodeAndHistoryDto.java | 16 + .../com/krt/sun/dto/hardcode/HardCodeDto.java | 34 + .../sun/dto/hardcode/HardCodeHistoryDto.java | 42 + .../dto/hardcode/HardCodeRequestInfoDto.java | 14 + .../dto/list/ListContentGetResponseDto.java | 34 + .../krt/sun/dto/parameter/ParameterDto.java | 15 + .../common/ProjectOptionElementDto.java | 26 + .../project/response/OptionElementDto.java | 34 + .../sun/dto/project/response/ProjectDto.java | 45 + .../project/response/ProjectOptionDto.java | 21 + .../response/ProjectSurveyInfoDto.java | 56 + .../question/common/QuestionLogicJsonDto.java | 14 + .../common/QuestionOptionValueJsonDto.java | 14 + .../question/label/QuestionLabelInfoDto.java | 27 + .../question/label/QuestionLabelJsonDto.java | 21 + .../label/QuestionLabelOptionApplyDto.java | 28 + .../label/QuestionLabelOptionDto.java | 31 + .../label/QuestionLabelRotationDto.java | 15 + .../question/response/QuestionInfoDto.java | 63 + .../response/QuestionNavigationDto.java | 36 + .../question/response/QuestionOptionDto.java | 23 + .../com/krt/sun/dto/quota/QuotaCellDto.java | 35 + .../krt/sun/dto/quota/QuotaCellJsonDto.java | 15 + .../com/krt/sun/dto/quota/QuotaListDto.java | 35 + .../com/krt/sun/dto/redirect/RedirectDto.java | 30 + .../dto/survey/common/ErrorMessageDto.java | 12 + .../sun/dto/survey/common/SurveyDataDto.java | 16 + .../krt/sun/dto/survey/common/SurveyInfo.java | 18 + .../survey/common/SurveyRespondentDto.java | 18 + .../sun/dto/survey/request/DataSaveDto.java | 62 + .../survey/request/GangLoginRequestDto.java | 19 + .../dto/survey/request/IndexParameterDto.java | 19 + .../survey/response/IndexFormSetupDto.java | 26 + .../sun/dto/survey/response/NextLoopInfo.java | 15 + .../response/QuestionUniqueKeyAndDataDto.java | 25 + .../QuestionUniqueKeyAndLabelDto.java | 24 + .../response/SurveyDataStructureDto.java | 32 + .../survey/response/SurveyFormSetupDto.java | 28 + .../entity/autorecode/AutoRecodeEntity.java | 41 + .../entity/capi/InterviewerAssignEntity.java | 40 + .../capi/InterviewerDeleteRequestEntity.java | 52 + .../entity/capi/InterviewerInfoEntity.java | 52 + .../sun/entity/hardcode/HardCodeEntity.java | 54 + .../hardcode/HardCodeHistoryEntity.java | 51 + .../sun/entity/list/ListContentEntity.java | 40 + .../krt/sun/entity/list/ListHeaderEntity.java | 41 + .../krt/sun/entity/project/ProjectEntity.java | 48 + .../sun/entity/project/ProjectFileEntity.java | 42 + .../project/ProjectParameterEntity.java | 35 + .../entity/project/ProjectRedirectEntity.java | 44 + .../entity/project/ProjectResponseEntity.java | 29 + .../entity/project/ProjectStyleEntity.java | 29 + .../question/QuestionBlockCollectEntity.java | 46 + .../entity/question/QuestionBlockEntity.java | 49 + .../question/QuestionBlockOptionEntity.java | 38 + .../sun/entity/question/QuestionEntity.java | 61 + .../question/QuestionHardcodeEntity.java | 38 + .../entity/question/QuestionLabelEntity.java | 36 + .../entity/question/QuestionLogicEntity.java | 40 + .../entity/question/QuestionOptionEntity.java | 35 + .../krt/sun/entity/quota/QuotaCellEntity.java | 49 + .../com/krt/sun/entity/quota/QuotaEntity.java | 57 + .../entity/survey/SurveyBlockLoopEntity.java | 41 + .../sun/entity/survey/SurveyDataEntity.java | 53 + .../entity/survey/SurveyRespondentEntity.java | 57 + .../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 | 10 + .../question/QuestionLabelEntityPK.java | 11 + .../question/SurveyBlockLoopEntityPK.java | 13 + .../entity_pk/survey/SurveyDataEntityPK.java | 13 + .../survey/SurveyRespondentEntityPK.java | 11 + .../com/krt/sun/enums/AnswerStateEnum.java | 30 + .../com/krt/sun/enums/SurveyTypeEnum.java | 39 + .../com/krt/sun/exception/ApiException.java | 19 + .../krt/sun/exception/ApiExceptionAdvice.java | 34 + .../krt/sun/exception/ApiExceptionEntity.java | 38 + .../com/krt/sun/exception/ExceptionDto.java | 19 + .../com/krt/sun/exception/TextException.java | 18 + .../sun/exception/TextExceptionEntity.java | 23 + .../autorecode/AutoRecodeRepository.java | 11 + .../repository/capi/CapiAssignRepository.java | 13 + .../repository/capi/CapiQueryRepository.java | 112 + .../sun/repository/capi/CapiRepository.java | 10 + ...CapiSurveyDataDeleteRequestRepository.java | 8 + .../hardcode/HardCodeHistoryRepository.java | 11 + .../hardcode/HardCodeRepository.java | 9 + .../list/ListContentRepository.java | 14 + .../repository/list/ListHeaderRepository.java | 17 + .../project/ProjectFileRepository.java | 10 + .../project/ProjectParameterRepository.java | 12 + .../project/ProjectQueryRepository.java | 62 + .../project/ProjectRedirectRepository.java | 10 + .../repository/project/ProjectRepository.java | 15 + .../project/ProjectResponseRepository.java | 11 + .../project/ProjectStyleRepository.java | 11 + .../QuestionBlockCollectionRepository.java | 17 + .../question/QuestionBlockLoopRepository.java | 15 + .../question/QuestionBlockRepository.java | 17 + .../QuestionBolckOptionRepository.java | 12 + .../question/QuestionLabelRepository.java | 12 + .../question/QuestionLogicRepository.java | 15 + .../question/QuestionOptionRepository.java | 13 + .../question/QuestionRepository.java | 29 + .../repository/quota/QuotaCellRepository.java | 12 + .../quota/QuotaQueryRepository.java | 45 + .../sun/repository/quota/QuotaRepository.java | 16 + .../survey/SurveyDataQueryRepository.java | 34 + .../survey/SurveyDataRepository.java | 22 + .../survey/SurveyRespondentRepository.java | 15 + .../java/com/krt/sun/service/CapiService.java | 132 ++ .../com/krt/sun/service/HardCodeService.java | 164 ++ .../sun/service/IpAccessControlService.java | 23 + .../com/krt/sun/service/ProjectService.java | 66 + .../com/krt/sun/service/QuestionService.java | 518 +++++ .../com/krt/sun/service/SurveyService.java | 1865 +++++++++++++++++ src/main/java/com/krt/sun/util/Common.java | 56 + .../com/krt/sun/util/FixedPanelRedirect.java | 32 + src/main/java/com/krt/sun/util/IpUtil.java | 56 + .../java/com/krt/sun/util/RegexLabel.java | 241 +++ .../java/com/krt/sun/util/RegexLogic.java | 155 ++ .../java/com/krt/sun/util/SecurityUtil.java | 53 + src/main/resources/application.properties | 29 + .../java/com/krt/sun/SunApplicationTests.java | 13 + 159 files changed, 7798 insertions(+) create mode 100644 .gitignore 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 opt/kric_com.pfx create mode 100644 settings.gradle create mode 100644 src/main/java/com/krt/sun/Interceptor/IpAccessControlInterceptor.java create mode 100644 src/main/java/com/krt/sun/SunApplication.java create mode 100644 src/main/java/com/krt/sun/config/QueryDslConfig.java create mode 100644 src/main/java/com/krt/sun/config/SecurityConfig.java create mode 100644 src/main/java/com/krt/sun/config/SwaggerConfig.java create mode 100644 src/main/java/com/krt/sun/config/WebConfig.java create mode 100644 src/main/java/com/krt/sun/controller/CapiController.java create mode 100644 src/main/java/com/krt/sun/controller/HardCodeController.java create mode 100644 src/main/java/com/krt/sun/controller/ProjectController.java create mode 100644 src/main/java/com/krt/sun/controller/QuestionController.java create mode 100644 src/main/java/com/krt/sun/controller/SurveyController.java create mode 100644 src/main/java/com/krt/sun/dto/capi/CapiLoginRequestDto.java create mode 100644 src/main/java/com/krt/sun/dto/capi/CapiLoginResponseDto.java create mode 100644 src/main/java/com/krt/sun/dto/capi/DeleteSurveyDataRequestDto.java create mode 100644 src/main/java/com/krt/sun/dto/capi/GetInterviewerAssignProjectRequestDto.java create mode 100644 src/main/java/com/krt/sun/dto/capi/GetInterviewerSurveyDetailRequestDto.java create mode 100644 src/main/java/com/krt/sun/dto/capi/GetRestartDataRequestDto.java create mode 100644 src/main/java/com/krt/sun/dto/capi/GetSurveyDetailResponseDto.java create mode 100644 src/main/java/com/krt/sun/dto/capi/GetSurveyStatusCountResponseDto.java create mode 100644 src/main/java/com/krt/sun/dto/capi/SurveyDataDeleteCancelRequestDto.java create mode 100644 src/main/java/com/krt/sun/dto/hardcode/AnswerUserInfoDto.java create mode 100644 src/main/java/com/krt/sun/dto/hardcode/HardCodeAndHistoryDto.java create mode 100644 src/main/java/com/krt/sun/dto/hardcode/HardCodeDto.java create mode 100644 src/main/java/com/krt/sun/dto/hardcode/HardCodeHistoryDto.java create mode 100644 src/main/java/com/krt/sun/dto/hardcode/HardCodeRequestInfoDto.java create mode 100644 src/main/java/com/krt/sun/dto/list/ListContentGetResponseDto.java create mode 100644 src/main/java/com/krt/sun/dto/parameter/ParameterDto.java create mode 100644 src/main/java/com/krt/sun/dto/project/common/ProjectOptionElementDto.java create mode 100644 src/main/java/com/krt/sun/dto/project/response/OptionElementDto.java create mode 100644 src/main/java/com/krt/sun/dto/project/response/ProjectDto.java create mode 100644 src/main/java/com/krt/sun/dto/project/response/ProjectOptionDto.java create mode 100644 src/main/java/com/krt/sun/dto/project/response/ProjectSurveyInfoDto.java create mode 100644 src/main/java/com/krt/sun/dto/question/common/QuestionLogicJsonDto.java create mode 100644 src/main/java/com/krt/sun/dto/question/common/QuestionOptionValueJsonDto.java create mode 100644 src/main/java/com/krt/sun/dto/question/label/QuestionLabelInfoDto.java create mode 100644 src/main/java/com/krt/sun/dto/question/label/QuestionLabelJsonDto.java create mode 100644 src/main/java/com/krt/sun/dto/question/label/QuestionLabelOptionApplyDto.java create mode 100644 src/main/java/com/krt/sun/dto/question/label/QuestionLabelOptionDto.java create mode 100644 src/main/java/com/krt/sun/dto/question/label/QuestionLabelRotationDto.java create mode 100644 src/main/java/com/krt/sun/dto/question/response/QuestionInfoDto.java create mode 100644 src/main/java/com/krt/sun/dto/question/response/QuestionNavigationDto.java create mode 100644 src/main/java/com/krt/sun/dto/question/response/QuestionOptionDto.java create mode 100644 src/main/java/com/krt/sun/dto/quota/QuotaCellDto.java create mode 100644 src/main/java/com/krt/sun/dto/quota/QuotaCellJsonDto.java create mode 100644 src/main/java/com/krt/sun/dto/quota/QuotaListDto.java create mode 100644 src/main/java/com/krt/sun/dto/redirect/RedirectDto.java create mode 100644 src/main/java/com/krt/sun/dto/survey/common/ErrorMessageDto.java create mode 100644 src/main/java/com/krt/sun/dto/survey/common/SurveyDataDto.java create mode 100644 src/main/java/com/krt/sun/dto/survey/common/SurveyInfo.java create mode 100644 src/main/java/com/krt/sun/dto/survey/common/SurveyRespondentDto.java create mode 100644 src/main/java/com/krt/sun/dto/survey/request/DataSaveDto.java create mode 100644 src/main/java/com/krt/sun/dto/survey/request/GangLoginRequestDto.java create mode 100644 src/main/java/com/krt/sun/dto/survey/request/IndexParameterDto.java create mode 100644 src/main/java/com/krt/sun/dto/survey/response/IndexFormSetupDto.java create mode 100644 src/main/java/com/krt/sun/dto/survey/response/NextLoopInfo.java create mode 100644 src/main/java/com/krt/sun/dto/survey/response/QuestionUniqueKeyAndDataDto.java create mode 100644 src/main/java/com/krt/sun/dto/survey/response/QuestionUniqueKeyAndLabelDto.java create mode 100644 src/main/java/com/krt/sun/dto/survey/response/SurveyDataStructureDto.java create mode 100644 src/main/java/com/krt/sun/dto/survey/response/SurveyFormSetupDto.java create mode 100644 src/main/java/com/krt/sun/entity/autorecode/AutoRecodeEntity.java create mode 100644 src/main/java/com/krt/sun/entity/capi/InterviewerAssignEntity.java create mode 100644 src/main/java/com/krt/sun/entity/capi/InterviewerDeleteRequestEntity.java create mode 100644 src/main/java/com/krt/sun/entity/capi/InterviewerInfoEntity.java create mode 100644 src/main/java/com/krt/sun/entity/hardcode/HardCodeEntity.java create mode 100644 src/main/java/com/krt/sun/entity/hardcode/HardCodeHistoryEntity.java create mode 100644 src/main/java/com/krt/sun/entity/list/ListContentEntity.java create mode 100644 src/main/java/com/krt/sun/entity/list/ListHeaderEntity.java create mode 100644 src/main/java/com/krt/sun/entity/project/ProjectEntity.java create mode 100644 src/main/java/com/krt/sun/entity/project/ProjectFileEntity.java create mode 100644 src/main/java/com/krt/sun/entity/project/ProjectParameterEntity.java create mode 100644 src/main/java/com/krt/sun/entity/project/ProjectRedirectEntity.java create mode 100644 src/main/java/com/krt/sun/entity/project/ProjectResponseEntity.java create mode 100644 src/main/java/com/krt/sun/entity/project/ProjectStyleEntity.java create mode 100644 src/main/java/com/krt/sun/entity/question/QuestionBlockCollectEntity.java create mode 100644 src/main/java/com/krt/sun/entity/question/QuestionBlockEntity.java create mode 100644 src/main/java/com/krt/sun/entity/question/QuestionBlockOptionEntity.java create mode 100644 src/main/java/com/krt/sun/entity/question/QuestionEntity.java create mode 100644 src/main/java/com/krt/sun/entity/question/QuestionHardcodeEntity.java create mode 100644 src/main/java/com/krt/sun/entity/question/QuestionLabelEntity.java create mode 100644 src/main/java/com/krt/sun/entity/question/QuestionLogicEntity.java create mode 100644 src/main/java/com/krt/sun/entity/question/QuestionOptionEntity.java create mode 100644 src/main/java/com/krt/sun/entity/quota/QuotaCellEntity.java create mode 100644 src/main/java/com/krt/sun/entity/quota/QuotaEntity.java create mode 100644 src/main/java/com/krt/sun/entity/survey/SurveyBlockLoopEntity.java create mode 100644 src/main/java/com/krt/sun/entity/survey/SurveyDataEntity.java create mode 100644 src/main/java/com/krt/sun/entity/survey/SurveyRespondentEntity.java create mode 100644 src/main/java/com/krt/sun/entity_pk/hardcode/HardcodeEntityPK.java create mode 100644 src/main/java/com/krt/sun/entity_pk/project/ProjectFileEntityPK.java create mode 100644 src/main/java/com/krt/sun/entity_pk/project/ProjectParameterEntityPK.java create mode 100644 src/main/java/com/krt/sun/entity_pk/project/ProjectRedirectEntityPK.java create mode 100644 src/main/java/com/krt/sun/entity_pk/project/ProjectResponseEntityPK.java create mode 100644 src/main/java/com/krt/sun/entity_pk/project/ProjectStyleEntityPK.java create mode 100644 src/main/java/com/krt/sun/entity_pk/question/QuestionBlockCollectEntityPk.java create mode 100644 src/main/java/com/krt/sun/entity_pk/question/QuestionBlockEntityPk.java create mode 100644 src/main/java/com/krt/sun/entity_pk/question/QuestionEntityPK.java create mode 100644 src/main/java/com/krt/sun/entity_pk/question/QuestionLabelEntityPK.java create mode 100644 src/main/java/com/krt/sun/entity_pk/question/SurveyBlockLoopEntityPK.java create mode 100644 src/main/java/com/krt/sun/entity_pk/survey/SurveyDataEntityPK.java create mode 100644 src/main/java/com/krt/sun/entity_pk/survey/SurveyRespondentEntityPK.java create mode 100644 src/main/java/com/krt/sun/enums/AnswerStateEnum.java create mode 100644 src/main/java/com/krt/sun/enums/SurveyTypeEnum.java create mode 100644 src/main/java/com/krt/sun/exception/ApiException.java create mode 100644 src/main/java/com/krt/sun/exception/ApiExceptionAdvice.java create mode 100644 src/main/java/com/krt/sun/exception/ApiExceptionEntity.java create mode 100644 src/main/java/com/krt/sun/exception/ExceptionDto.java create mode 100644 src/main/java/com/krt/sun/exception/TextException.java create mode 100644 src/main/java/com/krt/sun/exception/TextExceptionEntity.java create mode 100644 src/main/java/com/krt/sun/repository/autorecode/AutoRecodeRepository.java create mode 100644 src/main/java/com/krt/sun/repository/capi/CapiAssignRepository.java create mode 100644 src/main/java/com/krt/sun/repository/capi/CapiQueryRepository.java create mode 100644 src/main/java/com/krt/sun/repository/capi/CapiRepository.java create mode 100644 src/main/java/com/krt/sun/repository/capi/CapiSurveyDataDeleteRequestRepository.java create mode 100644 src/main/java/com/krt/sun/repository/hardcode/HardCodeHistoryRepository.java create mode 100644 src/main/java/com/krt/sun/repository/hardcode/HardCodeRepository.java create mode 100644 src/main/java/com/krt/sun/repository/list/ListContentRepository.java create mode 100644 src/main/java/com/krt/sun/repository/list/ListHeaderRepository.java create mode 100644 src/main/java/com/krt/sun/repository/project/ProjectFileRepository.java create mode 100644 src/main/java/com/krt/sun/repository/project/ProjectParameterRepository.java create mode 100644 src/main/java/com/krt/sun/repository/project/ProjectQueryRepository.java create mode 100644 src/main/java/com/krt/sun/repository/project/ProjectRedirectRepository.java create mode 100644 src/main/java/com/krt/sun/repository/project/ProjectRepository.java create mode 100644 src/main/java/com/krt/sun/repository/project/ProjectResponseRepository.java create mode 100644 src/main/java/com/krt/sun/repository/project/ProjectStyleRepository.java create mode 100644 src/main/java/com/krt/sun/repository/question/QuestionBlockCollectionRepository.java create mode 100644 src/main/java/com/krt/sun/repository/question/QuestionBlockLoopRepository.java create mode 100644 src/main/java/com/krt/sun/repository/question/QuestionBlockRepository.java create mode 100644 src/main/java/com/krt/sun/repository/question/QuestionBolckOptionRepository.java create mode 100644 src/main/java/com/krt/sun/repository/question/QuestionLabelRepository.java create mode 100644 src/main/java/com/krt/sun/repository/question/QuestionLogicRepository.java create mode 100644 src/main/java/com/krt/sun/repository/question/QuestionOptionRepository.java create mode 100644 src/main/java/com/krt/sun/repository/question/QuestionRepository.java create mode 100644 src/main/java/com/krt/sun/repository/quota/QuotaCellRepository.java create mode 100644 src/main/java/com/krt/sun/repository/quota/QuotaQueryRepository.java create mode 100644 src/main/java/com/krt/sun/repository/quota/QuotaRepository.java create mode 100644 src/main/java/com/krt/sun/repository/survey/SurveyDataQueryRepository.java create mode 100644 src/main/java/com/krt/sun/repository/survey/SurveyDataRepository.java create mode 100644 src/main/java/com/krt/sun/repository/survey/SurveyRespondentRepository.java create mode 100644 src/main/java/com/krt/sun/service/CapiService.java create mode 100644 src/main/java/com/krt/sun/service/HardCodeService.java create mode 100644 src/main/java/com/krt/sun/service/IpAccessControlService.java create mode 100644 src/main/java/com/krt/sun/service/ProjectService.java create mode 100644 src/main/java/com/krt/sun/service/QuestionService.java create mode 100644 src/main/java/com/krt/sun/service/SurveyService.java create mode 100644 src/main/java/com/krt/sun/util/Common.java create mode 100644 src/main/java/com/krt/sun/util/FixedPanelRedirect.java create mode 100644 src/main/java/com/krt/sun/util/IpUtil.java create mode 100644 src/main/java/com/krt/sun/util/RegexLabel.java create mode 100644 src/main/java/com/krt/sun/util/RegexLogic.java create mode 100644 src/main/java/com/krt/sun/util/SecurityUtil.java create mode 100644 src/main/resources/application.properties create mode 100644 src/test/java/com/krt/sun/SunApplicationTests.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/build.gradle b/build.gradle new file mode 100644 index 0000000..a559078 --- /dev/null +++ b/build.gradle @@ -0,0 +1,60 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '3.1.3' + id 'io.spring.dependency-management' version '1.1.3' +} + +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' + + 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' + + //GSON + implementation 'com.google.code.gson:gson:2.10.1' + + //SpringBoot 3.x버전 이상에서는 gradle openapi starter-webmvc 붙은걸로 써야 함 + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' + + // ⭐ 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 --- + + //FileUpload + implementation 'commons-io:commons-io:2.11.0' /* Apache commons-io */ + implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.4' /* Apache Commons FileUpload */ + + //javascript engine + implementation 'org.graalvm.js:js:21.3.0' // GraalVM 버전에 맞춰 조정 + implementation 'org.graalvm.js:js-scriptengine:21.3.0' // GraalVM 버전에 맞춰 조정 +} + +tasks.named('test') { + useJUnitPlatform() +} 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*)_^Ai@Cv-dF&(vnudG?0CsddG_&Wtae(n|K59ew)6St z#dj7_(Cfwzh$H$5M!$UDd8=4>IQsD3xV=lXUq($;(h*$0^yd+b{qq63f0r_de#!o_ zXDngc>zy`uor)4A^2M#U*DC~i+dc<)Tb1Tv&~Ev@oM)5iJ4Sn#8iRw16XXuV50BS7 zdBL5Mefch(&^{luE{*5qtCZk$oFr3RH=H!c3wGR=HJ(yKc_re_X9pD` zJ;uxPzUfVpgU>DSq?J;I@a+10l0ONXPcDkiYcihREt5~T5Gb}sT0+6Q;AWHl`S5dV>lv%-p9l#xNNy7ZCr%cyqHY%TZ8Q4 zbp&#ov1*$#grNG#1vgfFOLJCaNG@K|2!W&HSh@3@Y%T?3YI75bJp!VP*$*!< z;(ffNS_;@RJ`=c7yX04!u3JP*<8jeqLHVJu#WV&v6wA!OYJS4h<_}^QI&97-;=ojW zQ-1t)7wnxG*5I%U4)9$wlv5Fr;cIizft@&N+32O%B{R1POm$oap@&f| zh+5J{>U6ftv|vAeKGc|zC=kO(+l7_cLpV}-D#oUltScw})N>~JOZLU_0{Ka2e1evz z{^a*ZrLr+JUj;)K&u2CoCAXLC2=fVScI(m_p~0FmF>>&3DHziouln?;sxW`NB}cSX z8?IsJB)Z=aYRz!X=yJn$kyOWK%rCYf-YarNqKzmWu$ZvkP12b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WOUE(7e4$ z^L8f;F)__d3>&KQFE8%$I4h^y5FYBfB&fWzn71_OSrPe-DHV{O#Q;GP z+Tw!J?eVjX19RKH?*hKQWQt8r7B#lYX8xoSHFGCW-*DSQ4EM4M3Mw%gkSYNK18@(e zfzMF}WWaCyS@1y%-~Xg0ry~tkQkUmKuI5lGAua{{vn22V!2T()AU5FpKh@Nv)s^Js zv~@VuUG;=CnLmQR{PeUBQf2;lAV!vG>^Z0N zL88rrjL-*J!43;7C=w9xhcw`yjRKq7o4L9=0SmR9PA-nX12@#h(iIu-0N_xm2OV)( zU_raT0y>$wm^oMi2|U3N;OhF9uy}`<-xVka#DV*l{O0yHzi9vUxa1Qtpi$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/opt/kric_com.pfx b/opt/kric_com.pfx new file mode 100644 index 0000000000000000000000000000000000000000..4047dbe1274376d13472a1de7ffe3a4dabcbc0c2 GIT binary patch literal 3205 zcmY+FWmFT4--cmqlNgiUL^=kF!iEE-QyfT&go1P<6G3T-0n&|hDhSfugCV1o7#*V| z1W7SKLD=8tod5ei@B86*e&<~GIrqo=LgFAH0BRZ}4sr)fcl9OatLJdYjfwZ50mh%t<9NGW?TB=|i zxZpX{WzxEeh?{lt*c{@8+mdU+u`Y`z>Jowsew(xU*3Y7-CYzS|`@mI%zIx~v!~UL+ zeGq~DN+)%^?gI-iTr>hdk)Q!R-@D-{H@f?WMs2I9v_aZz)~bWo%QDwbN!|^qu^W86 zM1?wdlxUK^vWX^N4B03=G68*6Uu{vflJA{?GAnx%p;P7&FE{|Y%Pt1qNpSv<8%cQ4 zhkTLx6em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Z0k22GXjQO;7IJKZ5_WlK%mRh5MHP literal 0 HcmV?d00001 diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..054beaf --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'sun' diff --git a/src/main/java/com/krt/sun/Interceptor/IpAccessControlInterceptor.java b/src/main/java/com/krt/sun/Interceptor/IpAccessControlInterceptor.java new file mode 100644 index 0000000..dbfa725 --- /dev/null +++ b/src/main/java/com/krt/sun/Interceptor/IpAccessControlInterceptor.java @@ -0,0 +1,27 @@ +package com.krt.sun.Interceptor; + +import com.krt.sun.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; +import com.krt.sun.service.IpAccessControlService; + +@RequiredArgsConstructor +@Component +public class IpAccessControlInterceptor implements HandlerInterceptor { + private final IpAccessControlService ipAccessControlService; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + + 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/sun/SunApplication.java b/src/main/java/com/krt/sun/SunApplication.java new file mode 100644 index 0000000..c4b4655 --- /dev/null +++ b/src/main/java/com/krt/sun/SunApplication.java @@ -0,0 +1,19 @@ +package com.krt.sun; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.web.filter.HiddenHttpMethodFilter; + +@SpringBootApplication +public class SunApplication { + + public static void main(String[] args) { + SpringApplication.run(SunApplication.class, args); + } + + @Bean + public HiddenHttpMethodFilter hiddenHttpMethodFilter() { + return new HiddenHttpMethodFilter(); + } +} diff --git a/src/main/java/com/krt/sun/config/QueryDslConfig.java b/src/main/java/com/krt/sun/config/QueryDslConfig.java new file mode 100644 index 0000000..2485a07 --- /dev/null +++ b/src/main/java/com/krt/sun/config/QueryDslConfig.java @@ -0,0 +1,20 @@ +package com.krt.sun.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/sun/config/SecurityConfig.java b/src/main/java/com/krt/sun/config/SecurityConfig.java new file mode 100644 index 0000000..865ed37 --- /dev/null +++ b/src/main/java/com/krt/sun/config/SecurityConfig.java @@ -0,0 +1,37 @@ +package com.krt.sun.config; + +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.web.SecurityFilterChain; + +@Configuration +@EnableWebSecurity +@RequiredArgsConstructor +public class SecurityConfig { + @Bean + public WebSecurityCustomizer webSecurityCustomizer() { + return (web) -> web.ignoring().requestMatchers("/v2/api-docs", "/configuration/ui", + "/swagger-resources/**", "/configuration/security", + "/webjars/**","/swagger/**", "/"); + } + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http + .httpBasic(HttpBasicConfigurer::disable) + .csrf(AbstractHttpConfigurer::disable) + .cors(Customizer.withDefaults()) + .sessionManagement((sessionManagement) -> + sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS) + ); + return http.build(); + } +} diff --git a/src/main/java/com/krt/sun/config/SwaggerConfig.java b/src/main/java/com/krt/sun/config/SwaggerConfig.java new file mode 100644 index 0000000..6abf618 --- /dev/null +++ b/src/main/java/com/krt/sun/config/SwaggerConfig.java @@ -0,0 +1,26 @@ +package com.krt.sun.config; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.servers.Server; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class SwaggerConfig { + @Bean + public OpenAPI newSsakOpenAPI() { + Info info = new Info() + .version("v1.0.0") + .title("새싹 햇님 API") + .description("새싹 설문진행 로직과 관련된 API"); + + /* + Components components = new Components(); + */ + return new OpenAPI() + .info(info) + .addServersItem(new Server().url("/")); + //.components(components); + } +} diff --git a/src/main/java/com/krt/sun/config/WebConfig.java b/src/main/java/com/krt/sun/config/WebConfig.java new file mode 100644 index 0000000..d48e9f7 --- /dev/null +++ b/src/main/java/com/krt/sun/config/WebConfig.java @@ -0,0 +1,33 @@ +package com.krt.sun.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.sun.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/sun/controller/CapiController.java b/src/main/java/com/krt/sun/controller/CapiController.java new file mode 100644 index 0000000..147e94b --- /dev/null +++ b/src/main/java/com/krt/sun/controller/CapiController.java @@ -0,0 +1,84 @@ +package com.krt.sun.controller; + +import com.krt.sun.dto.capi.*; +import com.krt.sun.dto.project.response.ProjectDto; +import com.krt.sun.service.CapiService; +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 = "Capi", description = "면접원 API") +@RestController +@RequestMapping("api/v1/capi") +@RequiredArgsConstructor +public class CapiController { + + private final CapiService capiService; + + @Operation(summary = "면접원 로그인") + @PostMapping("/capiLogin") + public ResponseEntity capiLogin(@RequestBody CapiLoginRequestDto capiLoginRequestDto) { + + CapiLoginResponseDto capiInfo = capiService.capiLogin(capiLoginRequestDto); + + return ResponseEntity.ok(capiInfo); + } + + @Operation(summary = "면접원별 프로젝트 리스트 불러오기", description = "면접원별 프로젝트 리스트 불러오기") + @PostMapping("/getProjectList") + public ResponseEntity getProjectList(@RequestBody GetInterviewerAssignProjectRequestDto getInterviewerAssignProjectRequestDto){ + + List projectDtoList = capiService.getProjectList(getInterviewerAssignProjectRequestDto); + + return ResponseEntity.ok(projectDtoList); + } + + @Operation(summary = "면접원 개인별 현황", description = "상태별 카운트 / 진행 데이터 조회") + @PostMapping("/getInterviewerSurveyDetail") + public ResponseEntity getInterviewerSurveyDetail(@RequestBody GetInterviewerSurveyDetailRequestDto getInterviewerSurveyDetailRequestDto) throws Exception { + + return ResponseEntity.ok(capiService.getInterviewerSurveyDetail(getInterviewerSurveyDetailRequestDto)); + } + + @Operation(summary = "면접원 데이터 삭제 요청", description = "면접원 데이터 삭제 요청") + @PostMapping("/surveyDataDeleteRequest") + public ResponseEntity surveyDataDeleteRequest(@RequestBody DeleteSurveyDataRequestDto deleteSurveyDataRequestDto) throws Exception { + + capiService.surveyDataDeleteRequest(deleteSurveyDataRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "면접원 데이터 삭제 요청취소", description = "면접원 데이터 삭제 요청취소") + @PostMapping("/surveyDataDeleteCancel") + public ResponseEntity surveyDataDeleteCancel(@RequestBody SurveyDataDeleteCancelRequestDto surveyDataDeleteCancelRequestDto) throws Exception { + + capiService.surveyDataDeleteCancel(surveyDataDeleteCancelRequestDto); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "할당된 프로젝트 쿼터 현황", description = "쿼터 있을 시, 개인별 쿼터 보여주기") + @GetMapping("/getProgressQuota") + public ResponseEntity getProgressQuota(@Parameter(name = "project_code") String project_code) throws Exception { + + capiService.getProgressQuota(project_code); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "재진행 데이터 초기화", description = "재진행 데이터 초기화") + @PostMapping("/setDataRestart") + public ResponseEntity setDataRestart(@RequestBody GetRestartDataRequestDto getRestartDataRequestDto) throws Exception { + + capiService.setDataRestart(getRestartDataRequestDto); + + return ResponseEntity.ok(true); + } + +} diff --git a/src/main/java/com/krt/sun/controller/HardCodeController.java b/src/main/java/com/krt/sun/controller/HardCodeController.java new file mode 100644 index 0000000..54233e3 --- /dev/null +++ b/src/main/java/com/krt/sun/controller/HardCodeController.java @@ -0,0 +1,52 @@ +package com.krt.sun.controller; + +import com.krt.sun.dto.hardcode.AnswerUserInfoDto; +import com.krt.sun.dto.hardcode.HardCodeDto; +import com.krt.sun.dto.hardcode.HardCodeRequestInfoDto; +import com.krt.sun.dto.survey.response.SurveyDataStructureDto; +import com.krt.sun.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.*; + +import java.util.List; +import java.util.Set; + +@Tag(name = "HardCode", description = "하드코딩 API") +@RestController +@RequestMapping("api/v1/hardcode") +@RequiredArgsConstructor +public class HardCodeController { + + private final HardCodeService hardCodeService; + + @Operation(summary = "하드코딩 가져오기") + @PostMapping("/getHardCode") + public ResponseEntity getHardCode(@RequestBody HardCodeRequestInfoDto hardCodeRequestInfoDto) throws Exception { + HardCodeDto hardCodeDto = hardCodeService.getHardCode(hardCodeRequestInfoDto); + + return ResponseEntity.ok(hardCodeDto); + } + + @Operation(summary = "응답값 가져오기", description = "함수") + @PostMapping("/getValue") + public ResponseEntity getValue(@RequestBody AnswerUserInfoDto answerUserInfoDto) throws Exception { + + List answerDataList = hardCodeService.getValue(answerUserInfoDto); + + return ResponseEntity.ok(answerDataList); + } + + @Operation(summary = "응답값(라벨명) 가져오기", description = "함수") + @PostMapping("/getLabel") + public ResponseEntity getLabel(@RequestBody AnswerUserInfoDto answerUserInfoDto) throws Exception { + + Set answerLabelList = hardCodeService.getLabel(answerUserInfoDto); + + return ResponseEntity.ok(answerLabelList); + } + + +} diff --git a/src/main/java/com/krt/sun/controller/ProjectController.java b/src/main/java/com/krt/sun/controller/ProjectController.java new file mode 100644 index 0000000..174dfc6 --- /dev/null +++ b/src/main/java/com/krt/sun/controller/ProjectController.java @@ -0,0 +1,57 @@ +package com.krt.sun.controller; + +import com.krt.sun.dto.project.response.ProjectOptionDto; +import com.krt.sun.dto.project.response.ProjectSurveyInfoDto; +import com.krt.sun.service.ProjectService; +import com.krt.sun.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.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +@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("/getSurveyInfo") + public ResponseEntity getSurveyInfo(@Parameter(name = "security_code") String security_code) throws Exception { + String projectCode = SecurityUtil.decrypt(URLDecoder.decode(security_code, StandardCharsets.UTF_8)); + ProjectSurveyInfoDto projectSurveyInfoDto = projectService.getSurveyInfo(projectCode); + + return ResponseEntity.ok(projectSurveyInfoDto); + } + + @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 = "프로젝트 응답 옵션 불러오기") + @GetMapping("/getResponse") + public ResponseEntity getProjectResponse(@Parameter(name = "project_code") String project_code){ + ProjectOptionDto projectOptionDto = projectService.getProjectResponse(project_code); + return ResponseEntity.ok(projectOptionDto); + } + +} diff --git a/src/main/java/com/krt/sun/controller/QuestionController.java b/src/main/java/com/krt/sun/controller/QuestionController.java new file mode 100644 index 0000000..3cda9cd --- /dev/null +++ b/src/main/java/com/krt/sun/controller/QuestionController.java @@ -0,0 +1,54 @@ +package com.krt.sun.controller; + +import com.krt.sun.dto.question.response.QuestionInfoDto; +import com.krt.sun.dto.question.response.QuestionNavigationDto; +import com.krt.sun.service.QuestionService; +import com.krt.sun.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.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.List; + +@Tag(name = "Question", description = "문항 API") +@RestController +@RequestMapping("api/v1/question") +@RequiredArgsConstructor +public class QuestionController { + private final QuestionService questionService; + + @Operation(summary = "문항 List 가져오기") + @GetMapping("/getQuestionList") + public ResponseEntity getQuestionList(@Parameter(name = "security_code") String security_code) throws Exception { + String projectCode = SecurityUtil.decrypt(URLDecoder.decode(security_code, StandardCharsets.UTF_8)); + + List questionInfoList = questionService.getQuestionInfoList(projectCode); + + return ResponseEntity.ok(questionInfoList); + } + + @Operation(summary = "문항정보 가져오기") + @GetMapping("/getQuestionInfo") + public ResponseEntity getQuestionInfo(@Parameter(name = "security_code") String security_code, @Parameter(name = "question_unique_key") int question_unique_key) throws Exception { + String projectCode = SecurityUtil.decrypt(URLDecoder.decode(security_code, StandardCharsets.UTF_8)); + + List questionInfoList = questionService.getQuestionInfo(projectCode, question_unique_key); + + return ResponseEntity.ok(questionInfoList); + } + + @Operation(summary = "Test용 데이터와 문항 리스트 가져오기") + @GetMapping("/getQuestionNavigation") + public ResponseEntity getQuestionNavigation(@Parameter(name = "security_code") String security_code) throws Exception { + String projectCode = SecurityUtil.decrypt(URLDecoder.decode(security_code, StandardCharsets.UTF_8)); + + List questionNavigationList = questionService.getQuestionNavigation(projectCode); + + return ResponseEntity.ok(questionNavigationList); + } +} diff --git a/src/main/java/com/krt/sun/controller/SurveyController.java b/src/main/java/com/krt/sun/controller/SurveyController.java new file mode 100644 index 0000000..06ae0c1 --- /dev/null +++ b/src/main/java/com/krt/sun/controller/SurveyController.java @@ -0,0 +1,119 @@ +package com.krt.sun.controller; + +import com.krt.sun.dto.list.ListContentGetResponseDto; +import com.krt.sun.dto.question.response.QuestionInfoDto; +import com.krt.sun.dto.survey.common.SurveyInfo; +import com.krt.sun.dto.survey.request.DataSaveDto; +import com.krt.sun.dto.survey.request.GangLoginRequestDto; +import com.krt.sun.dto.survey.request.IndexParameterDto; +import com.krt.sun.dto.survey.response.*; +import com.krt.sun.service.SurveyService; +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.*; + +import java.util.List; + +@Tag(name = "Survey", description = "설문진행 API") +@RestController +@RequestMapping("api/v1/survey") +@RequiredArgsConstructor +public class SurveyController { + private final SurveyService surveyService; + + @Operation(summary = "INDEX 페이지 가져오기") + @GetMapping("/getIndexPage") + public ResponseEntity getIndexPage(SurveyInfo SurveyInfo) throws Exception{ + + IndexFormSetupDto indexPageInfo = surveyService.getIndexPage(SurveyInfo); + + return ResponseEntity.ok(indexPageInfo); + } + + @Operation(summary = "설문 진입") + @PostMapping("/getStartSurvey") + public ResponseEntity getStartQuestion(@RequestBody IndexParameterDto indexParameterDto) throws Exception { + + SurveyFormSetupDto startQuestionInfo = surveyService.startSurvey(indexParameterDto); + + return ResponseEntity.ok(startQuestionInfo); + } + + @Operation(summary = "응답 데이터 검증") + @PostMapping("/doSurveyDataVerify") + public ResponseEntity surveyDataVerify(@RequestBody List dataSaveDtoList) throws Exception{ + + //옵션 검증 + boolean optionVerifyFlag = surveyService.surveyDataVerify(dataSaveDtoList); + + //Numeric 검증 + boolean numericVerifyFlag = surveyService.numericVerify(dataSaveDtoList); + + return ResponseEntity.ok(true); + } + + @Operation(summary = "응답 데이터 저장") + @PostMapping("/setSaveData") + public ResponseEntity saveSurveyData(@RequestBody List dataSaveDtoList) throws Exception { + + SurveyFormSetupDto nextQuestionInfo = surveyService.saveSurveyData(dataSaveDtoList); + + return ResponseEntity.ok(nextQuestionInfo); + } + + @Operation(summary = "설문 진행용 문항정보 가져오기") + @GetMapping("/getQuestionInfo") + public ResponseEntity getQuestionInfo(SurveyInfo SurveyInfo) throws Exception { + + List questionInfoList = surveyService.getQuestionInfo(SurveyInfo); + + return ResponseEntity.ok(questionInfoList); + } + + @Operation(summary = "오토 체크 값 가져오기") + @GetMapping("/getAutoCheckAnswerData") + public ResponseEntity getAutoCheckAnswerData(SurveyInfo SurveyInfo) throws Exception { + + List dataList = surveyService.getAutoCheckAnswerData(SurveyInfo); + + return ResponseEntity.ok(dataList); + } + +// @Operation(summary = "응답값 리스트 가져오기") +// @GetMapping("/getSavedDataList") +// public ResponseEntity getSavedDataList(SurveyInfo SurveyInfo) throws Exception { +// +// List savedDataList = surveyService.getSavedDataList(SurveyInfo); +// +// return ResponseEntity.ok(savedDataList); +// } + + @Operation(summary = "리다이렉트 URL 가져오기") + @PostMapping("/getRedirectUrl") + public ResponseEntity getRedirectUrl(@RequestBody SurveyInfo surveyInfo) throws Exception { + + String redirectUrl = surveyService.getRedirectUrl(surveyInfo); + + return ResponseEntity.ok(redirectUrl); + } + + @Operation(summary = "응답값 라벨 리스트 가져오기") + @GetMapping("/getSavedDataLabelList") + public ResponseEntity getSavedDataLabelList(SurveyInfo SurveyInfo) throws Exception { + + List savedDataLabelList = surveyService.getSavedDataLabelList(SurveyInfo); + + return ResponseEntity.ok(savedDataLabelList); + } + + @Operation(summary = "Gang 로그인") + @PostMapping("/gangLogin") + public ResponseEntity gangLogin(@RequestBody GangLoginRequestDto gangLoginRequestDto) throws Exception { + + ListContentGetResponseDto listInfo = surveyService.gangLogin(gangLoginRequestDto); + + return ResponseEntity.ok(listInfo); + } +} diff --git a/src/main/java/com/krt/sun/dto/capi/CapiLoginRequestDto.java b/src/main/java/com/krt/sun/dto/capi/CapiLoginRequestDto.java new file mode 100644 index 0000000..bfe6095 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/capi/CapiLoginRequestDto.java @@ -0,0 +1,13 @@ +package com.krt.sun.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CapiLoginRequestDto { + private String loginId; + private String loginPwd; +} diff --git a/src/main/java/com/krt/sun/dto/capi/CapiLoginResponseDto.java b/src/main/java/com/krt/sun/dto/capi/CapiLoginResponseDto.java new file mode 100644 index 0000000..282ad50 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/capi/CapiLoginResponseDto.java @@ -0,0 +1,25 @@ +package com.krt.sun.dto.capi; + +import com.krt.sun.entity.capi.InterviewerInfoEntity; +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CapiLoginResponseDto { + private String code; + private String loginId; + private String name; + private String info; + + public static CapiLoginResponseDto of(InterviewerInfoEntity interviewerInfoEntity){ + return CapiLoginResponseDto.builder() + .code(interviewerInfoEntity.getCode()) + .loginId(interviewerInfoEntity.getInterviewerId()) + .name(interviewerInfoEntity.getInterviewerName()) + .info(interviewerInfoEntity.getInterviewerInfo()) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/dto/capi/DeleteSurveyDataRequestDto.java b/src/main/java/com/krt/sun/dto/capi/DeleteSurveyDataRequestDto.java new file mode 100644 index 0000000..5d48805 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/capi/DeleteSurveyDataRequestDto.java @@ -0,0 +1,16 @@ +package com.krt.sun.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/sun/dto/capi/GetInterviewerAssignProjectRequestDto.java b/src/main/java/com/krt/sun/dto/capi/GetInterviewerAssignProjectRequestDto.java new file mode 100644 index 0000000..c80e03e --- /dev/null +++ b/src/main/java/com/krt/sun/dto/capi/GetInterviewerAssignProjectRequestDto.java @@ -0,0 +1,12 @@ +package com.krt.sun.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetInterviewerAssignProjectRequestDto { + private String interviewerCode; +} diff --git a/src/main/java/com/krt/sun/dto/capi/GetInterviewerSurveyDetailRequestDto.java b/src/main/java/com/krt/sun/dto/capi/GetInterviewerSurveyDetailRequestDto.java new file mode 100644 index 0000000..53f779a --- /dev/null +++ b/src/main/java/com/krt/sun/dto/capi/GetInterviewerSurveyDetailRequestDto.java @@ -0,0 +1,13 @@ +package com.krt.sun.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetInterviewerSurveyDetailRequestDto { + private String projectCode; + private String interviewerId; +} diff --git a/src/main/java/com/krt/sun/dto/capi/GetRestartDataRequestDto.java b/src/main/java/com/krt/sun/dto/capi/GetRestartDataRequestDto.java new file mode 100644 index 0000000..8418bf4 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/capi/GetRestartDataRequestDto.java @@ -0,0 +1,13 @@ +package com.krt.sun.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GetRestartDataRequestDto { + private String projectCode; + private String answerId; +} diff --git a/src/main/java/com/krt/sun/dto/capi/GetSurveyDetailResponseDto.java b/src/main/java/com/krt/sun/dto/capi/GetSurveyDetailResponseDto.java new file mode 100644 index 0000000..084cf87 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/capi/GetSurveyDetailResponseDto.java @@ -0,0 +1,32 @@ +package com.krt.sun.dto.capi; + +import com.krt.sun.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 int answerEndQuestionUniqueKey; + private String answerEndQuestionId; + private String answerEndDate; + private int deleteRequest; + + public static GetSurveyDetailResponseDto of(SurveyRespondentEntity surveyRespondentEntity){ + return GetSurveyDetailResponseDto.builder() + .projectCode(surveyRespondentEntity.getProjectCode()) + .answerId(surveyRespondentEntity.getAnswerId()) + .surveyTypeCode(surveyRespondentEntity.getSurveyTypeCode()) + .answerState(surveyRespondentEntity.getAnswerState()) + .answerStartDate(surveyRespondentEntity.getAnswerStartDate()) + .answerEndDate(surveyRespondentEntity.getAnswerEndDate()) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/dto/capi/GetSurveyStatusCountResponseDto.java b/src/main/java/com/krt/sun/dto/capi/GetSurveyStatusCountResponseDto.java new file mode 100644 index 0000000..2c085f0 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/capi/GetSurveyStatusCountResponseDto.java @@ -0,0 +1,41 @@ +package com.krt.sun.dto.capi; + +import com.krt.sun.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(GetSurveyDetailResponseDto getSurveyDetailResponseDto : surveyRespondentEntityList){ + switch (getSurveyDetailResponseDto.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/sun/dto/capi/SurveyDataDeleteCancelRequestDto.java b/src/main/java/com/krt/sun/dto/capi/SurveyDataDeleteCancelRequestDto.java new file mode 100644 index 0000000..15070d6 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/capi/SurveyDataDeleteCancelRequestDto.java @@ -0,0 +1,13 @@ +package com.krt.sun.dto.capi; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SurveyDataDeleteCancelRequestDto { + private String projectCode; + private String answerId; +} diff --git a/src/main/java/com/krt/sun/dto/hardcode/AnswerUserInfoDto.java b/src/main/java/com/krt/sun/dto/hardcode/AnswerUserInfoDto.java new file mode 100644 index 0000000..ab286ed --- /dev/null +++ b/src/main/java/com/krt/sun/dto/hardcode/AnswerUserInfoDto.java @@ -0,0 +1,16 @@ +package com.krt.sun.dto.hardcode; + +import lombok.*; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class AnswerUserInfoDto { + private String securityCode; + private String answerId; + private String questionId; + private int questionUniqueKey; + private String questionDimension; +} diff --git a/src/main/java/com/krt/sun/dto/hardcode/HardCodeAndHistoryDto.java b/src/main/java/com/krt/sun/dto/hardcode/HardCodeAndHistoryDto.java new file mode 100644 index 0000000..03480d0 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/hardcode/HardCodeAndHistoryDto.java @@ -0,0 +1,16 @@ +package com.krt.sun.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/sun/dto/hardcode/HardCodeDto.java b/src/main/java/com/krt/sun/dto/hardcode/HardCodeDto.java new file mode 100644 index 0000000..3720bde --- /dev/null +++ b/src/main/java/com/krt/sun/dto/hardcode/HardCodeDto.java @@ -0,0 +1,34 @@ +package com.krt.sun.dto.hardcode; + +import com.krt.sun.entity.hardcode.HardCodeEntity; +import com.krt.sun.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/sun/dto/hardcode/HardCodeHistoryDto.java b/src/main/java/com/krt/sun/dto/hardcode/HardCodeHistoryDto.java new file mode 100644 index 0000000..ad2b867 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/hardcode/HardCodeHistoryDto.java @@ -0,0 +1,42 @@ +package com.krt.sun.dto.hardcode; + +import com.krt.sun.entity.hardcode.HardCodeHistoryEntity; +import com.krt.sun.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/sun/dto/hardcode/HardCodeRequestInfoDto.java b/src/main/java/com/krt/sun/dto/hardcode/HardCodeRequestInfoDto.java new file mode 100644 index 0000000..9c2ee98 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/hardcode/HardCodeRequestInfoDto.java @@ -0,0 +1,14 @@ +package com.krt.sun.dto.hardcode; + +import lombok.*; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class HardCodeRequestInfoDto { + private String securityCode; + private int questionUniqueKey; + private int type; +} diff --git a/src/main/java/com/krt/sun/dto/list/ListContentGetResponseDto.java b/src/main/java/com/krt/sun/dto/list/ListContentGetResponseDto.java new file mode 100644 index 0000000..d2286f9 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/list/ListContentGetResponseDto.java @@ -0,0 +1,34 @@ +package com.krt.sun.dto.list; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.sun.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/sun/dto/parameter/ParameterDto.java b/src/main/java/com/krt/sun/dto/parameter/ParameterDto.java new file mode 100644 index 0000000..25c928d --- /dev/null +++ b/src/main/java/com/krt/sun/dto/parameter/ParameterDto.java @@ -0,0 +1,15 @@ +package com.krt.sun.dto.parameter; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Setter +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class ParameterDto { + private String parameterKey; + private String parameterValue; +} diff --git a/src/main/java/com/krt/sun/dto/project/common/ProjectOptionElementDto.java b/src/main/java/com/krt/sun/dto/project/common/ProjectOptionElementDto.java new file mode 100644 index 0000000..59db199 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/project/common/ProjectOptionElementDto.java @@ -0,0 +1,26 @@ +package com.krt.sun.dto.project.common; + +import com.krt.sun.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 ProjectOptionElementDto { + @Schema(description = "스타일 코드") + private int option_code; + @Schema(description = "스타일 세팅 값") + private String option_value; + + public ProjectOptionElementDto of(ProjectStyleEntity projectStyleEntity){ + return ProjectOptionElementDto.builder() + .option_code(projectStyleEntity.getStyleCode()) + .option_value(projectStyleEntity.getStyleValue()) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/dto/project/response/OptionElementDto.java b/src/main/java/com/krt/sun/dto/project/response/OptionElementDto.java new file mode 100644 index 0000000..004587b --- /dev/null +++ b/src/main/java/com/krt/sun/dto/project/response/OptionElementDto.java @@ -0,0 +1,34 @@ +package com.krt.sun.dto.project.response; + +import com.krt.sun.entity.project.ProjectResponseEntity; +import com.krt.sun.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/sun/dto/project/response/ProjectDto.java b/src/main/java/com/krt/sun/dto/project/response/ProjectDto.java new file mode 100644 index 0000000..61acabb --- /dev/null +++ b/src/main/java/com/krt/sun/dto/project/response/ProjectDto.java @@ -0,0 +1,45 @@ +package com.krt.sun.dto.project.response; + +import com.krt.sun.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/sun/dto/project/response/ProjectOptionDto.java b/src/main/java/com/krt/sun/dto/project/response/ProjectOptionDto.java new file mode 100644 index 0000000..9a0d692 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/project/response/ProjectOptionDto.java @@ -0,0 +1,21 @@ +package com.krt.sun.dto.project.response; + +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/sun/dto/project/response/ProjectSurveyInfoDto.java b/src/main/java/com/krt/sun/dto/project/response/ProjectSurveyInfoDto.java new file mode 100644 index 0000000..8f2bf56 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/project/response/ProjectSurveyInfoDto.java @@ -0,0 +1,56 @@ +package com.krt.sun.dto.project.response; + +import com.krt.sun.dto.project.common.ProjectOptionElementDto; +import com.krt.sun.entity.project.ProjectParameterEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@ToString +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProjectSurveyInfoDto { + + @Schema(description = "프로젝트 코드") + private String project_code; + + @Schema(description = "설문타이틀") + private String survey_title; + + @Schema(description = "프로젝트 상태") + private int status; + + @Schema(description = "회사 코드") + private int company; + + @Schema(description = "뒤로가기 허용 여부") + private boolean accept_back; + + @Schema(description = "파라미터명") + private List parameter_list; + + @Schema(description = "허용 디바이스") + private List accept_device; + + @Schema(description = "프로젝트 스타일") + private List style_list; + + + + public static ProjectSurveyInfoDto of(String projectCode, String surveyTitle, int status, int company, boolean acceptBack, ListparameterList, List projectAcceptDevice, List projectStyleList){ + return ProjectSurveyInfoDto.builder() + .project_code(projectCode) + .survey_title(surveyTitle) + .status(status) + .company(company) + .accept_back(acceptBack) + .parameter_list(parameterList) + .accept_device(projectAcceptDevice) + .style_list(projectStyleList) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/dto/question/common/QuestionLogicJsonDto.java b/src/main/java/com/krt/sun/dto/question/common/QuestionLogicJsonDto.java new file mode 100644 index 0000000..0741317 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/question/common/QuestionLogicJsonDto.java @@ -0,0 +1,14 @@ +package com.krt.sun.dto.question.common; + +import com.krt.sun.entity.question.QuestionLogicEntity; +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionLogicJsonDto { + public String logic; + public String page; +} diff --git a/src/main/java/com/krt/sun/dto/question/common/QuestionOptionValueJsonDto.java b/src/main/java/com/krt/sun/dto/question/common/QuestionOptionValueJsonDto.java new file mode 100644 index 0000000..b039d12 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/question/common/QuestionOptionValueJsonDto.java @@ -0,0 +1,14 @@ +package com.krt.sun.dto.question.common; + +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/sun/dto/question/label/QuestionLabelInfoDto.java b/src/main/java/com/krt/sun/dto/question/label/QuestionLabelInfoDto.java new file mode 100644 index 0000000..7adbf34 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/question/label/QuestionLabelInfoDto.java @@ -0,0 +1,27 @@ +package com.krt.sun.dto.question.label; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter @Setter +@NoArgsConstructor +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/sun/dto/question/label/QuestionLabelJsonDto.java b/src/main/java/com/krt/sun/dto/question/label/QuestionLabelJsonDto.java new file mode 100644 index 0000000..37d3c3d --- /dev/null +++ b/src/main/java/com/krt/sun/dto/question/label/QuestionLabelJsonDto.java @@ -0,0 +1,21 @@ +package com.krt.sun.dto.question.label; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +import java.util.List; + +@Getter @Setter +@ToString +@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/sun/dto/question/label/QuestionLabelOptionApplyDto.java b/src/main/java/com/krt/sun/dto/question/label/QuestionLabelOptionApplyDto.java new file mode 100644 index 0000000..2551586 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/question/label/QuestionLabelOptionApplyDto.java @@ -0,0 +1,28 @@ +package com.krt.sun.dto.question.label; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.util.List; + +@Getter @Setter +@ToString +@Builder +public class QuestionLabelOptionApplyDto { + private String project_code; + private String answerId; + private String accept_question; + private String except_question; + private List label_info; + + public QuestionLabelOptionApplyDto(String project_code, String answerId, String accept_question, String except_question, List label_info) { + this.project_code = project_code; + this.answerId = answerId; + this.accept_question = accept_question; + this.except_question = except_question; + this.label_info = label_info; + } + +} diff --git a/src/main/java/com/krt/sun/dto/question/label/QuestionLabelOptionDto.java b/src/main/java/com/krt/sun/dto/question/label/QuestionLabelOptionDto.java new file mode 100644 index 0000000..d586d12 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/question/label/QuestionLabelOptionDto.java @@ -0,0 +1,31 @@ +package com.krt.sun.dto.question.label; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.sun.entity.question.QuestionLabelEntity; +import lombok.*; + +import java.lang.reflect.Type; +import java.util.List; + +@Getter @Setter +@ToString +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionLabelOptionDto { + private String accept_question = ""; + private String except_question = ""; + private int use_rotation = 0; + private QuestionLabelRotationDto rotation_info = null; + + public QuestionLabelOptionDto of(QuestionLabelEntity questionLabelEntity){ + Gson gson = new Gson(); + Type entityType = new TypeToken(){}.getType(); + if(questionLabelEntity == null || gson.fromJson(questionLabelEntity.getLabelOption(), entityType) == null){ + return new QuestionLabelOptionDto(); + }else{ + return gson.fromJson(questionLabelEntity.getLabelOption(), entityType); + } + } +} diff --git a/src/main/java/com/krt/sun/dto/question/label/QuestionLabelRotationDto.java b/src/main/java/com/krt/sun/dto/question/label/QuestionLabelRotationDto.java new file mode 100644 index 0000000..bfee7b4 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/question/label/QuestionLabelRotationDto.java @@ -0,0 +1,15 @@ +package com.krt.sun.dto.question.label; + +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/sun/dto/question/response/QuestionInfoDto.java b/src/main/java/com/krt/sun/dto/question/response/QuestionInfoDto.java new file mode 100644 index 0000000..7530dfa --- /dev/null +++ b/src/main/java/com/krt/sun/dto/question/response/QuestionInfoDto.java @@ -0,0 +1,63 @@ +package com.krt.sun.dto.question.response; + +import com.krt.sun.dto.question.common.QuestionOptionValueJsonDto; +import com.krt.sun.dto.question.label.QuestionLabelJsonDto; +import com.krt.sun.entity.question.QuestionEntity; +import lombok.*; + +import java.util.ArrayList; +import java.util.List; + +@Getter @Setter +@ToString +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionInfoDto { + private int question_unique_key; + private int question_order; + private String question_id; + private String question_name; + private int question_dimension; + private int auto_type; + private int question_type; + private String question_title; + private String question_description; + private List question_option; + private List question_block_option; + private String question_hardcode; + private QuestionLabelJsonDto scalar_label; + private QuestionLabelJsonDto matrix_label; + private QuestionLabelJsonDto tensor_label; + private int block_id; + private int loop_id; + + public static QuestionInfoDto of(QuestionEntity questionEntity){ + int questionType = questionEntity.getQuestionType(); + int autoType = 0; + + if(questionType > 100){ + autoType = questionType / 100; + questionType = questionType % 100; + } + + return QuestionInfoDto.builder() + .question_unique_key(questionEntity.getQuestionUniqueKey()) + .question_order(questionEntity.getQuestionOrder()) + .question_id(questionEntity.getQuestionID()) + .question_name(questionEntity.getQuestionName()) + .question_dimension(questionEntity.getQuestionDimension()) + .auto_type(autoType) + .question_type(questionType) + .question_title(questionEntity.getQuestionTitle()) + .question_description(questionEntity.getQuestionDescription()) + .question_option(new ArrayList<>()) + .question_block_option(new ArrayList<>()) + .question_hardcode("") + .scalar_label(null) + .matrix_label(null) + .tensor_label(null) + .block_id(0) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/dto/question/response/QuestionNavigationDto.java b/src/main/java/com/krt/sun/dto/question/response/QuestionNavigationDto.java new file mode 100644 index 0000000..2166e86 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/question/response/QuestionNavigationDto.java @@ -0,0 +1,36 @@ +package com.krt.sun.dto.question.response; + +import com.krt.sun.dto.question.common.QuestionLogicJsonDto; +import com.krt.sun.entity.question.QuestionEntity; +import lombok.*; + +import java.util.List; + +@Getter @Setter +@ToString +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionNavigationDto { + private int question_unique_key; + private int question_order; + private int progress_percent; + private String question_id; + private String question_name; + private String block_id; + private List before_logic; + private List after_logic; + + public static QuestionNavigationDto of(QuestionEntity questionEntity){ + return QuestionNavigationDto.builder() + .question_unique_key(questionEntity.getQuestionUniqueKey()) + .question_order(questionEntity.getQuestionOrder()) + .progress_percent(questionEntity.getQuestionOrder()) + .question_id(questionEntity.getQuestionID()) + .question_name(questionEntity.getQuestionName()) + .block_id("") + .before_logic(null) + .after_logic(null) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/dto/question/response/QuestionOptionDto.java b/src/main/java/com/krt/sun/dto/question/response/QuestionOptionDto.java new file mode 100644 index 0000000..c8b0008 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/question/response/QuestionOptionDto.java @@ -0,0 +1,23 @@ +package com.krt.sun.dto.question.response; + +import lombok.*; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class QuestionOptionDto { + private String option_code; + private String type_code; + private String detail_code; + private String value; + + public String getTypeTotalCode() { + return option_code + type_code + detail_code; + } + + public String getTotalCode() { + return option_code + type_code + detail_code + "||" + value; + } +} diff --git a/src/main/java/com/krt/sun/dto/quota/QuotaCellDto.java b/src/main/java/com/krt/sun/dto/quota/QuotaCellDto.java new file mode 100644 index 0000000..bbf5531 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/quota/QuotaCellDto.java @@ -0,0 +1,35 @@ +package com.krt.sun.dto.quota; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.sun.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/sun/dto/quota/QuotaCellJsonDto.java b/src/main/java/com/krt/sun/dto/quota/QuotaCellJsonDto.java new file mode 100644 index 0000000..b358d23 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/quota/QuotaCellJsonDto.java @@ -0,0 +1,15 @@ +package com.krt.sun.dto.quota; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class QuotaCellJsonDto { + private int quk; + private int val; +} diff --git a/src/main/java/com/krt/sun/dto/quota/QuotaListDto.java b/src/main/java/com/krt/sun/dto/quota/QuotaListDto.java new file mode 100644 index 0000000..735e021 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/quota/QuotaListDto.java @@ -0,0 +1,35 @@ +package com.krt.sun.dto.quota; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.sun.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/sun/dto/redirect/RedirectDto.java b/src/main/java/com/krt/sun/dto/redirect/RedirectDto.java new file mode 100644 index 0000000..b3219b3 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/redirect/RedirectDto.java @@ -0,0 +1,30 @@ +package com.krt.sun.dto.redirect; + +import com.krt.sun.entity.project.ProjectRedirectEntity; +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class RedirectDto { + private String projectCode; + private String panelCode; + private String panelName; + private String completeUrl; + private String quotaUrl; + private String screenUrl; + + + public static RedirectDto of(ProjectRedirectEntity projectRedirectEntity){ + return RedirectDto.builder() + .projectCode(projectRedirectEntity.getProjectCode()) + .panelCode(projectRedirectEntity.getPanelCode()) + .panelName(projectRedirectEntity.getPanelName()) + .completeUrl(projectRedirectEntity.getCompleteUrl()) + .quotaUrl(projectRedirectEntity.getQuotaUrl()) + .screenUrl(projectRedirectEntity.getScreenUrl()) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/dto/survey/common/ErrorMessageDto.java b/src/main/java/com/krt/sun/dto/survey/common/ErrorMessageDto.java new file mode 100644 index 0000000..4693b92 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/common/ErrorMessageDto.java @@ -0,0 +1,12 @@ +package com.krt.sun.dto.survey.common; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ErrorMessageDto { + private String errorMessage; +} diff --git a/src/main/java/com/krt/sun/dto/survey/common/SurveyDataDto.java b/src/main/java/com/krt/sun/dto/survey/common/SurveyDataDto.java new file mode 100644 index 0000000..f21cb12 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/common/SurveyDataDto.java @@ -0,0 +1,16 @@ +package com.krt.sun.dto.survey.common; + +import lombok.*; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SurveyDataDto { + private String projectCode; + private String answerId; + private int questionUniqueKey; + private String answerData; + private String answerDate; +} diff --git a/src/main/java/com/krt/sun/dto/survey/common/SurveyInfo.java b/src/main/java/com/krt/sun/dto/survey/common/SurveyInfo.java new file mode 100644 index 0000000..339fd79 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/common/SurveyInfo.java @@ -0,0 +1,18 @@ +package com.krt.sun.dto.survey.common; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class SurveyInfo { + private String security_code; + private String answer_id; + private int question_unique_key; + private int loop_id; + private String survey_type; +} diff --git a/src/main/java/com/krt/sun/dto/survey/common/SurveyRespondentDto.java b/src/main/java/com/krt/sun/dto/survey/common/SurveyRespondentDto.java new file mode 100644 index 0000000..1a5b422 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/common/SurveyRespondentDto.java @@ -0,0 +1,18 @@ +package com.krt.sun.dto.survey.common; + +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; +} diff --git a/src/main/java/com/krt/sun/dto/survey/request/DataSaveDto.java b/src/main/java/com/krt/sun/dto/survey/request/DataSaveDto.java new file mode 100644 index 0000000..e256b34 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/request/DataSaveDto.java @@ -0,0 +1,62 @@ +package com.krt.sun.dto.survey.request; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.sun.dto.question.label.QuestionLabelInfoDto; +import com.krt.sun.dto.quota.QuotaCellJsonDto; +import com.krt.sun.dto.survey.response.SurveyDataStructureDto; +import com.krt.sun.entity.survey.SurveyDataEntity; +import lombok.*; +import org.springframework.web.multipart.MultipartFile; + +import java.lang.reflect.Type; +import java.util.List; +import java.util.function.Predicate; + +@Getter +@Setter +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class DataSaveDto { + private String security_code; + private String answer_id; + private int question_unique_key; + private int block_id; + private int loop_id; + private List surveyDataList; + + //랭크 필수순위 응답 체크 + public boolean rankAnswerCheck(int t, int m, int rank, List isNotList){ + long answerCount = 0; + + //랭크 필수 응답 + if(surveyDataList.stream().anyMatch(data -> data.getT() == t && data.getM() == m && data.getR() == rank)) answerCount = rank; + + //{N} 응답 시, 패스 + if(surveyDataList.stream().anyMatch(data -> isNotList.stream().anyMatch(isNot -> data.getT() == t && data.getM() == m && isNot.getValue() == data.getS())) && answerCount != rank) answerCount = rank; + + return answerCount >= rank; + } + + //파일 업로드 개수 체크 + public boolean fileUploadCheck(int t, int m, int uploadOptionCount){ + long uploadCount = surveyDataList.stream().filter(data -> data.getT() == t && data.getM() == m).count(); + + return uploadCount >= uploadOptionCount; + } + + public static DataSaveDto of(SurveyDataEntity surveyDataEntity){ + Gson gson = new Gson(); + Type listType = new TypeToken>() {}.getType(); + + return DataSaveDto.builder() + .security_code(surveyDataEntity.getProjectCode()) + .answer_id(surveyDataEntity.getAnswerId()) + .question_unique_key(surveyDataEntity.getQuestionUniqueKey()) + .surveyDataList(gson.fromJson(surveyDataEntity.getAnswerData(), listType)) + .build(); + } + +} diff --git a/src/main/java/com/krt/sun/dto/survey/request/GangLoginRequestDto.java b/src/main/java/com/krt/sun/dto/survey/request/GangLoginRequestDto.java new file mode 100644 index 0000000..5fdc4fd --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/request/GangLoginRequestDto.java @@ -0,0 +1,19 @@ +package com.krt.sun.dto.survey.request; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.HashMap; +import java.util.List; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class GangLoginRequestDto { + private String projectCode; + private String loginId; + private String loginPwd; +} diff --git a/src/main/java/com/krt/sun/dto/survey/request/IndexParameterDto.java b/src/main/java/com/krt/sun/dto/survey/request/IndexParameterDto.java new file mode 100644 index 0000000..30d6c30 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/request/IndexParameterDto.java @@ -0,0 +1,19 @@ +package com.krt.sun.dto.survey.request; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.HashMap; +import java.util.List; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class IndexParameterDto { + private String security_code; + private String answer_id; + private List> parameter_info; +} diff --git a/src/main/java/com/krt/sun/dto/survey/response/IndexFormSetupDto.java b/src/main/java/com/krt/sun/dto/survey/response/IndexFormSetupDto.java new file mode 100644 index 0000000..6644a18 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/response/IndexFormSetupDto.java @@ -0,0 +1,26 @@ +package com.krt.sun.dto.survey.response; + + +import com.krt.sun.dto.question.response.QuestionInfoDto; +import lombok.*; + +import java.util.List; + +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class IndexFormSetupDto { + private String security_code; + private String answer_id; + private int progress_percent; + private List question_info; + public static IndexFormSetupDto of(String securityCode, String answerId, int progressPercent, List indexInfoList) { + return IndexFormSetupDto.builder() + .security_code(securityCode) + .answer_id(answerId) + .progress_percent(progressPercent) + .question_info(indexInfoList) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/dto/survey/response/NextLoopInfo.java b/src/main/java/com/krt/sun/dto/survey/response/NextLoopInfo.java new file mode 100644 index 0000000..a40f9ff --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/response/NextLoopInfo.java @@ -0,0 +1,15 @@ +package com.krt.sun.dto.survey.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class NextLoopInfo { + private int nextUniqueKey; + private int loopId; +} diff --git a/src/main/java/com/krt/sun/dto/survey/response/QuestionUniqueKeyAndDataDto.java b/src/main/java/com/krt/sun/dto/survey/response/QuestionUniqueKeyAndDataDto.java new file mode 100644 index 0000000..e830c8d --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/response/QuestionUniqueKeyAndDataDto.java @@ -0,0 +1,25 @@ +package com.krt.sun.dto.survey.response; + +import com.krt.sun.dto.question.response.QuestionInfoDto; +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionUniqueKeyAndDataDto { + int question_unique_key; + int loopId; + private List saved_data_list; + + public static QuestionUniqueKeyAndDataDto of(int questionUniqueKey, int loopId, List surveyDataDtoList){ + return QuestionUniqueKeyAndDataDto.builder() + .question_unique_key(questionUniqueKey) + .loopId(loopId) + .saved_data_list(surveyDataDtoList) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/dto/survey/response/QuestionUniqueKeyAndLabelDto.java b/src/main/java/com/krt/sun/dto/survey/response/QuestionUniqueKeyAndLabelDto.java new file mode 100644 index 0000000..1b1f670 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/response/QuestionUniqueKeyAndLabelDto.java @@ -0,0 +1,24 @@ +package com.krt.sun.dto.survey.response; + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QuestionUniqueKeyAndLabelDto { + private int question_unique_key; + private int loopId; + private String saved_data_list; + + public static QuestionUniqueKeyAndLabelDto of(int questionUniqueKey, int loopId, String dataLabel){ + return QuestionUniqueKeyAndLabelDto.builder() + .question_unique_key(questionUniqueKey) + .loopId(loopId) + .saved_data_list(dataLabel) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/dto/survey/response/SurveyDataStructureDto.java b/src/main/java/com/krt/sun/dto/survey/response/SurveyDataStructureDto.java new file mode 100644 index 0000000..16d0e79 --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/response/SurveyDataStructureDto.java @@ -0,0 +1,32 @@ +package com.krt.sun.dto.survey.response; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.sun.dto.question.response.QuestionInfoDto; +import com.krt.sun.entity.question.QuestionEntity; +import com.krt.sun.entity.survey.SurveyDataEntity; +import lombok.*; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class SurveyDataStructureDto { + private int t; + private int m; + private int s; + private int r; + private String o; + + public static List answerDataToList(SurveyDataEntity surveyDataEntity){ + Gson gson = new Gson(); + Type surveyDataType = new TypeToken>(){}.getType(); + return gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType); + } +} diff --git a/src/main/java/com/krt/sun/dto/survey/response/SurveyFormSetupDto.java b/src/main/java/com/krt/sun/dto/survey/response/SurveyFormSetupDto.java new file mode 100644 index 0000000..c0a5acf --- /dev/null +++ b/src/main/java/com/krt/sun/dto/survey/response/SurveyFormSetupDto.java @@ -0,0 +1,28 @@ +package com.krt.sun.dto.survey.response; + + +import com.krt.sun.dto.question.response.QuestionInfoDto; +import lombok.*; + +import java.util.List; + +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SurveyFormSetupDto { + private String security_code; + private String answer_id; + private int progress_percent; + private List question_unique_key_list; + private int loop_id; + + public static SurveyFormSetupDto of(String securityCode, String answerId, int progressPercent, List questionUniqueKeyList) { + return SurveyFormSetupDto.builder() + .security_code(securityCode) + .answer_id(answerId) + .progress_percent(progressPercent) + .question_unique_key_list(questionUniqueKeyList) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/entity/autorecode/AutoRecodeEntity.java b/src/main/java/com/krt/sun/entity/autorecode/AutoRecodeEntity.java new file mode 100644 index 0000000..8d7135d --- /dev/null +++ b/src/main/java/com/krt/sun/entity/autorecode/AutoRecodeEntity.java @@ -0,0 +1,41 @@ +package com.krt.sun.entity.autorecode; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "auto_recode") +public class AutoRecodeEntity { + + @Id + @Column(name = "IDX", insertable = false, updatable = false) + 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) + private String regDate; + + @Column(name = "REG_MBR") + private int regMember; +} diff --git a/src/main/java/com/krt/sun/entity/capi/InterviewerAssignEntity.java b/src/main/java/com/krt/sun/entity/capi/InterviewerAssignEntity.java new file mode 100644 index 0000000..f12b17d --- /dev/null +++ b/src/main/java/com/krt/sun/entity/capi/InterviewerAssignEntity.java @@ -0,0 +1,40 @@ +package com.krt.sun.entity.capi; + +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/sun/entity/capi/InterviewerDeleteRequestEntity.java b/src/main/java/com/krt/sun/entity/capi/InterviewerDeleteRequestEntity.java new file mode 100644 index 0000000..260bd88 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/capi/InterviewerDeleteRequestEntity.java @@ -0,0 +1,52 @@ +package com.krt.sun.entity.capi; + + +import com.krt.sun.dto.capi.DeleteSurveyDataRequestDto; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@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/sun/entity/capi/InterviewerInfoEntity.java b/src/main/java/com/krt/sun/entity/capi/InterviewerInfoEntity.java new file mode 100644 index 0000000..d1d3cb0 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/capi/InterviewerInfoEntity.java @@ -0,0 +1,52 @@ +package com.krt.sun.entity.capi; + +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/sun/entity/hardcode/HardCodeEntity.java b/src/main/java/com/krt/sun/entity/hardcode/HardCodeEntity.java new file mode 100644 index 0000000..46aa9cd --- /dev/null +++ b/src/main/java/com/krt/sun/entity/hardcode/HardCodeEntity.java @@ -0,0 +1,54 @@ +package com.krt.sun.entity.hardcode; + +import com.krt.sun.dto.hardcode.HardCodeDto; +import com.krt.sun.entity_pk.hardcode.HardcodeEntityPK; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@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/sun/entity/hardcode/HardCodeHistoryEntity.java b/src/main/java/com/krt/sun/entity/hardcode/HardCodeHistoryEntity.java new file mode 100644 index 0000000..892b43f --- /dev/null +++ b/src/main/java/com/krt/sun/entity/hardcode/HardCodeHistoryEntity.java @@ -0,0 +1,51 @@ +package com.krt.sun.entity.hardcode; + +import com.krt.sun.dto.hardcode.HardCodeHistoryDto; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.*; + +@Entity +@Getter +@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/sun/entity/list/ListContentEntity.java b/src/main/java/com/krt/sun/entity/list/ListContentEntity.java new file mode 100644 index 0000000..b019057 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/list/ListContentEntity.java @@ -0,0 +1,40 @@ +package com.krt.sun.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/sun/entity/list/ListHeaderEntity.java b/src/main/java/com/krt/sun/entity/list/ListHeaderEntity.java new file mode 100644 index 0000000..a9dd337 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/list/ListHeaderEntity.java @@ -0,0 +1,41 @@ +package com.krt.sun.entity.list; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@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 int 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/sun/entity/project/ProjectEntity.java b/src/main/java/com/krt/sun/entity/project/ProjectEntity.java new file mode 100644 index 0000000..05855d7 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/project/ProjectEntity.java @@ -0,0 +1,48 @@ +package com.krt.sun.entity.project; + +import jakarta.persistence.*; +import lombok.*; +import org.springframework.data.domain.Persistable; + +@Entity +@Getter @Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "project") +public class ProjectEntity { + + @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; +} diff --git a/src/main/java/com/krt/sun/entity/project/ProjectFileEntity.java b/src/main/java/com/krt/sun/entity/project/ProjectFileEntity.java new file mode 100644 index 0000000..8bf7e4b --- /dev/null +++ b/src/main/java/com/krt/sun/entity/project/ProjectFileEntity.java @@ -0,0 +1,42 @@ +package com.krt.sun.entity.project; + +import com.krt.sun.entity_pk.project.ProjectFileEntityPK; +import com.krt.sun.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/sun/entity/project/ProjectParameterEntity.java b/src/main/java/com/krt/sun/entity/project/ProjectParameterEntity.java new file mode 100644 index 0000000..d85948f --- /dev/null +++ b/src/main/java/com/krt/sun/entity/project/ProjectParameterEntity.java @@ -0,0 +1,35 @@ +package com.krt.sun.entity.project; + +import com.krt.sun.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; +} diff --git a/src/main/java/com/krt/sun/entity/project/ProjectRedirectEntity.java b/src/main/java/com/krt/sun/entity/project/ProjectRedirectEntity.java new file mode 100644 index 0000000..27d7942 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/project/ProjectRedirectEntity.java @@ -0,0 +1,44 @@ +package com.krt.sun.entity.project; + +import com.krt.sun.entity_pk.project.ProjectRedirectEntityPK; +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; +} diff --git a/src/main/java/com/krt/sun/entity/project/ProjectResponseEntity.java b/src/main/java/com/krt/sun/entity/project/ProjectResponseEntity.java new file mode 100644 index 0000000..81cc6e5 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/project/ProjectResponseEntity.java @@ -0,0 +1,29 @@ +package com.krt.sun.entity.project; + +import com.krt.sun.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; +} diff --git a/src/main/java/com/krt/sun/entity/project/ProjectStyleEntity.java b/src/main/java/com/krt/sun/entity/project/ProjectStyleEntity.java new file mode 100644 index 0000000..d5a08a9 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/project/ProjectStyleEntity.java @@ -0,0 +1,29 @@ +package com.krt.sun.entity.project; + +import com.krt.sun.entity_pk.project.ProjectStyleEntityPK; +import jakarta.persistence.*; +import lombok.*; + +@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; +} diff --git a/src/main/java/com/krt/sun/entity/question/QuestionBlockCollectEntity.java b/src/main/java/com/krt/sun/entity/question/QuestionBlockCollectEntity.java new file mode 100644 index 0000000..fcc1f11 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/question/QuestionBlockCollectEntity.java @@ -0,0 +1,46 @@ +package com.krt.sun.entity.question; + +import com.krt.sun.entity_pk.question.QuestionBlockEntityPk; +import jakarta.persistence.*; +import lombok.*; + +import java.util.Date; + +@Getter +@Setter +@Entity +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(QuestionBlockEntityPk.class) +@Table(name = "question_block_collection") +public class QuestionBlockCollectEntity { + + @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 = "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/sun/entity/question/QuestionBlockEntity.java b/src/main/java/com/krt/sun/entity/question/QuestionBlockEntity.java new file mode 100644 index 0000000..43a0910 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/question/QuestionBlockEntity.java @@ -0,0 +1,49 @@ +package com.krt.sun.entity.question; + + +import com.krt.sun.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<>(); + +} diff --git a/src/main/java/com/krt/sun/entity/question/QuestionBlockOptionEntity.java b/src/main/java/com/krt/sun/entity/question/QuestionBlockOptionEntity.java new file mode 100644 index 0000000..161717a --- /dev/null +++ b/src/main/java/com/krt/sun/entity/question/QuestionBlockOptionEntity.java @@ -0,0 +1,38 @@ +package com.krt.sun.entity.question; + +import com.google.gson.Gson; +import com.krt.sun.dto.question.response.QuestionInfoDto; +import com.krt.sun.entity_pk.question.QuestionBlockEntityPk; +import com.krt.sun.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; + +} diff --git a/src/main/java/com/krt/sun/entity/question/QuestionEntity.java b/src/main/java/com/krt/sun/entity/question/QuestionEntity.java new file mode 100644 index 0000000..74a3e4c --- /dev/null +++ b/src/main/java/com/krt/sun/entity/question/QuestionEntity.java @@ -0,0 +1,61 @@ +package com.krt.sun.entity.question; + +import com.krt.sun.entity_pk.question.QuestionEntityPK; +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", insertable = false, updatable = false) + private String projectCode; + + @Id + @Column(name = "Q_UK", insertable = false, updatable = false) + private int questionUniqueKey; + + @Column(name = "Q_ID", insertable = false, updatable = false) + private String questionID; + + @Column(name = "Q_ODR", insertable = false, updatable = false) + private int questionOrder; + + @Column(name = "NM", insertable = false, updatable = false) + private String questionName; + + @Column(name = "DIM", insertable = false, updatable = false) + private int questionDimension; + + @Column(name = "TY", insertable = false, updatable = false) + private int questionType; + + @Column(name = "EXP_TXT", insertable = false, updatable = false) + private String questionExplain; + + @Column(name = "TT", insertable = false, updatable = false) + private String questionTitle; + + @Column(name = "DES", insertable = false, updatable = false) + private String questionDescription; + + @Column(name = "REG_MBR", insertable = false, 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; +} diff --git a/src/main/java/com/krt/sun/entity/question/QuestionHardcodeEntity.java b/src/main/java/com/krt/sun/entity/question/QuestionHardcodeEntity.java new file mode 100644 index 0000000..05a51dd --- /dev/null +++ b/src/main/java/com/krt/sun/entity/question/QuestionHardcodeEntity.java @@ -0,0 +1,38 @@ +package com.krt.sun.entity.question; + +import com.krt.sun.entity_pk.question.QuestionEntityPK; +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", insertable = false, updatable = false) + private String projectCode; + + @Id + @Column(name = "Q_UK", insertable = false, updatable = false) + private int questionUniqueKey; + + @Column(name = "TY", insertable = false, updatable = false) + private int hardcodeType; + + @Column(name = "CONTENT", insertable = false, updatable = false) + private String hardcodeContent; + + @Column(name = "REG_MBR", insertable = false, updatable = false) + private int regMember; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; +} diff --git a/src/main/java/com/krt/sun/entity/question/QuestionLabelEntity.java b/src/main/java/com/krt/sun/entity/question/QuestionLabelEntity.java new file mode 100644 index 0000000..ef7de59 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/question/QuestionLabelEntity.java @@ -0,0 +1,36 @@ +package com.krt.sun.entity.question; + +import com.krt.sun.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", insertable = false, updatable = false) + private String projectCode; + + @Id + @Column(name = "Q_UK", insertable = false, updatable = false) + private int questionUniqueKey; + + @Id + @Column(name = "DIM", insertable = false, updatable = false) + private int labelDimension; + + @Column(name = "L_INFO", insertable = false, updatable = false) + private String labelInfo; + + @Column(name = "L_OPT", insertable = false, updatable = false) + private String labelOption; + +} diff --git a/src/main/java/com/krt/sun/entity/question/QuestionLogicEntity.java b/src/main/java/com/krt/sun/entity/question/QuestionLogicEntity.java new file mode 100644 index 0000000..0d9ce30 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/question/QuestionLogicEntity.java @@ -0,0 +1,40 @@ +package com.krt.sun.entity.question; + +import com.krt.sun.entity_pk.question.QuestionEntityPK; +import com.krt.sun.util.Common; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Setter +@Builder +@ToString +@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; +} diff --git a/src/main/java/com/krt/sun/entity/question/QuestionOptionEntity.java b/src/main/java/com/krt/sun/entity/question/QuestionOptionEntity.java new file mode 100644 index 0000000..1a884b4 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/question/QuestionOptionEntity.java @@ -0,0 +1,35 @@ +package com.krt.sun.entity.question; + +import com.krt.sun.entity_pk.question.QuestionEntityPK; +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", insertable = false, updatable = false) + private String projectCode; + + @Id + @Column(name = "Q_UK", insertable = false, updatable = false) + private int questionUniqueKey; + + @Column(name = "OPT_VAL", insertable = false, updatable = false) + private String optionValue; + + @Column(name = "REG_MBR", insertable = false, updatable = false) + private int regMember; + + @Column(name = "REG_DT", insertable = false, updatable = false) + private String regDate; +} diff --git a/src/main/java/com/krt/sun/entity/quota/QuotaCellEntity.java b/src/main/java/com/krt/sun/entity/quota/QuotaCellEntity.java new file mode 100644 index 0000000..9ffbae0 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/quota/QuotaCellEntity.java @@ -0,0 +1,49 @@ +package com.krt.sun.entity.quota; + +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/sun/entity/quota/QuotaEntity.java b/src/main/java/com/krt/sun/entity/quota/QuotaEntity.java new file mode 100644 index 0000000..f7ef736 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/quota/QuotaEntity.java @@ -0,0 +1,57 @@ +package com.krt.sun.entity.quota; + +import jakarta.persistence.*; +import lombok.*; + +@Getter +@Setter +@Entity +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name="quota") +public class QuotaEntity { + + @Id + @Column(name="IDX", insertable = false, updatable = false) + @GeneratedValue(strategy= GenerationType.IDENTITY) + private long idx; + + @Column(name="PRJ_CD") + private String projectCode; + + @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/sun/entity/survey/SurveyBlockLoopEntity.java b/src/main/java/com/krt/sun/entity/survey/SurveyBlockLoopEntity.java new file mode 100644 index 0000000..b178f64 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/survey/SurveyBlockLoopEntity.java @@ -0,0 +1,41 @@ +package com.krt.sun.entity.survey; + +import com.krt.sun.entity_pk.question.SurveyBlockLoopEntityPK; +import com.krt.sun.entity_pk.survey.SurveyRespondentEntityPK; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +@IdClass(SurveyBlockLoopEntityPK.class) +@Table(name = "survey_loop") +public class SurveyBlockLoopEntity { + + @Column(name = "IDX", insertable = false, updatable = false) + private int idx; + + @Id + @Column(name = "PRJ_CD") + private String projectCode; + + @Id + @Column(name = "BK_CD") + private int blockCode; + + @Id + @Column(name = "ODR") + private int order; + + @Id + @Column(name = "ANS_ID") + private String answerId; + + @Column(name = "LOOP_ID") + private int loopId; +} diff --git a/src/main/java/com/krt/sun/entity/survey/SurveyDataEntity.java b/src/main/java/com/krt/sun/entity/survey/SurveyDataEntity.java new file mode 100644 index 0000000..1646540 --- /dev/null +++ b/src/main/java/com/krt/sun/entity/survey/SurveyDataEntity.java @@ -0,0 +1,53 @@ +package com.krt.sun.entity.survey; + +import com.krt.sun.dto.survey.request.DataSaveDto; +import com.krt.sun.entity_pk.survey.SurveyDataEntityPK; +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Setter +@ToString +@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") + private String answerDate; + + public static SurveyDataEntity toEntity(String projectCode, String answerId, int questionUniqueKey, int loopId, String answerData, String answerDate){ + return SurveyDataEntity.builder() + .projectCode(projectCode) + .answerId(answerId) + .questionUniqueKey(questionUniqueKey) + .loopId(loopId) + .answerData(answerData) + .answerDate(answerDate) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/entity/survey/SurveyRespondentEntity.java b/src/main/java/com/krt/sun/entity/survey/SurveyRespondentEntity.java new file mode 100644 index 0000000..7e99b0b --- /dev/null +++ b/src/main/java/com/krt/sun/entity/survey/SurveyRespondentEntity.java @@ -0,0 +1,57 @@ +package com.krt.sun.entity.survey; + +import com.krt.sun.entity_pk.survey.SurveyRespondentEntityPK; +import com.krt.sun.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, int loopId){ + return SurveyRespondentEntity.builder() + .projectCode(projectCode) + .answerId(answerId) + .surveyTypeCode(surveyTypeCode) + .answerState(answerState) + .answerEndQuestionUniqueKey(answerEndQuestionUniqueKey) + .answerLoopId(loopId) + .answerEndDate(Common.getNow(null)) + .build(); + } +} diff --git a/src/main/java/com/krt/sun/entity_pk/hardcode/HardcodeEntityPK.java b/src/main/java/com/krt/sun/entity_pk/hardcode/HardcodeEntityPK.java new file mode 100644 index 0000000..22bb451 --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/hardcode/HardcodeEntityPK.java @@ -0,0 +1,12 @@ +package com.krt.sun.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/sun/entity_pk/project/ProjectFileEntityPK.java b/src/main/java/com/krt/sun/entity_pk/project/ProjectFileEntityPK.java new file mode 100644 index 0000000..29f6b5c --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/project/ProjectFileEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.sun.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/sun/entity_pk/project/ProjectParameterEntityPK.java b/src/main/java/com/krt/sun/entity_pk/project/ProjectParameterEntityPK.java new file mode 100644 index 0000000..8d2719b --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/project/ProjectParameterEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.sun.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/sun/entity_pk/project/ProjectRedirectEntityPK.java b/src/main/java/com/krt/sun/entity_pk/project/ProjectRedirectEntityPK.java new file mode 100644 index 0000000..9187ff7 --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/project/ProjectRedirectEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.sun.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/sun/entity_pk/project/ProjectResponseEntityPK.java b/src/main/java/com/krt/sun/entity_pk/project/ProjectResponseEntityPK.java new file mode 100644 index 0000000..725fa6d --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/project/ProjectResponseEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.sun.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/sun/entity_pk/project/ProjectStyleEntityPK.java b/src/main/java/com/krt/sun/entity_pk/project/ProjectStyleEntityPK.java new file mode 100644 index 0000000..0498a71 --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/project/ProjectStyleEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.sun.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/sun/entity_pk/question/QuestionBlockCollectEntityPk.java b/src/main/java/com/krt/sun/entity_pk/question/QuestionBlockCollectEntityPk.java new file mode 100644 index 0000000..d1eb2fb --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/question/QuestionBlockCollectEntityPk.java @@ -0,0 +1,18 @@ +package com.krt.sun.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/sun/entity_pk/question/QuestionBlockEntityPk.java b/src/main/java/com/krt/sun/entity_pk/question/QuestionBlockEntityPk.java new file mode 100644 index 0000000..cb1ae98 --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/question/QuestionBlockEntityPk.java @@ -0,0 +1,19 @@ +package com.krt.sun.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/sun/entity_pk/question/QuestionEntityPK.java b/src/main/java/com/krt/sun/entity_pk/question/QuestionEntityPK.java new file mode 100644 index 0000000..167a4a5 --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/question/QuestionEntityPK.java @@ -0,0 +1,10 @@ +package com.krt.sun.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/sun/entity_pk/question/QuestionLabelEntityPK.java b/src/main/java/com/krt/sun/entity_pk/question/QuestionLabelEntityPK.java new file mode 100644 index 0000000..d555e0f --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/question/QuestionLabelEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.sun.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/sun/entity_pk/question/SurveyBlockLoopEntityPK.java b/src/main/java/com/krt/sun/entity_pk/question/SurveyBlockLoopEntityPK.java new file mode 100644 index 0000000..a9066d7 --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/question/SurveyBlockLoopEntityPK.java @@ -0,0 +1,13 @@ +package com.krt.sun.entity_pk.question; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SurveyBlockLoopEntityPK implements Serializable { + private String projectCode; + private int blockCode; + private int order; + private String answerId; +} diff --git a/src/main/java/com/krt/sun/entity_pk/survey/SurveyDataEntityPK.java b/src/main/java/com/krt/sun/entity_pk/survey/SurveyDataEntityPK.java new file mode 100644 index 0000000..c95f14d --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/survey/SurveyDataEntityPK.java @@ -0,0 +1,13 @@ +package com.krt.sun.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/sun/entity_pk/survey/SurveyRespondentEntityPK.java b/src/main/java/com/krt/sun/entity_pk/survey/SurveyRespondentEntityPK.java new file mode 100644 index 0000000..07dc20c --- /dev/null +++ b/src/main/java/com/krt/sun/entity_pk/survey/SurveyRespondentEntityPK.java @@ -0,0 +1,11 @@ +package com.krt.sun.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/sun/enums/AnswerStateEnum.java b/src/main/java/com/krt/sun/enums/AnswerStateEnum.java new file mode 100644 index 0000000..b653ad6 --- /dev/null +++ b/src/main/java/com/krt/sun/enums/AnswerStateEnum.java @@ -0,0 +1,30 @@ +package com.krt.sun.enums; + +import lombok.Getter; +import lombok.ToString; + +import java.util.Arrays; + +@Getter +@ToString +public enum AnswerStateEnum { + ONGOING("ONGOING", 1), + END("END", 10), + SCREEN("SCREEN", 99), + QUOTA("QUOTA", 98); + + private final String stateString; + private final int stateCode; + + AnswerStateEnum(String stateString, int stateCode){ + this.stateString = stateString; + this.stateCode = stateCode; + } + + public static AnswerStateEnum stateCodeOfStateString(String stateString){ + return Arrays.stream(values()) + .filter(x -> x.stateString.equals(stateString)) + .findAny() + .orElse(ONGOING); + } +} diff --git a/src/main/java/com/krt/sun/enums/SurveyTypeEnum.java b/src/main/java/com/krt/sun/enums/SurveyTypeEnum.java new file mode 100644 index 0000000..b19644c --- /dev/null +++ b/src/main/java/com/krt/sun/enums/SurveyTypeEnum.java @@ -0,0 +1,39 @@ +package com.krt.sun.enums; + +import lombok.Getter; +import lombok.ToString; + +import java.util.Arrays; + +@Getter +@ToString +public enum SurveyTypeEnum { + BANNER("B", 11), + + PANEL("P", 21), + LIST("L", 22), + GANG("G", 23), + HUT("H", 24), + + CAPI("CP", 31), + CATI("CT", 32), + CONTACT("CN", 33), + + ERROR("ERR", 98), + TEST("T", 99); + + private final String typeString; + private final int typeCode; + + SurveyTypeEnum(String typeString, int typeCode){ + this.typeString = typeString; + this.typeCode = typeCode; + } + + public static SurveyTypeEnum typeCodeOfTypeString(String typeString){ + return Arrays.stream(values()) + .filter(x -> x.typeString.equals(typeString)) + .findAny() + .orElse(ERROR); + } +} diff --git a/src/main/java/com/krt/sun/exception/ApiException.java b/src/main/java/com/krt/sun/exception/ApiException.java new file mode 100644 index 0000000..da97fae --- /dev/null +++ b/src/main/java/com/krt/sun/exception/ApiException.java @@ -0,0 +1,19 @@ +package com.krt.sun.exception; + +import org.springframework.http.HttpStatus; + +public class ApiException extends RuntimeException{ + + ExceptionDto exceptionDto; + + public ApiException(HttpStatus status, String code, String message, String errorPoint, String countryCode) { + this.exceptionDto = ExceptionDto.builder() + .status(status) + .code(code) + .message(message) + .errorPoint(errorPoint) + .countryCode(countryCode) + .build(); + } + +} diff --git a/src/main/java/com/krt/sun/exception/ApiExceptionAdvice.java b/src/main/java/com/krt/sun/exception/ApiExceptionAdvice.java new file mode 100644 index 0000000..2793895 --- /dev/null +++ b/src/main/java/com/krt/sun/exception/ApiExceptionAdvice.java @@ -0,0 +1,34 @@ +package com.krt.sun.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(ApiException apiEx) { + + return ResponseEntity + .status(apiEx.exceptionDto.getStatus()) + .body(ApiExceptionEntity.builder() + .errorCode(apiEx.exceptionDto.getCode()) + .errorMessage(apiEx.exceptionDto.getMessage()) + .errorPoint(apiEx.exceptionDto.getErrorPoint()) + .build()); + } + + @ExceptionHandler({TextException.class}) + public ResponseEntity exceptionHandler(TextException apiEx) { + + return ResponseEntity + .status(apiEx.exceptionDto.getStatus()) + .body(TextExceptionEntity.builder() + .errorCode(apiEx.exceptionDto.getCode()) + .errorMessage(apiEx.exceptionDto.getMessage()) + .build()); + } + +} diff --git a/src/main/java/com/krt/sun/exception/ApiExceptionEntity.java b/src/main/java/com/krt/sun/exception/ApiExceptionEntity.java new file mode 100644 index 0000000..7ff3c09 --- /dev/null +++ b/src/main/java/com/krt/sun/exception/ApiExceptionEntity.java @@ -0,0 +1,38 @@ +package com.krt.sun.exception; + +import com.krt.sun.dto.survey.response.SurveyDataStructureDto; +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; + private SurveyDataStructureDto errorPoint; + + @Builder + public ApiExceptionEntity(String errorCode, String errorMessage, String errorPoint) { + + + this.errorCode = errorCode; + this.errorMessage = errorMessage; + + if(errorPoint != null) { + //surveyInfo + int tensor = Integer.parseInt(errorPoint.split("\\|\\|")[0]); + int matrix = Integer.parseInt(errorPoint.split("\\|\\|")[1]); + int scalar = Integer.parseInt(errorPoint.split("\\|\\|")[2]); + + this.errorPoint = SurveyDataStructureDto.builder() + .t(tensor) + .m(matrix) + .s(scalar) + .build(); + } + } + +} diff --git a/src/main/java/com/krt/sun/exception/ExceptionDto.java b/src/main/java/com/krt/sun/exception/ExceptionDto.java new file mode 100644 index 0000000..f12e1aa --- /dev/null +++ b/src/main/java/com/krt/sun/exception/ExceptionDto.java @@ -0,0 +1,19 @@ +package com.krt.sun.exception; + +import com.krt.sun.dto.survey.response.SurveyDataStructureDto; +import lombok.*; +import org.springframework.http.HttpStatus; + +@Getter +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class ExceptionDto { + + private HttpStatus status; //상태코드 + private String code; //커스텀코드 + private String message; //에러메시지 + private String countryCode; //다국어코드 + private String errorPoint; //데이터 정보 +} diff --git a/src/main/java/com/krt/sun/exception/TextException.java b/src/main/java/com/krt/sun/exception/TextException.java new file mode 100644 index 0000000..ddf49ad --- /dev/null +++ b/src/main/java/com/krt/sun/exception/TextException.java @@ -0,0 +1,18 @@ +package com.krt.sun.exception; + +import org.springframework.http.HttpStatus; + +public class TextException extends RuntimeException{ + + ExceptionDto exceptionDto; + + public TextException(HttpStatus status, String code, String message, String countryCode) { + this.exceptionDto = ExceptionDto.builder() + .status(status) + .code(code) + .message(message) + .countryCode(countryCode) + .build(); + } + +} diff --git a/src/main/java/com/krt/sun/exception/TextExceptionEntity.java b/src/main/java/com/krt/sun/exception/TextExceptionEntity.java new file mode 100644 index 0000000..7fe3fd8 --- /dev/null +++ b/src/main/java/com/krt/sun/exception/TextExceptionEntity.java @@ -0,0 +1,23 @@ +package com.krt.sun.exception; + +import com.krt.sun.dto.survey.response.SurveyDataStructureDto; +import lombok.Builder; +import lombok.Getter; +import lombok.ToString; + +@Getter +@ToString +public class TextExceptionEntity { + + private String errorCode; + private String errorMessage; + + @Builder + public TextExceptionEntity(String errorCode, String errorMessage) { + + this.errorCode = errorCode; + this.errorMessage = errorMessage; + + } + +} diff --git a/src/main/java/com/krt/sun/repository/autorecode/AutoRecodeRepository.java b/src/main/java/com/krt/sun/repository/autorecode/AutoRecodeRepository.java new file mode 100644 index 0000000..6ab722a --- /dev/null +++ b/src/main/java/com/krt/sun/repository/autorecode/AutoRecodeRepository.java @@ -0,0 +1,11 @@ +package com.krt.sun.repository.autorecode; + +import com.krt.sun.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); + AutoRecodeEntity findByProjectCodeAndQuestionUniqueKey(String projectCode, int questionUniqueKey); +} diff --git a/src/main/java/com/krt/sun/repository/capi/CapiAssignRepository.java b/src/main/java/com/krt/sun/repository/capi/CapiAssignRepository.java new file mode 100644 index 0000000..4aca617 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/capi/CapiAssignRepository.java @@ -0,0 +1,13 @@ +package com.krt.sun.repository.capi; + + +import com.krt.sun.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/sun/repository/capi/CapiQueryRepository.java b/src/main/java/com/krt/sun/repository/capi/CapiQueryRepository.java new file mode 100644 index 0000000..baa84cd --- /dev/null +++ b/src/main/java/com/krt/sun/repository/capi/CapiQueryRepository.java @@ -0,0 +1,112 @@ +package com.krt.sun.repository.capi; + +import com.krt.sun.dto.capi.GetInterviewerSurveyDetailRequestDto; +import com.krt.sun.dto.capi.GetRestartDataRequestDto; +import com.krt.sun.dto.capi.GetSurveyDetailResponseDto; +import com.krt.sun.entity.capi.QInterviewerDeleteRequestEntity; +import com.krt.sun.entity.capi.QInterviewerInfoEntity; +import com.krt.sun.entity.question.QuestionEntity; +import com.krt.sun.entity.survey.QSurveyDataEntity; +import com.krt.sun.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 org.springframework.transaction.annotation.Transactional; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Repository +@RequiredArgsConstructor +public class CapiQueryRepository { + + private final JPAQueryFactory queryFactory; + private QInterviewerInfoEntity qInterviewerInfoEntity = QInterviewerInfoEntity.interviewerInfoEntity; + private QSurveyRespondentEntity qSurveyRespondentEntity = QSurveyRespondentEntity.surveyRespondentEntity; + private QSurveyDataEntity qSurveyDataEntity = QSurveyDataEntity.surveyDataEntity; + private QInterviewerDeleteRequestEntity qInterviewerDeleteRequestEntity = QInterviewerDeleteRequestEntity.interviewerDeleteRequestEntity; + + public List findSurveyRespondentList(GetInterviewerSurveyDetailRequestDto getInterviewerSurveyDetailRequestDto){ + + List resList = queryFactory. + select(Projections.fields(GetSurveyDetailResponseDto.class, + qSurveyRespondentEntity.projectCode, + qSurveyRespondentEntity.answerId, + qSurveyRespondentEntity.surveyTypeCode, + qSurveyRespondentEntity.answerState, + qSurveyRespondentEntity.answerStartDate, + qSurveyRespondentEntity.answerEndQuestionUniqueKey, + qSurveyRespondentEntity.answerEndDate, + new CaseBuilder().when(qInterviewerDeleteRequestEntity.result.isNotNull()) + .then(qInterviewerDeleteRequestEntity.result) + .otherwise(-1).as("deleteRequest") + )) + .from(qSurveyRespondentEntity) + .leftJoin(qInterviewerDeleteRequestEntity) + .on( + qSurveyRespondentEntity.projectCode.eq(qInterviewerDeleteRequestEntity.projectCode), + qSurveyRespondentEntity.answerId.eq(qInterviewerDeleteRequestEntity.answerId) + ) + .where( + qSurveyRespondentEntity.projectCode.eq(getInterviewerSurveyDetailRequestDto.getProjectCode()), + qSurveyRespondentEntity.answerId.contains(getInterviewerSurveyDetailRequestDto.getInterviewerId()) +// qSurveyRespondentEntity.answerState.ne(999), + .and( + qInterviewerDeleteRequestEntity.result.ne(1) + .or(qInterviewerDeleteRequestEntity.result.isNull()) + .or(qSurveyRespondentEntity.answerState.ne(999)) + ) + ) + .groupBy( + qSurveyRespondentEntity.projectCode, + qSurveyRespondentEntity.answerId + ) + .orderBy( + qSurveyRespondentEntity.answerEndDate.desc() + ) + .fetch(); + + return resList; + } + + @Transactional + public Long changeAnswerStatus(GetRestartDataRequestDto getRestartDataRequestDto) { + + //surveyRespondent status 변경 + BooleanBuilder resBuilder = new BooleanBuilder(); + + resBuilder.and(qSurveyRespondentEntity.projectCode.eq(getRestartDataRequestDto.getProjectCode())); + resBuilder.and(qSurveyRespondentEntity.answerId.eq(getRestartDataRequestDto.getAnswerId())); + + queryFactory.update(qSurveyRespondentEntity) + .set(qSurveyRespondentEntity.answerState, 1) + .set(qSurveyRespondentEntity.answerEndQuestionUniqueKey, 1) + .set(qSurveyRespondentEntity.answerLoopId, -1) + .where(resBuilder) + .execute(); + + + //날짜 + Date today = new Date(); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); + String deleteTime = "_DEL_"+dateFormat.format(today); + + //surveyData where 조건 세팅 + BooleanBuilder dataBuilder = new BooleanBuilder(); + + dataBuilder.and(qSurveyDataEntity.projectCode.eq(getRestartDataRequestDto.getProjectCode())); + dataBuilder.and(qSurveyDataEntity.answerId.eq(getRestartDataRequestDto.getAnswerId())); + + return queryFactory.update(qSurveyDataEntity) + .set(qSurveyDataEntity.answerId, getRestartDataRequestDto.getAnswerId()+deleteTime) + .where(dataBuilder) + .execute(); + } + +} diff --git a/src/main/java/com/krt/sun/repository/capi/CapiRepository.java b/src/main/java/com/krt/sun/repository/capi/CapiRepository.java new file mode 100644 index 0000000..4c268bd --- /dev/null +++ b/src/main/java/com/krt/sun/repository/capi/CapiRepository.java @@ -0,0 +1,10 @@ +package com.krt.sun.repository.capi; + + +import com.krt.sun.entity.capi.InterviewerInfoEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface CapiRepository extends JpaRepository { + InterviewerInfoEntity findByInterviewerIdAndInterviewerPwd(String id, String pwd); + +} diff --git a/src/main/java/com/krt/sun/repository/capi/CapiSurveyDataDeleteRequestRepository.java b/src/main/java/com/krt/sun/repository/capi/CapiSurveyDataDeleteRequestRepository.java new file mode 100644 index 0000000..2caef8e --- /dev/null +++ b/src/main/java/com/krt/sun/repository/capi/CapiSurveyDataDeleteRequestRepository.java @@ -0,0 +1,8 @@ +package com.krt.sun.repository.capi; + +import com.krt.sun.entity.capi.InterviewerDeleteRequestEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface CapiSurveyDataDeleteRequestRepository extends JpaRepository { + InterviewerDeleteRequestEntity findByProjectCodeAndAnswerIdAndResult(String projectCode, String answerId, int result); +} diff --git a/src/main/java/com/krt/sun/repository/hardcode/HardCodeHistoryRepository.java b/src/main/java/com/krt/sun/repository/hardcode/HardCodeHistoryRepository.java new file mode 100644 index 0000000..8eea189 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/hardcode/HardCodeHistoryRepository.java @@ -0,0 +1,11 @@ +package com.krt.sun.repository.hardcode; + +import com.krt.sun.entity.hardcode.HardCodeHistoryEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +public interface HardCodeHistoryRepository extends JpaRepository{ + List findTop10ByProjectCodeAndQuestionUniqueKeyAndHardCodeTypeOrderByRegDateDesc(String projectCode, int questionUniqueKey, int type); +} diff --git a/src/main/java/com/krt/sun/repository/hardcode/HardCodeRepository.java b/src/main/java/com/krt/sun/repository/hardcode/HardCodeRepository.java new file mode 100644 index 0000000..be07e41 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/hardcode/HardCodeRepository.java @@ -0,0 +1,9 @@ +package com.krt.sun.repository.hardcode; + +import com.krt.sun.entity.hardcode.HardCodeEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +public interface HardCodeRepository extends JpaRepository { + HardCodeEntity findByProjectCodeAndQuestionUniqueKeyAndHardCodeType(String projectCode, int questionUniqueKey, int type); +} diff --git a/src/main/java/com/krt/sun/repository/list/ListContentRepository.java b/src/main/java/com/krt/sun/repository/list/ListContentRepository.java new file mode 100644 index 0000000..08efb07 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/list/ListContentRepository.java @@ -0,0 +1,14 @@ +package com.krt.sun.repository.list; + + +import com.krt.sun.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); + ListContentEntity findByProjectCodeAndListId(String projectCode, String answerId); +} diff --git a/src/main/java/com/krt/sun/repository/list/ListHeaderRepository.java b/src/main/java/com/krt/sun/repository/list/ListHeaderRepository.java new file mode 100644 index 0000000..1adb032 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/list/ListHeaderRepository.java @@ -0,0 +1,17 @@ +package com.krt.sun.repository.list; + + +import com.krt.sun.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); + + ListHeaderEntity findByProjectCodeAndOrderNo(String projectCode, int order); + + List findAllByProjectCodeAndTypeLessThanEqualOrderByOrderNo(String projectCode, int type); +} diff --git a/src/main/java/com/krt/sun/repository/project/ProjectFileRepository.java b/src/main/java/com/krt/sun/repository/project/ProjectFileRepository.java new file mode 100644 index 0000000..caafb3d --- /dev/null +++ b/src/main/java/com/krt/sun/repository/project/ProjectFileRepository.java @@ -0,0 +1,10 @@ +package com.krt.sun.repository.project; + +import com.krt.sun.entity.project.ProjectFileEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Repository; + +public interface ProjectFileRepository extends JpaRepository, JpaSpecificationExecutor { + ProjectFileEntity findByProjectCodeAndFileName(String projectCode, String filename); +} diff --git a/src/main/java/com/krt/sun/repository/project/ProjectParameterRepository.java b/src/main/java/com/krt/sun/repository/project/ProjectParameterRepository.java new file mode 100644 index 0000000..ccdaf90 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/project/ProjectParameterRepository.java @@ -0,0 +1,12 @@ +package com.krt.sun.repository.project; + +import com.krt.sun.entity.project.ProjectEntity; +import com.krt.sun.entity.project.ProjectParameterEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface ProjectParameterRepository extends JpaRepository, JpaSpecificationExecutor { + List findByProjectCode(String projectCode); +} diff --git a/src/main/java/com/krt/sun/repository/project/ProjectQueryRepository.java b/src/main/java/com/krt/sun/repository/project/ProjectQueryRepository.java new file mode 100644 index 0000000..7809ddc --- /dev/null +++ b/src/main/java/com/krt/sun/repository/project/ProjectQueryRepository.java @@ -0,0 +1,62 @@ +package com.krt.sun.repository.project; + +import com.krt.sun.dto.project.common.ProjectOptionElementDto; +import com.krt.sun.entity.project.QProjectEntity; +import com.krt.sun.entity.project.QProjectParameterEntity; +import com.krt.sun.entity.project.QProjectResponseEntity; +import com.krt.sun.entity.project.QProjectStyleEntity; +import com.querydsl.core.types.Projections; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +@RequiredArgsConstructor +public class ProjectQueryRepository { + private final JPAQueryFactory queryFactory; + private QProjectEntity projectEntity = QProjectEntity.projectEntity; + private QProjectParameterEntity projectParameter = QProjectParameterEntity.projectParameterEntity; + private QProjectStyleEntity projectStyle = QProjectStyleEntity.projectStyleEntity; + + private QProjectResponseEntity projectResponse = QProjectResponseEntity.projectResponseEntity; + + public List getParameterNameList(String projectCode){ + List content = queryFactory + .select(projectParameter.parameterName) + .from(projectParameter) + .where(projectParameter.projectCode.eq(projectCode)) + .fetch(); + + return content; + } + + public List getProjectStyleList(String projectCode){ + List content = queryFactory + .select(Projections.constructor(ProjectOptionElementDto.class, + projectStyle.styleCode, + projectStyle.styleValue + ) + ) + .from(projectStyle) + .where(projectStyle.projectCode.eq(projectCode)) + .fetch(); + + return content; + } + + public List getProjectResponseList(String projectCode){ + List content = queryFactory + .select(Projections.constructor(ProjectOptionElementDto.class, + projectResponse.optionCode, + projectResponse.optionValue + ) + ) + .from(projectResponse) + .where(projectResponse.projectCode.eq(projectCode)) + .fetch(); + + return content; + } +} diff --git a/src/main/java/com/krt/sun/repository/project/ProjectRedirectRepository.java b/src/main/java/com/krt/sun/repository/project/ProjectRedirectRepository.java new file mode 100644 index 0000000..117c897 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/project/ProjectRedirectRepository.java @@ -0,0 +1,10 @@ +package com.krt.sun.repository.project; + +import com.krt.sun.entity.project.ProjectFileEntity; +import com.krt.sun.entity.project.ProjectRedirectEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface ProjectRedirectRepository extends JpaRepository, JpaSpecificationExecutor { + ProjectRedirectEntity findByProjectCodeAndPanelCode(String projectCode, String panelCode); +} diff --git a/src/main/java/com/krt/sun/repository/project/ProjectRepository.java b/src/main/java/com/krt/sun/repository/project/ProjectRepository.java new file mode 100644 index 0000000..c76cebe --- /dev/null +++ b/src/main/java/com/krt/sun/repository/project/ProjectRepository.java @@ -0,0 +1,15 @@ +package com.krt.sun.repository.project; + +import com.krt.sun.entity.project.ProjectEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface ProjectRepository extends JpaRepository, JpaSpecificationExecutor { + ProjectEntity findFirstByCodeAndIsDelete(String projectCode, int isDelete); + + List findByIsDelete(int is_delete); + + List findByCodeInAndIsDelete(List projectCode, int is_delete); +} diff --git a/src/main/java/com/krt/sun/repository/project/ProjectResponseRepository.java b/src/main/java/com/krt/sun/repository/project/ProjectResponseRepository.java new file mode 100644 index 0000000..db0fc50 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/project/ProjectResponseRepository.java @@ -0,0 +1,11 @@ +package com.krt.sun.repository.project; + +import com.krt.sun.entity.project.ProjectResponseEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface ProjectResponseRepository extends JpaRepository, JpaSpecificationExecutor { + List findByProjectCode(String projectCode); +} diff --git a/src/main/java/com/krt/sun/repository/project/ProjectStyleRepository.java b/src/main/java/com/krt/sun/repository/project/ProjectStyleRepository.java new file mode 100644 index 0000000..05e35e2 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/project/ProjectStyleRepository.java @@ -0,0 +1,11 @@ +package com.krt.sun.repository.project; + +import com.krt.sun.entity.project.ProjectStyleEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface ProjectStyleRepository extends JpaRepository, JpaSpecificationExecutor { + List findByProjectCodeOrderByStyleCode(String projectCode); +} diff --git a/src/main/java/com/krt/sun/repository/question/QuestionBlockCollectionRepository.java b/src/main/java/com/krt/sun/repository/question/QuestionBlockCollectionRepository.java new file mode 100644 index 0000000..ab1c20e --- /dev/null +++ b/src/main/java/com/krt/sun/repository/question/QuestionBlockCollectionRepository.java @@ -0,0 +1,17 @@ +package com.krt.sun.repository.question; + + +import com.krt.sun.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 { + + QuestionBlockCollectEntity findByProjectCodeAndQuestionUniqueKey(String projectCode, int questionUniqueKey); + + List findAllByProjectCodeAndBlockCode(String projectCode, int blockCode); + + int deleteAllByProjectCodeAndBlockCode(String projectCode, int blockCode); +} diff --git a/src/main/java/com/krt/sun/repository/question/QuestionBlockLoopRepository.java b/src/main/java/com/krt/sun/repository/question/QuestionBlockLoopRepository.java new file mode 100644 index 0000000..e8956bb --- /dev/null +++ b/src/main/java/com/krt/sun/repository/question/QuestionBlockLoopRepository.java @@ -0,0 +1,15 @@ +package com.krt.sun.repository.question; + + +import com.krt.sun.entity.question.QuestionBlockEntity; +import com.krt.sun.entity.survey.SurveyBlockLoopEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.List; + +public interface QuestionBlockLoopRepository extends JpaRepository, JpaSpecificationExecutor { + int deleteByProjectCodeAndAnswerIdAndBlockCode(String projectCode, String answerId, int blockCode); + + List findAllByProjectCodeAndAnswerIdAndBlockCode(String projectCode, String answerId, int blockCode); +} diff --git a/src/main/java/com/krt/sun/repository/question/QuestionBlockRepository.java b/src/main/java/com/krt/sun/repository/question/QuestionBlockRepository.java new file mode 100644 index 0000000..a8aeaf7 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/question/QuestionBlockRepository.java @@ -0,0 +1,17 @@ +package com.krt.sun.repository.question; + + +import com.krt.sun.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/sun/repository/question/QuestionBolckOptionRepository.java b/src/main/java/com/krt/sun/repository/question/QuestionBolckOptionRepository.java new file mode 100644 index 0000000..1d7dc5b --- /dev/null +++ b/src/main/java/com/krt/sun/repository/question/QuestionBolckOptionRepository.java @@ -0,0 +1,12 @@ +package com.krt.sun.repository.question; + +import com.krt.sun.entity.question.QuestionBlockEntity; +import com.krt.sun.entity.question.QuestionBlockOptionEntity; +import com.krt.sun.entity.question.QuestionOptionEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface QuestionBolckOptionRepository extends JpaRepository, JpaSpecificationExecutor { + + QuestionBlockOptionEntity findByProjectCodeAndBlockCode(String projectCode, int blockCode); +} diff --git a/src/main/java/com/krt/sun/repository/question/QuestionLabelRepository.java b/src/main/java/com/krt/sun/repository/question/QuestionLabelRepository.java new file mode 100644 index 0000000..ba9967a --- /dev/null +++ b/src/main/java/com/krt/sun/repository/question/QuestionLabelRepository.java @@ -0,0 +1,12 @@ +package com.krt.sun.repository.question; + +import com.krt.sun.entity.question.QuestionLabelEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +public interface QuestionLabelRepository extends JpaRepository, JpaSpecificationExecutor { + QuestionLabelEntity findByProjectCodeAndQuestionUniqueKeyAndLabelDimension(String projectCode, int questionUniqueKey, int labelDimension); +} diff --git a/src/main/java/com/krt/sun/repository/question/QuestionLogicRepository.java b/src/main/java/com/krt/sun/repository/question/QuestionLogicRepository.java new file mode 100644 index 0000000..1bfd57b --- /dev/null +++ b/src/main/java/com/krt/sun/repository/question/QuestionLogicRepository.java @@ -0,0 +1,15 @@ +package com.krt.sun.repository.question; + +import com.krt.sun.entity.question.QuestionLogicEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Repository; + +import java.util.List; + +public interface QuestionLogicRepository extends JpaRepository, JpaSpecificationExecutor { + + QuestionLogicEntity findByProjectCodeAndQuestionUniqueKey(String projectCode, int questionUniqueKey); + + List findByProjectCodeAndQuestionUniqueKeyIn(String projectCode, List questionUniqueKeyList); +} diff --git a/src/main/java/com/krt/sun/repository/question/QuestionOptionRepository.java b/src/main/java/com/krt/sun/repository/question/QuestionOptionRepository.java new file mode 100644 index 0000000..8e4a136 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/question/QuestionOptionRepository.java @@ -0,0 +1,13 @@ +package com.krt.sun.repository.question; + +import com.krt.sun.dto.question.response.QuestionOptionDto; +import com.krt.sun.entity.question.QuestionOptionEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Repository; + +import java.util.List; + +public interface QuestionOptionRepository extends JpaRepository, JpaSpecificationExecutor { + QuestionOptionEntity findByProjectCodeAndQuestionUniqueKey(String projectCode, int questionUniqueKey); +} diff --git a/src/main/java/com/krt/sun/repository/question/QuestionRepository.java b/src/main/java/com/krt/sun/repository/question/QuestionRepository.java new file mode 100644 index 0000000..c5e5b0b --- /dev/null +++ b/src/main/java/com/krt/sun/repository/question/QuestionRepository.java @@ -0,0 +1,29 @@ +package com.krt.sun.repository.question; + +import com.krt.sun.entity.question.QuestionEntity; +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; + +public interface QuestionRepository extends JpaRepository, JpaSpecificationExecutor { + List findByProjectCodeAndIsDelete(String projectCode, int isDelete); + + List findByProjectCodeAndIsDeleteOrderByQuestionOrder(String projectCode, int isDelete); + + Optional findByProjectCodeAndQuestionUniqueKeyAndIsDelete(String projectCode, int questionUniqueKey, int isDelete); + + QuestionEntity findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(String projectCode, int questionUniqueKey, int isDelete); + + QuestionEntity findFirstByProjectCodeAndQuestionOrderGreaterThanAndIsDeleteOrderByQuestionOrder(String projectCode, int questionOrder, int isDelete); + + QuestionEntity findFirstByProjectCodeAndQuestionIDAndIsDelete(String projectCode, String questionID, int isDelete); + + int countByProjectCodeAndQuestionOrderGreaterThanAndIsDelete(String projectCode, int startQuestionOrder, int isDelete); + + int countByProjectCodeAndQuestionOrderGreaterThanAndQuestionOrderLessThanEqualAndIsDelete(String projectCode, int startQuestionOrder, int questionOrder, int isDelete); + + List findAllByProjectCodeAndQuestionOrderGreaterThanAndIsDeleteOrderByQuestionOrderAsc(String projectCode, int questionOrder, int isDelete); +} diff --git a/src/main/java/com/krt/sun/repository/quota/QuotaCellRepository.java b/src/main/java/com/krt/sun/repository/quota/QuotaCellRepository.java new file mode 100644 index 0000000..2608cd6 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/quota/QuotaCellRepository.java @@ -0,0 +1,12 @@ +package com.krt.sun.repository.quota; + + +import com.krt.sun.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/sun/repository/quota/QuotaQueryRepository.java b/src/main/java/com/krt/sun/repository/quota/QuotaQueryRepository.java new file mode 100644 index 0000000..1d7da32 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/quota/QuotaQueryRepository.java @@ -0,0 +1,45 @@ +package com.krt.sun.repository.quota; + +import com.krt.sun.dto.quota.QuotaCellDto; +import com.krt.sun.dto.quota.QuotaCellJsonDto; +import com.krt.sun.entity.survey.QSurveyDataEntity; +import com.krt.sun.entity.survey.QSurveyRespondentEntity; +import com.querydsl.core.BooleanBuilder; +import com.querydsl.jpa.JPAExpressions; +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 QSurveyDataEntity qSurveyDataEntity = QSurveyDataEntity.surveyDataEntity; + private QSurveyRespondentEntity qSurveyRespondentEntity = QSurveyRespondentEntity.surveyRespondentEntity; + + //쿼터에 맞는 데이터 총 카운트 가져오기 + public List findQuotaSurveyCount(String projectCode, QuotaCellDto quotaCellDto){ + BooleanBuilder builder = new BooleanBuilder(); + + for(QuotaCellJsonDto quotaCellJsonDto : quotaCellDto.getQuotaInfo()){ + int uk = quotaCellJsonDto.getQuk(); + String value = "\"s\":" + quotaCellJsonDto.getVal() + ","; + builder.or(qSurveyDataEntity.questionUniqueKey.eq(uk).and(qSurveyDataEntity.answerData.contains(value))); + } + + return queryFactory.select(qSurveyDataEntity.answerId) + .from(qSurveyDataEntity) + .join(qSurveyRespondentEntity) + .on(qSurveyDataEntity.projectCode.eq(qSurveyRespondentEntity.projectCode).and(qSurveyDataEntity.answerId.eq(qSurveyRespondentEntity.answerId))) + .where(qSurveyDataEntity.projectCode.eq(projectCode), + qSurveyRespondentEntity.answerState.eq(10), + qSurveyRespondentEntity.surveyTypeCode.ne(99), + builder) + .groupBy(qSurveyDataEntity.answerId) + .having(qSurveyDataEntity.count().goe(quotaCellDto.getQuotaInfo().size())) + .fetch(); + } +} diff --git a/src/main/java/com/krt/sun/repository/quota/QuotaRepository.java b/src/main/java/com/krt/sun/repository/quota/QuotaRepository.java new file mode 100644 index 0000000..dbfa80b --- /dev/null +++ b/src/main/java/com/krt/sun/repository/quota/QuotaRepository.java @@ -0,0 +1,16 @@ +package com.krt.sun.repository.quota; + + +import com.krt.sun.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/sun/repository/survey/SurveyDataQueryRepository.java b/src/main/java/com/krt/sun/repository/survey/SurveyDataQueryRepository.java new file mode 100644 index 0000000..99a478f --- /dev/null +++ b/src/main/java/com/krt/sun/repository/survey/SurveyDataQueryRepository.java @@ -0,0 +1,34 @@ +package com.krt.sun.repository.survey; + +import com.krt.sun.entity.question.QQuestionEntity; +import com.krt.sun.entity.survey.QSurveyDataEntity; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Repository; + +@Repository +@RequiredArgsConstructor +public class SurveyDataQueryRepository { + private final JPAQueryFactory queryFactory; + private QQuestionEntity questionEntity = QQuestionEntity.questionEntity; + private QSurveyDataEntity surveyDataEntity = QSurveyDataEntity.surveyDataEntity; + + public String getLastQid(String pkey, String answerId){ + return queryFactory + .select(questionEntity.questionID) + .from(surveyDataEntity) + .join(questionEntity) + .on( + surveyDataEntity.projectCode.eq(questionEntity.projectCode), + surveyDataEntity.questionUniqueKey.eq(questionEntity.questionUniqueKey) + ) + .where( + surveyDataEntity.projectCode.eq(pkey), + surveyDataEntity.answerId.eq(answerId), + questionEntity.isDelete.eq(0) + ) + .orderBy(surveyDataEntity.idx.desc()) + .limit(1) + .fetchOne(); + } +} diff --git a/src/main/java/com/krt/sun/repository/survey/SurveyDataRepository.java b/src/main/java/com/krt/sun/repository/survey/SurveyDataRepository.java new file mode 100644 index 0000000..6ad457c --- /dev/null +++ b/src/main/java/com/krt/sun/repository/survey/SurveyDataRepository.java @@ -0,0 +1,22 @@ +package com.krt.sun.repository.survey; + +import com.krt.sun.entity.question.QuestionEntity; +import com.krt.sun.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 findByProjectCodeAndAnswerIdAndQuestionUniqueKey(String projectCode, String answerId, int questionUniqueKey); + + SurveyDataEntity findFirstByProjectCodeAndAnswerIdAndQuestionUniqueKey(String projectCode, String answerId, int questionUniqueKey); + + List findByProjectCodeAndAnswerId(String projectCode, String answerId); + + List findByProjectCodeAndAnswerIdOrderByIdx(String projectCode, String answerId); + + List findByProjectCodeAndAnswerIdAndQuestionUniqueKeyNot(String projectCode, String answerId, int questionUniqueKey); + + List findByProjectCodeAndQuestionUniqueKey(String projectCode, int questionUniqueKey); +} diff --git a/src/main/java/com/krt/sun/repository/survey/SurveyRespondentRepository.java b/src/main/java/com/krt/sun/repository/survey/SurveyRespondentRepository.java new file mode 100644 index 0000000..2dd1468 --- /dev/null +++ b/src/main/java/com/krt/sun/repository/survey/SurveyRespondentRepository.java @@ -0,0 +1,15 @@ +package com.krt.sun.repository.survey; + +import com.krt.sun.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); + + SurveyRespondentEntity findByProjectCodeAndAnswerIdContainsAndAnswerState(String projectCode, String answerId, int status); + + List findByProjectCodeAndAnswerIdContainsAndAnswerStateNot(String projectCode, String answerId, int status); +} diff --git a/src/main/java/com/krt/sun/service/CapiService.java b/src/main/java/com/krt/sun/service/CapiService.java new file mode 100644 index 0000000..5f4d900 --- /dev/null +++ b/src/main/java/com/krt/sun/service/CapiService.java @@ -0,0 +1,132 @@ +package com.krt.sun.service; + +import com.krt.sun.dto.capi.*; +import com.krt.sun.dto.project.response.ProjectDto; +import com.krt.sun.entity.capi.InterviewerAssignEntity; +import com.krt.sun.entity.capi.InterviewerDeleteRequestEntity; +import com.krt.sun.entity.capi.InterviewerInfoEntity; +import com.krt.sun.entity.project.ProjectEntity; +import com.krt.sun.entity.question.QuestionEntity; +import com.krt.sun.entity.survey.SurveyRespondentEntity; +import com.krt.sun.repository.capi.CapiAssignRepository; +import com.krt.sun.repository.capi.CapiQueryRepository; +import com.krt.sun.repository.capi.CapiRepository; +import com.krt.sun.repository.capi.CapiSurveyDataDeleteRequestRepository; +import com.krt.sun.repository.project.ProjectRepository; +import com.krt.sun.repository.question.QuestionRepository; +import com.krt.sun.repository.survey.SurveyRespondentRepository; +import com.krt.sun.util.SecurityUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.net.URLDecoder; +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 QuestionRepository questionRepository; + + private final CapiQueryRepository capiQueryRepository; + + + //프로젝트코드 복호화 + private String projectCodeDecrypt(String securityCode) throws Exception { + try{ + return SecurityUtil.decrypt(URLDecoder.decode(securityCode, StandardCharsets.UTF_8)); + }catch (Exception e){ + return securityCode; + } + } + + public CapiLoginResponseDto capiLogin(CapiLoginRequestDto capiLoginRequestDto) { + InterviewerInfoEntity interviewerInfoEntity = capiRepository.findByInterviewerIdAndInterviewerPwd(capiLoginRequestDto.getLoginId(), capiLoginRequestDto.getLoginPwd()); + + return CapiLoginResponseDto.of(interviewerInfoEntity); + } + + public List getProjectList(GetInterviewerAssignProjectRequestDto getInterviewerAssignProjectRequestDto) { + List projectEntityList = new ArrayList<>(); + + if(getInterviewerAssignProjectRequestDto.getInterviewerCode() != null && !getInterviewerAssignProjectRequestDto.getInterviewerCode().equals("")){ + List assignProjectList = capiAssignRepository.findByInterviewerId(getInterviewerAssignProjectRequestDto.getInterviewerCode()).stream() + .map(InterviewerAssignEntity::getProjectCode) + .collect(Collectors.toList()); + + projectEntityList = projectRepository.findByCodeInAndIsDelete(assignProjectList, 0); + }else{ + projectEntityList = projectRepository.findByIsDelete(0); + } + + + return projectEntityList.stream().map(ProjectDto::of).collect(Collectors.toList()); + } + + public Map getInterviewerSurveyDetail(GetInterviewerSurveyDetailRequestDto getInterviewerSurveyDetailRequestDto) { + //문항정보 + List questionEntityList = questionRepository.findAllByProjectCodeAndQuestionOrderGreaterThanAndIsDeleteOrderByQuestionOrderAsc(getInterviewerSurveyDetailRequestDto.getProjectCode(), -1, 0); + + LinkedHashMap questionIDList = new LinkedHashMap<>(); + + for(QuestionEntity questionEntity : questionEntityList){ + questionIDList.put(questionEntity.getQuestionUniqueKey(), questionEntity.getQuestionID()); + } + + // 진행한 데이터 정보 리스트 + List surveyRespondentEntityList = capiQueryRepository.findSurveyRespondentList(getInterviewerSurveyDetailRequestDto); + List surveyRespondentDtoList = new ArrayList<>(); + + for(GetSurveyDetailResponseDto surveyRespondentEntity : surveyRespondentEntityList){ + surveyRespondentEntity.setAnswerEndQuestionId(questionIDList.get(surveyRespondentEntity.getAnswerEndQuestionUniqueKey())); + + surveyRespondentDtoList.add(surveyRespondentEntity); + } + + // 상태별 카운트 + GetSurveyStatusCountResponseDto getSurveyStatusCountResponseDto = new GetSurveyStatusCountResponseDto(); + getSurveyStatusCountResponseDto.filteringCount(surveyRespondentEntityList); + + Map interviewerSurveyDetail = new HashMap<>(); + + interviewerSurveyDetail.put("statusCount", getSurveyStatusCountResponseDto); + interviewerSurveyDetail.put("progressSurveyList", surveyRespondentDtoList); + + return interviewerSurveyDetail; + } + + public void surveyDataDeleteRequest(DeleteSurveyDataRequestDto deleteSurveyDataRequestDto) { + InterviewerDeleteRequestEntity interviewerDeleteRequestEntity = InterviewerDeleteRequestEntity.toEntity(deleteSurveyDataRequestDto); + + capiSurveyDataDeleteRequestRepository.save(interviewerDeleteRequestEntity); + } + + public void surveyDataDeleteCancel(SurveyDataDeleteCancelRequestDto surveyDataDeleteCancelRequestDto) { + InterviewerDeleteRequestEntity interviewerDeleteRequestEntity = capiSurveyDataDeleteRequestRepository.findByProjectCodeAndAnswerIdAndResult(surveyDataDeleteCancelRequestDto.getProjectCode(), surveyDataDeleteCancelRequestDto.getAnswerId(), 0); + + if(interviewerDeleteRequestEntity != null){ + capiSurveyDataDeleteRequestRepository.deleteById((long) interviewerDeleteRequestEntity.getIdx()); + } + } + + public void getProgressQuota(String project_code) { + + } + + public void setDataRestart(GetRestartDataRequestDto getRestartDataRequestDto) throws Exception { + getRestartDataRequestDto.setProjectCode(projectCodeDecrypt(getRestartDataRequestDto.getProjectCode())); + + SurveyRespondentEntity respondentEntity = surveyRespondentRepository.findByProjectCodeAndAnswerIdContainsAndAnswerState(getRestartDataRequestDto.getProjectCode() , getRestartDataRequestDto.getAnswerId(), 1); + + if(respondentEntity != null){ + capiQueryRepository.changeAnswerStatus(getRestartDataRequestDto); + } + } +} diff --git a/src/main/java/com/krt/sun/service/HardCodeService.java b/src/main/java/com/krt/sun/service/HardCodeService.java new file mode 100644 index 0000000..924dc22 --- /dev/null +++ b/src/main/java/com/krt/sun/service/HardCodeService.java @@ -0,0 +1,164 @@ +package com.krt.sun.service; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.sun.dto.hardcode.AnswerUserInfoDto; +import com.krt.sun.dto.hardcode.HardCodeDto; +import com.krt.sun.dto.hardcode.HardCodeRequestInfoDto; +import com.krt.sun.dto.question.label.QuestionLabelInfoDto; +import com.krt.sun.dto.question.label.QuestionLabelJsonDto; +import com.krt.sun.dto.question.label.QuestionLabelOptionDto; +import com.krt.sun.dto.survey.response.SurveyDataStructureDto; +import com.krt.sun.entity.hardcode.HardCodeEntity; +import com.krt.sun.entity.question.QuestionEntity; +import com.krt.sun.entity.question.QuestionLabelEntity; +import com.krt.sun.entity.survey.SurveyDataEntity; +import com.krt.sun.repository.hardcode.HardCodeHistoryRepository; +import com.krt.sun.repository.hardcode.HardCodeRepository; +import com.krt.sun.repository.question.QuestionLabelRepository; +import com.krt.sun.repository.question.QuestionRepository; +import com.krt.sun.repository.survey.SurveyDataRepository; +import com.krt.sun.util.SecurityUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.lang.reflect.Type; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.*; + +@Service +@Transactional +@RequiredArgsConstructor +public class HardCodeService { + + private final HardCodeRepository hardCodeRepository; + private final SurveyDataRepository surveyDataRepository; + private final QuestionRepository questionRepository; + private final QuestionLabelRepository questionLabelRepository; + + //프로젝트코드 복호화 + private String projectCodeDecrypt(String securityCode) throws Exception { + return SecurityUtil.decrypt(URLDecoder.decode(securityCode, StandardCharsets.UTF_8)); + } + + //문항QID -> UniqueKey 변경 + private int getQuestionUniqueKey(String securityCode, String questionId) { + QuestionEntity questionEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(securityCode, questionId, 0); + + if(questionEntity != null) { + return questionEntity.getQuestionUniqueKey(); + }else { + return -99; + } + } + + //문항차원에 맞춰 데이터 반환 + private List answerDataListFiltering(String questionDimension, List answerDataList) throws Exception { + //차원 배열 + List questionDimensionList = Arrays.stream(questionDimension.toLowerCase().split("[\\|]")) + .filter(e -> !e.equals("")) + .map(String::trim) + .toList(); + + //차원 배열에 맞는 데이터 필터링 + for(String qd : questionDimensionList) { + String structure = qd.replaceAll("[\\d]", ""); + int value = Integer.parseInt(qd.replaceAll("[\\D]", "")); + + switch (structure) { + case "t" -> answerDataList = answerDataList.stream().filter(e -> e.getT() == value).toList(); + case "m" -> answerDataList = answerDataList.stream().filter(e -> e.getM() == value).toList(); + case "s" -> answerDataList = answerDataList.stream().filter(e -> e.getS() == value).toList(); + case "r" -> answerDataList = answerDataList.stream().filter(e -> e.getR() == value).toList(); + } + } + + return answerDataList; + } + + + public HardCodeDto getHardCode(HardCodeRequestInfoDto hardCodeRequestInfoDto) throws Exception { + hardCodeRequestInfoDto.setSecurityCode(projectCodeDecrypt(hardCodeRequestInfoDto.getSecurityCode())); + + HardCodeEntity hardCodeEntity = hardCodeRepository.findByProjectCodeAndQuestionUniqueKeyAndHardCodeType( + hardCodeRequestInfoDto.getSecurityCode(), + hardCodeRequestInfoDto.getQuestionUniqueKey(), + hardCodeRequestInfoDto.getType() + ); + + if(hardCodeEntity != null) { + return hardCodeEntity.of(hardCodeEntity); + }else { + return null; + } + } + + public List getValue(AnswerUserInfoDto answerUserInfoDto) throws Exception { + answerUserInfoDto.setSecurityCode(projectCodeDecrypt(answerUserInfoDto.getSecurityCode())); + answerUserInfoDto.setQuestionUniqueKey(getQuestionUniqueKey(answerUserInfoDto.getSecurityCode(), answerUserInfoDto.getQuestionId())); + + SurveyDataEntity surveyDataEntity = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKey( + answerUserInfoDto.getSecurityCode(), + answerUserInfoDto.getAnswerId(), + answerUserInfoDto.getQuestionUniqueKey() + ); + + if(surveyDataEntity != null) { + Gson gson = new Gson(); + Type surveyDataType = new TypeToken>(){}.getType(); + List answerDataList = gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType); + + answerDataList = answerDataListFiltering(answerUserInfoDto.getQuestionDimension(), answerDataList); + + return answerDataList; + } + + return null; + } + + public Set getLabel(AnswerUserInfoDto answerUserInfoDto) throws Exception { + answerUserInfoDto.setSecurityCode(projectCodeDecrypt(answerUserInfoDto.getSecurityCode())); + answerUserInfoDto.setQuestionUniqueKey(getQuestionUniqueKey(answerUserInfoDto.getSecurityCode(), answerUserInfoDto.getQuestionId())); + + SurveyDataEntity surveyDataEntity = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKey( + answerUserInfoDto.getSecurityCode(), + answerUserInfoDto.getAnswerId(), + answerUserInfoDto.getQuestionUniqueKey() + ); + + if(surveyDataEntity != null) { + + Gson gson = new Gson(); + Type surveyDataType = new TypeToken>(){}.getType(); + + Set answerLabelList = new LinkedHashSet<>(); + List answerDataList = gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType); + + answerDataList = answerDataListFiltering(answerUserInfoDto.getQuestionDimension(), answerDataList); + + //라벨 정보 가져오기 + QuestionLabelEntity questionLabelEntity = questionLabelRepository.findByProjectCodeAndQuestionUniqueKeyAndLabelDimension( + answerUserInfoDto.getSecurityCode(), + answerUserInfoDto.getQuestionUniqueKey(), + 1 + ); + + if(questionLabelEntity != null){ + Type listType = new TypeToken>(){}.getType(); + List labelInfoDtoList = gson.fromJson(questionLabelEntity.getLabelInfo(), listType); + + for(SurveyDataStructureDto sds : answerDataList) { + for(QuestionLabelInfoDto qli : labelInfoDtoList) { + if(qli.getValue() == sds.getS()) answerLabelList.add(qli.getLabel()); + } + } + + return answerLabelList; + } + } + + return null; + } +} diff --git a/src/main/java/com/krt/sun/service/IpAccessControlService.java b/src/main/java/com/krt/sun/service/IpAccessControlService.java new file mode 100644 index 0000000..82c9a01 --- /dev/null +++ b/src/main/java/com/krt/sun/service/IpAccessControlService.java @@ -0,0 +1,23 @@ +package com.krt.sun.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") + ); + + return ipAddressMatchers.stream().anyMatch(matcher -> matcher.matches(ipAddress)); + } +} diff --git a/src/main/java/com/krt/sun/service/ProjectService.java b/src/main/java/com/krt/sun/service/ProjectService.java new file mode 100644 index 0000000..1500ed7 --- /dev/null +++ b/src/main/java/com/krt/sun/service/ProjectService.java @@ -0,0 +1,66 @@ +package com.krt.sun.service; + +import com.krt.sun.dto.project.common.ProjectOptionElementDto; +import com.krt.sun.dto.project.response.OptionElementDto; +import com.krt.sun.dto.project.response.ProjectOptionDto; +import com.krt.sun.dto.project.response.ProjectSurveyInfoDto; +import com.krt.sun.entity.project.ProjectEntity; +import com.krt.sun.repository.project.ProjectQueryRepository; +import com.krt.sun.repository.project.ProjectRepository; +import com.krt.sun.repository.project.ProjectResponseRepository; +import com.krt.sun.repository.project.ProjectStyleRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.stream.Collectors; + +@Service +@RequiredArgsConstructor +public class ProjectService { + private final ProjectRepository projectRepository; + private final ProjectQueryRepository projectQueryRepository; + private final ProjectStyleRepository projectStyleRepository; + private final ProjectResponseRepository projectResponseRepository; + + public ProjectSurveyInfoDto getSurveyInfo(String projectCode){ + ProjectEntity projectEntity = projectRepository.findFirstByCodeAndIsDelete(projectCode, 0); + List projectParameterList = projectQueryRepository.getParameterNameList(projectCode); + List projectStyleList = projectQueryRepository.getProjectStyleList(projectCode); + List projectResponseList = projectQueryRepository.getProjectResponseList(projectCode); + + boolean acceptBack = projectResponseList.stream().anyMatch(x -> x.getOption_code() == 110 && x.getOption_value().equals("1")); + List acceptDevice = projectResponseList.stream().filter(x -> + x.getOption_code() > 200 && x.getOption_code() < 300 && x.getOption_value().equals("1") + ).map(ProjectOptionElementDto::getOption_code).toList(); + + return ProjectSurveyInfoDto.of(projectEntity.getCode(), projectEntity.getSurveyTitle(), projectEntity.getState(), projectEntity.getCompany(), acceptBack, projectParameterList, acceptDevice, projectStyleList); + } + + @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(); + } + + @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(); + } +} diff --git a/src/main/java/com/krt/sun/service/QuestionService.java b/src/main/java/com/krt/sun/service/QuestionService.java new file mode 100644 index 0000000..388d56e --- /dev/null +++ b/src/main/java/com/krt/sun/service/QuestionService.java @@ -0,0 +1,518 @@ +package com.krt.sun.service; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.sun.dto.question.common.QuestionLogicJsonDto; +import com.krt.sun.dto.question.common.QuestionOptionValueJsonDto; +import com.krt.sun.dto.question.label.QuestionLabelInfoDto; +import com.krt.sun.dto.question.label.QuestionLabelJsonDto; +import com.krt.sun.dto.question.label.QuestionLabelOptionApplyDto; +import com.krt.sun.dto.question.label.QuestionLabelOptionDto; +import com.krt.sun.dto.question.response.QuestionInfoDto; +import com.krt.sun.dto.question.response.QuestionNavigationDto; +import com.krt.sun.dto.survey.response.SurveyDataStructureDto; +import com.krt.sun.entity.question.*; +import com.krt.sun.entity.survey.SurveyDataEntity; +import com.krt.sun.repository.question.*; +import com.krt.sun.repository.survey.SurveyDataRepository; +import com.krt.sun.util.RegexLabel; +import com.krt.sun.util.RegexLogic; +import lombok.RequiredArgsConstructor; +import org.aspectj.weaver.patterns.TypePatternQuestions; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.lang.reflect.Type; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +@Service +@RequiredArgsConstructor +public class QuestionService { + + private final QuestionRepository questionRepository; + private final QuestionLogicRepository questionLogicRepository; + private final QuestionLabelRepository questionLabelRepository; + private final QuestionOptionRepository questionOptionRepository; + private final SurveyDataRepository surveyDataRepository; + private final QuestionBlockCollectionRepository questionBlockCollectionRepository; + private final QuestionBolckOptionRepository questionBolckOptionRepository; + + private final RegexLabel regexLabel; + + public List getQuestionUniqueKeyList(String projectCode){ + return questionRepository.findByProjectCodeAndIsDelete(projectCode,0) + .stream() + .map(QuestionEntity::getQuestionUniqueKey) + .collect(Collectors.toList()); + } + + @Transactional(readOnly = true) + public List getQuestionNavigation(String projectCode){ + List questionNavigationList = questionRepository.findByProjectCodeAndIsDelete(projectCode,0).stream().map(QuestionNavigationDto::of).toList(); + + for(QuestionNavigationDto questionNavigationDto : questionNavigationList){ + questionNavigationDto = setQuestionLogic(projectCode, questionNavigationDto); + questionNavigationDto.setProgress_percent(getProgressPercent(projectCode, questionNavigationDto.getQuestion_order())); + } + + return questionNavigationList; + } + + public List getQuestionInfoList(String projectCode){ + List questionInfoList = questionRepository.findByProjectCodeAndIsDeleteOrderByQuestionOrder(projectCode,0) + .stream() + .map(QuestionInfoDto::of) + .toList(); + + for(QuestionInfoDto questionInfoDto : questionInfoList){ + questionInfoDto = setQuestionLabelJson(projectCode, questionInfoDto, null); + //라벨치환 + regexLabel.UniqueKeyToQuestionIdChange(projectCode, questionInfoDto); + //옵션정보 + questionInfoDto.setQuestion_option(getQuestionOptionValueJson(projectCode, questionInfoDto.getQuestion_unique_key())); + //블록ID + QuestionBlockCollectEntity questionBlockCollectEntity = questionBlockCollectionRepository.findByProjectCodeAndQuestionUniqueKey(projectCode, questionInfoDto.getQuestion_unique_key()); + + if(questionBlockCollectEntity != null){ + questionInfoDto.setBlock_id(questionBlockCollectEntity.getBlockCode()); + questionInfoDto.setQuestion_block_option(getQuestionBlockOptionValueJson(projectCode, questionInfoDto.getBlock_id())); + } + } + + return questionInfoList; + } + + public List getQuestionInfo(String projectCode, int questionUniqueKey){ + QuestionInfoDto questionInfoDto = questionRepository.findByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, questionUniqueKey,0) + .map(QuestionInfoDto::of) + .orElseThrow(); + + questionInfoDto = setQuestionLabelJson(projectCode, questionInfoDto, null); + questionInfoDto.setQuestion_option(getQuestionOptionValueJson(projectCode, questionInfoDto.getQuestion_unique_key())); + questionInfoDto.setQuestion_block_option(getQuestionBlockOptionValueJson(projectCode, questionInfoDto.getBlock_id())); + + List questionInfoList = new ArrayList<>(); + questionInfoList.add(questionInfoDto); + + return questionInfoList; + } + + public QuestionInfoDto setQuestionLabelJson(String projectCode,QuestionInfoDto questionInfoDto, String answerId){ + int questionUniqueKey = questionInfoDto.getQuestion_unique_key(); + int questionDimension = questionInfoDto.getQuestion_dimension(); + + QuestionLabelOptionApplyDto qloApply = new QuestionLabelOptionApplyDto(projectCode, answerId, "", "", null); + + QuestionLabelEntity questionLabelEntity = questionLabelRepository.findByProjectCodeAndQuestionUniqueKeyAndLabelDimension(projectCode, questionUniqueKey, 1); + + QuestionLabelOptionDto questionLabelOptionDto = new QuestionLabelOptionDto().of(questionLabelEntity); + + if(questionDimension >= 1){ + QuestionLabelJsonDto scalarLabelJsonDto = getQuestionLabelJsonDto(projectCode, questionUniqueKey, 1); + + if(scalarLabelJsonDto != null){ + qloApply.setAccept_question(scalarLabelJsonDto.getLabel_option().getAccept_question()); + qloApply.setExcept_question(scalarLabelJsonDto.getLabel_option().getExcept_question()); + qloApply.setLabel_info(scalarLabelJsonDto.getLabel_info()); + + scalarLabelJsonDto.getLabel_option().setAccept_question(getQuestionIdWithQuestionUniqueKey(projectCode, scalarLabelJsonDto.getLabel_option().getAccept_question())); + scalarLabelJsonDto.getLabel_option().setExcept_question(getQuestionIdWithQuestionUniqueKey(projectCode, scalarLabelJsonDto.getLabel_option().getExcept_question())); + + questionInfoDto.setScalar_label(scalarLabelJsonDto); + + questionInfoDto.getScalar_label().setLabel_info(LabelOptionApplyList(qloApply, questionLabelOptionDto)); + } + } + if(questionDimension >= 2){ + QuestionLabelJsonDto matrixLabelJsonDto = getQuestionLabelJsonDto(projectCode, questionUniqueKey, 2); + + if(matrixLabelJsonDto != null){ + qloApply.setAccept_question(matrixLabelJsonDto.getLabel_option().getAccept_question()); + qloApply.setExcept_question(matrixLabelJsonDto.getLabel_option().getExcept_question()); + qloApply.setLabel_info(matrixLabelJsonDto.getLabel_info()); + + matrixLabelJsonDto.getLabel_option().setAccept_question(getQuestionIdWithQuestionUniqueKey(projectCode, matrixLabelJsonDto.getLabel_option().getAccept_question())); + matrixLabelJsonDto.getLabel_option().setExcept_question(getQuestionIdWithQuestionUniqueKey(projectCode, matrixLabelJsonDto.getLabel_option().getExcept_question())); + + questionInfoDto.setMatrix_label(matrixLabelJsonDto); + + questionInfoDto.getMatrix_label().setLabel_info(LabelOptionApplyList(qloApply, questionLabelOptionDto)); + } + } + if(questionDimension >= 3){ + QuestionLabelJsonDto tensorLabelJsonDto = getQuestionLabelJsonDto(projectCode, questionUniqueKey, 3); + + if(tensorLabelJsonDto != null){ + qloApply.setAccept_question(tensorLabelJsonDto.getLabel_option().getAccept_question()); + qloApply.setExcept_question(tensorLabelJsonDto.getLabel_option().getExcept_question()); + qloApply.setLabel_info(tensorLabelJsonDto.getLabel_info()); + + tensorLabelJsonDto.getLabel_option().setAccept_question(getQuestionIdWithQuestionUniqueKey(projectCode, tensorLabelJsonDto.getLabel_option().getAccept_question())); + tensorLabelJsonDto.getLabel_option().setExcept_question(getQuestionIdWithQuestionUniqueKey(projectCode, tensorLabelJsonDto.getLabel_option().getExcept_question())); + + questionInfoDto.setTensor_label(tensorLabelJsonDto); + + questionInfoDto.getTensor_label().setLabel_info(LabelOptionApplyList(qloApply, questionLabelOptionDto)); + } + } + + return questionInfoDto; + } + + public QuestionLabelJsonDto getQuestionLabelJsonDto(String projectCode, int questionUniqueKey, int labelDimension){ + QuestionLabelEntity questionLabelEntity = questionLabelRepository.findByProjectCodeAndQuestionUniqueKeyAndLabelDimension(projectCode, questionUniqueKey, labelDimension); + if(questionLabelEntity != null){ + Gson gson = new Gson(); + Type listType = new TypeToken>(){}.getType(); + List labelInfoDtoList = gson.fromJson(questionLabelEntity.getLabelInfo(), listType); + QuestionLabelOptionDto labelOptionDto = gson.fromJson(questionLabelEntity.getLabelOption(), QuestionLabelOptionDto.class); + + return new QuestionLabelJsonDto(labelInfoDtoList, labelOptionDto); + } + + return null; + } + + public List getQuestionOptionValueJson(String projectCode, int questionUniqueKey){ + List questionOptionValueJsonList = new ArrayList<>(); + QuestionOptionEntity questionOptionEntity = questionOptionRepository.findByProjectCodeAndQuestionUniqueKey(projectCode, questionUniqueKey); + + if(questionOptionEntity != null){ + Gson gson = new Gson(); + Type listType = new TypeToken>(){}.getType(); + questionOptionValueJsonList = gson.fromJson(questionOptionEntity.getOptionValue(), listType); + } + + return questionOptionValueJsonList; + } + + public List getQuestionBlockOptionValueJson(String projectCode, int blockCode){ + List questionBlockOptionValueJsonList = new ArrayList<>(); + QuestionBlockOptionEntity questionBlockOptionEntity = questionBolckOptionRepository.findByProjectCodeAndBlockCode(projectCode, blockCode); + + if(questionBlockOptionEntity != null){ + Gson gson = new Gson(); + Type listType = new TypeToken>(){}.getType(); + questionBlockOptionValueJsonList = gson.fromJson(questionBlockOptionEntity.getOptionValue(), listType); + } + + List blockOptionChangeList = new ArrayList<>(); + for(QuestionOptionValueJsonDto blockOption : questionBlockOptionValueJsonList){ + if(blockOption.getOption_code().equals("10") && blockOption.getType_code().equals("01") && blockOption.getDetail_code().equals("03")){ + blockOption.setValue(questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, Integer.parseInt(blockOption.getValue()), 0).getQuestionID()); + } + + blockOptionChangeList.add(blockOption); + } + + return blockOptionChangeList; + } + + public String getQuestionIdWithQuestionUniqueKey(String projectCode, String questionUniqueKeyString){ + String questionId = ""; + + if(!questionUniqueKeyString.isEmpty()){ + + String matchUniqueKey = questionUniqueKeyString.replaceAll("(\\[.*?\\])?(\\((.*?)\\))?(\\{(.*?)\\})?", ""); + + QuestionEntity questionEntity = questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, Integer.parseInt(matchUniqueKey),0); + if(questionEntity != null){ + questionId = questionUniqueKeyString.replaceFirst(matchUniqueKey, String.valueOf(questionEntity.getQuestionID())); + } + } + + return questionId; + } + + public List LabelOptionApplyList(QuestionLabelOptionApplyDto questionLabelOptionApplyDto, QuestionLabelOptionDto questionLabelOptionDto) { + + Gson gson = new Gson(); + Type surveyDataType = new TypeToken>(){}.getType(); + List surveyDataDtoList = null; + Iterator questionLabelInfoDtoIterator = null; + SurveyDataEntity surveyDataEntity = null; + + int includeChk = 0; + + //보여주기 + if(!questionLabelOptionApplyDto.getAccept_question().isEmpty()) { + surveyDataEntity = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKey( + questionLabelOptionApplyDto.getProject_code(), + questionLabelOptionApplyDto.getAnswerId(), + Integer.parseInt(questionLabelOptionApplyDto.getAccept_question().replaceAll("(\\[.*?\\])?(\\((.*?)\\))?(\\{(.*?)\\})?", "")) + ); + + if(surveyDataEntity != null){ + surveyDataDtoList = gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType); + questionLabelInfoDtoIterator = questionLabelOptionApplyDto.getLabel_info().iterator(); + + List fixCodeList = new ArrayList<>(); + String structureText = null, conditionText = null; + + //고정코드 + Matcher fixCodeMatcher = Pattern.compile("\\((.*?)\\)").matcher(questionLabelOptionApplyDto.getAccept_question()); + fixCodeList = new ArrayList<>(); + + if(fixCodeMatcher.find()){ + fixCodeList = Arrays.stream(fixCodeMatcher.group(1).replaceAll("[\\(\\)]", "").split(",")).map(Integer::parseInt).toList(); + } + + //데이터 속성 + Matcher structureMatcher = Pattern.compile("\\[(.*?)\\]").matcher(questionLabelOptionApplyDto.getAccept_question()); + structureText = null; + + if(structureMatcher.find()){ + structureText = structureMatcher.group(1); + } + + //데이터 조건 + Matcher conditionMatcher = Pattern.compile("\\{(.*?)\\}").matcher(questionLabelOptionApplyDto.getAccept_question()); + conditionText = null; + + if(conditionMatcher.find()){ + conditionText = conditionMatcher.group(1); + } + + while(questionLabelInfoDtoIterator.hasNext()){ + QuestionLabelInfoDto qli = questionLabelInfoDtoIterator.next(); + includeChk = 0; + + for(SurveyDataStructureDto sds : surveyDataDtoList){ + + //고정값 + if(fixCodeList.contains(qli.getValue())) includeChk++; + + //속성값 있는지 matrix / tensor + if(structureText != null && conditionText != null){ + if(structureText.equals("T")){ + if(qli.getValue() == sds.getT() && checkCondition(sds.getS(), conditionText)) includeChk++; + }else if(structureText.equals("M")){ + if(qli.getValue() == sds.getM() && checkCondition(sds.getS(), conditionText)) includeChk++; + }else{ + if(qli.getValue() == sds.getS() && checkCondition(sds.getS(), conditionText)) includeChk++; + } + }else if(structureText != null){ + if(structureText.equals("T")){ + if(qli.getValue() == sds.getT() && qli.getValue() == sds.getS()) includeChk++; + }else if(structureText.equals("M")){ + if(qli.getValue() == sds.getM() && qli.getValue() == sds.getS()) includeChk++; + }else{ + if(qli.getValue() == sds.getS() && qli.getValue() == sds.getS()) includeChk++; + } + }else if(conditionText != null){ + if(checkCondition(sds.getS(), conditionText) && qli.getValue() == sds.getS()) includeChk++; + }else{ + if(qli.getValue() == sds.getS()) includeChk++; + } + } + + if(includeChk == 0) questionLabelInfoDtoIterator.remove(); + } + } + } + + //제외하기 + if(!questionLabelOptionApplyDto.getExcept_question().isEmpty()) { + + surveyDataEntity = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKey( + questionLabelOptionApplyDto.getProject_code(), + questionLabelOptionApplyDto.getAnswerId(), + Integer.parseInt(questionLabelOptionApplyDto.getExcept_question().replaceAll("(\\[.*?\\])?(\\((.*?)\\))?(\\{(.*?)\\})?", "")) + ); + + if(surveyDataEntity != null){ + surveyDataDtoList = gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType); + questionLabelInfoDtoIterator = questionLabelOptionApplyDto.getLabel_info().iterator(); + + List fixCodeList = new ArrayList<>(); + String structureText = null, conditionText = null; + + //고정코드 + Matcher fixCodeMatcher = Pattern.compile("\\((.*?)\\)").matcher(questionLabelOptionApplyDto.getExcept_question()); + fixCodeList = new ArrayList<>(); + + if(fixCodeMatcher.find()){ + fixCodeList = Arrays.stream(fixCodeMatcher.group(1).replaceAll("[\\(\\)]", "").split(",")).map(Integer::parseInt).toList(); + } + + //데이터 속성 + Matcher structureMatcher = Pattern.compile("\\[(.*?)\\]").matcher(questionLabelOptionApplyDto.getExcept_question()); + structureText = null; + + if(structureMatcher.find()){ + structureText = structureMatcher.group(1); + } + + //데이터 조건 + Matcher conditionMatcher = Pattern.compile("\\{(.*?)\\}").matcher(questionLabelOptionApplyDto.getExcept_question()); + conditionText = null; + + if(conditionMatcher.find()){ + conditionText = conditionMatcher.group(1); + } + + System.out.println(fixCodeList); + System.out.println(structureText); + System.out.println(conditionText); + + while(questionLabelInfoDtoIterator.hasNext()){ + QuestionLabelInfoDto qli = questionLabelInfoDtoIterator.next(); + includeChk = 0; + + for(SurveyDataStructureDto sds : surveyDataDtoList){ + //속성값 있는지 matrix / tensor + if(structureText != null && conditionText != null){ + if(structureText.equals("T")){ + if(qli.getValue() == sds.getT() && checkCondition(sds.getS(), conditionText)) includeChk++; + }else if(structureText.equals("M")){ + if(qli.getValue() == sds.getM() && checkCondition(sds.getS(), conditionText)) includeChk++; + }else{ + if(qli.getValue() == sds.getS() && checkCondition(sds.getS(), conditionText)) includeChk++; + } + }else if(structureText != null){ + if(structureText.equals("T")){ + if(qli.getValue() == sds.getT() && qli.getValue() == sds.getS()) includeChk++; + }else if(structureText.equals("M")){ + if(qli.getValue() == sds.getM() && qli.getValue() == sds.getS()) includeChk++; + }else{ + if(qli.getValue() == sds.getS() && qli.getValue() == sds.getS()) includeChk++; + } + }else if(conditionText != null){ + if(checkCondition(sds.getS(), conditionText) && qli.getValue() == sds.getS()) includeChk++; + }else{ + if(qli.getValue() == sds.getS()) includeChk++; + } + } + + //고정값 + if(fixCodeList.contains(qli.getValue())) includeChk = 0; + + if(includeChk > 0) questionLabelInfoDtoIterator.remove(); + } + } + } + + return questionLabelOptionApplyDto.getLabel_info(); + } + + private QuestionNavigationDto setQuestionLogic(String projectCode,QuestionNavigationDto questionNavigationDto){ + Gson gson = new Gson(); + QuestionLogicEntity questionLogicEntity = questionLogicRepository.findByProjectCodeAndQuestionUniqueKey(projectCode, questionNavigationDto.getQuestion_unique_key()); + + if(questionLogicEntity!= null) { + if(!Objects.equals(questionLogicEntity.getBeforeLogic(), "[]") && !questionLogicEntity.getBeforeLogic().isEmpty()){ + List beforeLogicJsonList = gson.fromJson(questionLogicEntity.getBeforeLogic(), new TypeToken>(){}.getType()); + beforeLogicJsonList = recoverQuestionId(projectCode, beforeLogicJsonList); + questionNavigationDto.setBefore_logic(beforeLogicJsonList); + } + + if(!Objects.equals(questionLogicEntity.getAfterLogic(), "[]") && !questionLogicEntity.getAfterLogic().isEmpty()){ + List afterLogicJsonList = gson.fromJson(questionLogicEntity.getAfterLogic(), new TypeToken>(){}.getType()); + afterLogicJsonList = recoverQuestionId(projectCode, afterLogicJsonList); + questionNavigationDto.setAfter_logic(afterLogicJsonList); + } + } + + return questionNavigationDto; + } + + private 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 int getProgressPercent(String projectCode, int questionOrder){ + if(questionOrder == -1) return 100; + + int totalQuestionCount = questionRepository.countByProjectCodeAndQuestionOrderGreaterThanAndIsDelete(projectCode,0, 0); + int progressCount = questionRepository.countByProjectCodeAndQuestionOrderGreaterThanAndQuestionOrderLessThanEqualAndIsDelete(projectCode,0, questionOrder, 0); + + return (progressCount*100/totalQuestionCount); + } + + private boolean checkCondition(int resValue, String condition){ + + Matcher matcher = Pattern.compile("([<>]=?|==|!=|=)(\\d+)").matcher(condition); + + boolean conditionFlag = false; + + if(matcher.find()){ + String operator = matcher.group(1); + int compValue = Integer.parseInt(matcher.group(2)); + + switch (operator){ + case "=" -> { + if(resValue == compValue){ + conditionFlag = true; + } + } + + case "!=" -> { + if(resValue != compValue){ + conditionFlag = true; + } + } + + case "<" -> { + if(resValue < compValue){ + conditionFlag = true; + } + } + + case "<=" -> { + if(resValue <= compValue){ + conditionFlag = true; + } + } + + case ">" -> { + if(resValue > compValue){ + conditionFlag = true; + } + } + + case ">=" -> { + if(resValue >= compValue){ + conditionFlag = true; + } + } + } + + } + + + return conditionFlag; + } + +} diff --git a/src/main/java/com/krt/sun/service/SurveyService.java b/src/main/java/com/krt/sun/service/SurveyService.java new file mode 100644 index 0000000..cee9121 --- /dev/null +++ b/src/main/java/com/krt/sun/service/SurveyService.java @@ -0,0 +1,1865 @@ +package com.krt.sun.service; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.sun.dto.list.ListContentGetResponseDto; +import com.krt.sun.dto.question.common.QuestionLogicJsonDto; +import com.krt.sun.dto.question.label.QuestionLabelInfoDto; +import com.krt.sun.dto.question.label.QuestionLabelJsonDto; +import com.krt.sun.dto.question.label.QuestionLabelOptionDto; +import com.krt.sun.dto.question.response.QuestionInfoDto; +import com.krt.sun.dto.question.response.QuestionOptionDto; +import com.krt.sun.dto.quota.QuotaCellDto; +import com.krt.sun.dto.quota.QuotaCellJsonDto; +import com.krt.sun.dto.quota.QuotaListDto; +import com.krt.sun.dto.redirect.RedirectDto; +import com.krt.sun.dto.survey.common.SurveyInfo; +import com.krt.sun.dto.survey.request.DataSaveDto; +import com.krt.sun.dto.survey.request.GangLoginRequestDto; +import com.krt.sun.dto.survey.request.IndexParameterDto; +import com.krt.sun.dto.survey.response.*; +import com.krt.sun.entity.autorecode.AutoRecodeEntity; +import com.krt.sun.entity.list.*; +import com.krt.sun.entity.project.ProjectParameterEntity; +import com.krt.sun.entity.project.ProjectRedirectEntity; +import com.krt.sun.entity.question.*; +import com.krt.sun.entity.survey.SurveyBlockLoopEntity; +import com.krt.sun.entity.survey.SurveyDataEntity; +import com.krt.sun.entity.survey.SurveyRespondentEntity; +import com.krt.sun.enums.AnswerStateEnum; +import com.krt.sun.enums.SurveyTypeEnum; +import com.krt.sun.exception.ApiException; +import com.krt.sun.exception.TextException; +import com.krt.sun.repository.autorecode.AutoRecodeRepository; +import com.krt.sun.repository.list.*; +import com.krt.sun.repository.project.ProjectParameterRepository; +import com.krt.sun.repository.project.ProjectRedirectRepository; +import com.krt.sun.repository.question.*; +import com.krt.sun.repository.quota.QuotaCellRepository; +import com.krt.sun.repository.quota.QuotaQueryRepository; +import com.krt.sun.repository.quota.QuotaRepository; +import com.krt.sun.repository.survey.SurveyDataQueryRepository; +import com.krt.sun.repository.survey.SurveyDataRepository; +import com.krt.sun.repository.survey.SurveyRespondentRepository; +import com.krt.sun.util.*; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; +import jakarta.persistence.Query; +import lombok.RequiredArgsConstructor; +import org.graalvm.polyglot.Engine; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.lang.reflect.Type; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import org.graalvm.polyglot.Context; +import org.graalvm.polyglot.Value; + +@Service +@Transactional +@RequiredArgsConstructor +public class SurveyService { + + @PersistenceContext + private EntityManager entityManager; + + private final QuestionService questionService; + + private final QuestionRepository questionRepository; + private final QuestionLabelRepository questionLabelRepository; + private final QuestionLogicRepository questionLogicRepository; + private final QuestionOptionRepository questionOptionRepository; + private final SurveyRespondentRepository surveyRespondentRepository; + private final SurveyDataRepository surveyDataRepository; + private final SurveyDataQueryRepository surveyDataQueryRepository; + private final ProjectParameterRepository projectParameterRepository; + private final ProjectRedirectRepository projectRedirectRepository; + private final QuestionBlockCollectionRepository questionBlockCollectionRepository; + private final QuestionBolckOptionRepository questionBolckOptionRepository; + private final QuestionBlockLoopRepository questionBlockLoopRepository; + private final QuotaRepository quotaRepository; + private final QuotaCellRepository quotaCellRepository; + private final QuotaQueryRepository quotaQueryRepository; + private final AutoRecodeRepository autoRecodeRepository; + private final ListHeaderRepository listHeaderRepository; + private final ListContentRepository listContentRepository; + + + private final RegexLabel regexLabel; + + public int autoRecode_if(String projectCode, String answerId, int questionUniqueKey){ + + List autoRecodeList = autoRecodeRepository.findAllByProjectCodeAndQuestionUniqueKey(projectCode, questionUniqueKey); + + //오토체크 데이터 리스트 + List dataStructureDtoList = new ArrayList<>(); + //오토체크 조건문장 + String autoCondition = ""; + + for(AutoRecodeEntity autoRecodeEntity : autoRecodeList){ + autoCondition = autoRecodeEntity.getRecodeCondition(); + //빈칸 제거 + autoCondition = autoCondition.replaceAll(" ", ""); + //AND / OR 변환 + autoCondition = autoCondition.replaceAll("AND", "&&").replaceAll("OR", "||"); + + //정규식으로 QuestionID 걸러내기 + Pattern p = Pattern.compile("[\\w:]{1,}((\\[)?(\\w\\|?){1,}(\\])?)"); + Matcher m = p.matcher(autoCondition); + + //QuestionID 정규식 Loop + while (m.find()){ + String conditionStr = m.group(); + String questionID = conditionStr.replaceAll("\\[.*?\\]", ""); + QuestionEntity questionEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(projectCode, questionID, 0); + + if(questionEntity != null){ + Pattern qp = Pattern.compile(questionID+ "(\\[.*?\\])?(>|>=|<|<=|=)(\\')?(\\w){1,}(\\')?"); + Matcher qm = qp.matcher(autoCondition); + DataSaveDto answerData = DataSaveDto.of(surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKey(projectCode, answerId, questionEntity.getQuestionUniqueKey())); + + //QuestionCondition 정규식 Loop + while (qm.find()){ + String beforeText = qm.group(); + StringBuilder afterText = new StringBuilder(); + + String pipingText = beforeText.replaceAll(".*?(\\[.*?\\]).*", "$1"); + boolean pipingFlag = false; + List surveyDataList = new ArrayList<>(); + + if(!pipingText.equals(beforeText)) { + + List pipingQuestionStructure = Arrays.stream(pipingText.toLowerCase().split("[\\|\\[\\]]")) + .filter(e -> !e.equals("")) + .map(String::trim) + .toList(); + + for (String qs : pipingQuestionStructure) { + String structure = qs.replaceAll("[\\d]", ""); + int value = Integer.parseInt(qs.replaceAll("[\\D]", "")); + + switch (structure) { + case "t": + if(surveyDataList.size() > 0){ + surveyDataList = surveyDataList.stream().filter(e -> e.getT() == value).toList(); + }else{ + surveyDataList = answerData.getSurveyDataList().stream().filter(e -> e.getT() == value).toList(); + } + break; + case "m": + if(surveyDataList.size() > 0){ + surveyDataList = surveyDataList.stream().filter(e -> e.getM() == value).toList(); + }else{ + surveyDataList = answerData.getSurveyDataList().stream().filter(e -> e.getM() == value).toList(); + } + break; + case "s": + if(surveyDataList.size() > 0){ + surveyDataList = surveyDataList.stream().filter(e -> e.getS() == value).toList(); + }else{ + surveyDataList = answerData.getSurveyDataList().stream().filter(e -> e.getS() == value).toList(); + } + break; + case "r": + if(surveyDataList.size() > 0){ + surveyDataList = surveyDataList.stream().filter(e -> e.getR() == value).toList(); + }else{ + surveyDataList = answerData.getSurveyDataList().stream().filter(e -> e.getR() == value).toList(); + } + break; + } + } + + pipingFlag = true; + } + + switch (questionEntity.getQuestionType()) { + //21(SINGLE), 22(SCALE) + case 21, 22 -> { + if (pipingFlag) { + afterText.append(beforeText.replace(conditionStr, String.valueOf(surveyDataList.get(0).getS()))); + } else { + afterText.append(beforeText.replace(questionID, String.valueOf(answerData.getSurveyDataList().get(0).getS()))); + } + + autoCondition = autoCondition.replace(beforeText, afterText.toString()); + } + //31(MULTI) + case 31 -> { + int index = 0; + afterText.append("("); + for (SurveyDataStructureDto dataStructureDto : answerData.getSurveyDataList()) { + if (index == 0) { + afterText.append(beforeText.replace(questionID, String.valueOf(dataStructureDto.getS()))); + } else { + afterText.append("||").append(beforeText.replace(questionID, String.valueOf(dataStructureDto.getS()))); + } + + index++; + } + afterText.append(")"); + autoCondition = autoCondition.replace(beforeText, afterText.toString()); + } + //41(NUMERIC) + case 41 -> { + if (pipingFlag) { + afterText.append(beforeText.replace(conditionStr, String.valueOf(surveyDataList.get(0).getO()))); + } else { + afterText.append(beforeText.replace(questionID, String.valueOf(answerData.getSurveyDataList().get(0).getO()))); + } + autoCondition = autoCondition.replace(beforeText, afterText.toString()); + } + } + } + } + } + + // = -> == 치환 + autoCondition = autoCondition.replaceAll("(?<=\\w)=(?=\\w)", "=="); + + try{ + Engine engine = Engine.newBuilder().option("engine.WarnInterpreterOnly", "false").build(); + Context context = Context.newBuilder("js").engine(engine).build(); + Value result = null; + + //NUMERIC을 제외한 + QuestionEntity currentQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, questionUniqueKey, 0); + + if(Integer.parseInt(String.valueOf(currentQuestionEntity.getQuestionType()).substring(1)) != 41){ + result = context.eval("js", autoCondition); + + if(result.asBoolean()){ + if(Integer.parseInt(String.valueOf(currentQuestionEntity.getQuestionType()).substring(1)) < 30){ + if(dataStructureDtoList.size() == 0){ + dataStructureDtoList.add(SurveyDataStructureDto.builder() + .t(0) + .m(0) + .s(autoRecodeEntity.getRecodeValue()) + .r(0) + .o("") + .build()); + } + }else{ + dataStructureDtoList.add(SurveyDataStructureDto.builder() + .t(0) + .m(0) + .s(autoRecodeEntity.getRecodeValue()) + .r(0) + .o("") + .build()); + } + } + }else{ + result = context.eval("js", "eval('" + autoCondition + "')"); + + dataStructureDtoList.add(SurveyDataStructureDto.builder() + .t(0) + .m(0) + .s(1) + .r(0) + .o(String.valueOf(result.asInt())) + .build()); + } + + } catch (Exception ex){ + System.out.println("Exception: "+ ex.getMessage()); + } + } + + List dataSaveDtoList = new ArrayList<>(); + + dataSaveDtoList.add(DataSaveDto.builder() + .security_code(projectCode) + .answer_id(answerId) + .question_unique_key(questionUniqueKey) + .block_id(-1) + .loop_id(-1) + .surveyDataList(dataStructureDtoList) + .build()); + + return saveDataAndProcessAfterLogic(dataSaveDtoList); + } + + public int autoRecode_list(String projectCode, String answerId, int questionUniqueKey){ + //auto recode setting info + AutoRecodeEntity autoRecodeEntity = autoRecodeRepository.findByProjectCodeAndQuestionUniqueKey(projectCode, questionUniqueKey); + //ListContentGetResponseDto header + ListHeaderEntity listHeaderEntity = listHeaderRepository.findByProjectCodeAndOrderNo(projectCode, Integer.parseInt(autoRecodeEntity.getRecodeCondition())); + //listInfo + ListContentEntity listContentEntity = listContentRepository.findByProjectCodeAndListId(projectCode, answerId); + + ListContentGetResponseDto listContentGetResponseDto = ListContentGetResponseDto.of(listContentEntity); + + System.out.println(listContentGetResponseDto); + + String listValue = listContentGetResponseDto.getListContent().get(0).get(listHeaderEntity.getName()); + + QuestionEntity currentQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, questionUniqueKey, 0); + + //오토체크 데이터 리스트 + List dataStructureDtoList = new ArrayList<>(); + + if(listValue.equals("")){ + dataStructureDtoList.add(SurveyDataStructureDto.builder() + .t(0) + .m(0) + .s(autoRecodeEntity.getRecodeValue()) + .r(0) + .o("") + .build()); + }else{ + if(Integer.parseInt(String.valueOf(currentQuestionEntity.getQuestionType()).substring(1)) < 40){ + dataStructureDtoList.add(SurveyDataStructureDto.builder() + .t(0) + .m(0) + .s(Integer.parseInt(listValue)) + .r(0) + .o("") + .build()); + }else{ + dataStructureDtoList.add(SurveyDataStructureDto.builder() + .t(0) + .m(0) + .s(1) + .r(0) + .o(listValue) + .build()); + } + } + + List dataSaveDtoList = new ArrayList<>(); + + dataSaveDtoList.add(DataSaveDto.builder() + .security_code(projectCode) + .answer_id(answerId) + .question_unique_key(questionUniqueKey) + .block_id(-1) + .loop_id(-1) + .surveyDataList(dataStructureDtoList) + .build()); + + return saveDataAndProcessAfterLogic(dataSaveDtoList); + } + + public int autoRecode_random(String projectCode, String answerId, int questionUniqueKey){ + QuestionLabelEntity questionLabelEntity = questionLabelRepository.findByProjectCodeAndQuestionUniqueKeyAndLabelDimension(projectCode, questionUniqueKey, 1); + + Gson gson = new Gson(); + Type listType = new TypeToken>(){}.getType(); + List labelInfoDtoList = gson.fromJson(questionLabelEntity.getLabelInfo(), listType); + + Collections.shuffle(labelInfoDtoList); + + List dataStructureDtoList = new ArrayList<>(); + + dataStructureDtoList.add(SurveyDataStructureDto.builder() + .t(0) + .m(0) + .s(labelInfoDtoList.get(0).getValue()) + .r(0) + .o("") + .build()); + + List dataSaveDtoList = new ArrayList<>(); + + dataSaveDtoList.add(DataSaveDto.builder() + .security_code(projectCode) + .answer_id(answerId) + .question_unique_key(questionUniqueKey) + .block_id(-1) + .loop_id(-1) + .surveyDataList(dataStructureDtoList) + .build()); + + return saveDataAndProcessAfterLogic(dataSaveDtoList); + } + + public int autoRecode_even(String projectCode, String answerId, int questionUniqueKey){ + //오토리코드 값 가져오기 + //오토리코드 반복 돌리면서 값 체크 후 저장 제일 적은 리스트 값 비교하면서 새로운 리스트에 넣고, 랜덤 돌리기 + //보기별로 쿼터 넘는 보기 제외 후 비율 제일 적은 거 선택 후 저장 + + List surveyDataEntityList = surveyDataRepository.findByProjectCodeAndQuestionUniqueKey(projectCode, questionUniqueKey); + List autoRecodeEntityList = autoRecodeRepository.findAllByProjectCodeAndQuestionUniqueKey(projectCode, questionUniqueKey); + + Map resultAvgList = new LinkedHashMap<>(); + + for(AutoRecodeEntity autoRecodeEntity : autoRecodeEntityList){ + List surveyFilterList = surveyDataEntityList.stream().filter(e -> e.getAnswerData().contains("\"s\":"+autoRecodeEntity.getRecodeValue())).toList(); + + double resultAvg = Math.round((surveyFilterList.size() / (double)Integer.parseInt(autoRecodeEntity.getRecodeCondition())) * 100) / 100.0; + + resultAvgList.put(autoRecodeEntity.getRecodeValue(), resultAvg); + + } + double minValue = Collections.min(resultAvgList.values()); + + List resultMatchList = new ArrayList<>(); + + resultAvgList.forEach((key, value) -> { + if(value == minValue) resultMatchList.add(key); + }); + + if(resultMatchList.size() > 1){ + Collections.shuffle(resultMatchList); + } + + List dataStructureDtoList = new ArrayList<>(); + + dataStructureDtoList.add(SurveyDataStructureDto.builder() + .t(0) + .m(0) + .s(resultMatchList.get(0)) + .r(0) + .o("") + .build()); + + List dataSaveDtoList = new ArrayList<>(); + + dataSaveDtoList.add(DataSaveDto.builder() + .security_code(projectCode) + .answer_id(answerId) + .question_unique_key(questionUniqueKey) + .block_id(-1) + .loop_id(-1) + .surveyDataList(dataStructureDtoList) + .build()); + + return saveDataAndProcessAfterLogic(dataSaveDtoList); + } + + + //프로젝트코드 복호화 + private String projectCodeDecrypt(String securityCode) throws Exception { + try{ + return SecurityUtil.decrypt(URLDecoder.decode(securityCode, StandardCharsets.UTF_8)); + }catch (Exception e){ + return securityCode; + } + } + +// @Transactional(readOnly = true) +// public List getSavedDataList(SurveyInfo surveyInfo) throws Exception { +// surveyInfo.setSecurity_code(projectCodeDecrypt(surveyInfo.getSecurity_code())); +// +// Gson gson = new Gson(); +// List questionUniqueKeyAndDataList = new ArrayList<>(); +// List surveyDataEntityList = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKeyNot(surveyInfo.getSecurity_code(), surveyInfo.getAnswer_id(), 1); +// +// Type surveyDataType = new TypeToken>(){}.getType(); +// for(SurveyDataEntity surveyDataEntity : surveyDataEntityList){ +// if(surveyDataEntity.getAnswerData() != null){ +// questionUniqueKeyAndDataList.add(QuestionUniqueKeyAndDataDto.of(surveyDataEntity.getQuestionUniqueKey(), , gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType))); +// } +// } +// +// return questionUniqueKeyAndDataList; +// } + + @Transactional(readOnly = true) + public List getQuestionInfo(SurveyInfo surveyInfo) throws Exception { + surveyInfo.setSecurity_code(projectCodeDecrypt(surveyInfo.getSecurity_code())); + + List questionInfoList = new ArrayList<>(); + + QuestionBlockCollectEntity questionBlockCollectEntity = questionBlockCollectionRepository.findByProjectCodeAndQuestionUniqueKey(surveyInfo.getSecurity_code(), surveyInfo.getQuestion_unique_key()); + + if(questionBlockCollectEntity != null){ + QuestionBlockOptionEntity questionBlockOptionEntity = questionBolckOptionRepository.findByProjectCodeAndBlockCode(questionBlockCollectEntity.getProjectCode(), questionBlockCollectEntity.getBlockCode()); + + boolean optionFlag = false; + + if(questionBlockOptionEntity != null){ + Gson gson = new Gson(); + Type blockOptionType = new TypeToken>(){}.getType(); + List blockOptionList = gson.fromJson(questionBlockOptionEntity.getOptionValue(), blockOptionType); + + for(QuestionOptionDto blockOption : blockOptionList){ + if(blockOption.getTypeTotalCode().equals("100103")) optionFlag = true; + } + } + + if(optionFlag){ + QuestionInfoDto questionInfoDto = questionRepository.findByProjectCodeAndQuestionUniqueKeyAndIsDelete(surveyInfo.getSecurity_code(), surveyInfo.getQuestion_unique_key(),0) + .map(QuestionInfoDto::of) + .orElseThrow(); + + questionInfoDto = questionService.setQuestionLabelJson(surveyInfo.getSecurity_code(), questionInfoDto, surveyInfo.getAnswer_id()); + questionInfoDto.setLoop_id(surveyInfo.getLoop_id()); + + regexLabel.labelToAnswerChange(surveyInfo.getSecurity_code(), surveyInfo.getAnswer_id(), questionInfoDto); + + questionInfoDto.setQuestion_option(questionService.getQuestionOptionValueJson(surveyInfo.getSecurity_code(), questionInfoDto.getQuestion_unique_key())); + questionInfoDto.setQuestion_block_option(questionService.getQuestionBlockOptionValueJson(surveyInfo.getSecurity_code(), 0)); + questionInfoDto.setBlock_id(questionBlockCollectionRepository.findByProjectCodeAndQuestionUniqueKey(surveyInfo.getSecurity_code(), surveyInfo.getQuestion_unique_key()).getBlockCode()); +// questionInfoDto.setLoop_id(questionInfoDto.getLoop_id()); + + questionInfoList.add(questionInfoDto); + }else{ + List questionBlockCollectEntityList = questionBlockCollectionRepository.findAllByProjectCodeAndBlockCode(surveyInfo.getSecurity_code(), questionBlockCollectEntity.getBlockCode()); + + for(QuestionBlockCollectEntity qbc : questionBlockCollectEntityList){ //블록문항 + QuestionInfoDto questionInfoDto = questionRepository.findByProjectCodeAndQuestionUniqueKeyAndIsDelete(surveyInfo.getSecurity_code(), qbc.getQuestionUniqueKey(),0) + .map(QuestionInfoDto::of) + .orElseThrow(); + + questionInfoDto = questionService.setQuestionLabelJson(surveyInfo.getSecurity_code(), questionInfoDto, surveyInfo.getAnswer_id()); + questionInfoDto.setLoop_id(-1); + + regexLabel.labelToAnswerChange(surveyInfo.getSecurity_code(), surveyInfo.getAnswer_id(), questionInfoDto); + + questionInfoDto.setQuestion_option(questionService.getQuestionOptionValueJson(surveyInfo.getSecurity_code(), questionInfoDto.getQuestion_unique_key())); + questionInfoDto.setQuestion_block_option(questionService.getQuestionBlockOptionValueJson(surveyInfo.getSecurity_code(), qbc.getBlockCode())); + questionInfoDto.setBlock_id(qbc.getBlockCode()); + + + questionInfoList.add(questionInfoDto); + } + } + }else{ //단독문항 + QuestionInfoDto questionInfoDto = questionRepository.findByProjectCodeAndQuestionUniqueKeyAndIsDelete(surveyInfo.getSecurity_code(), surveyInfo.getQuestion_unique_key(),0) + .map(QuestionInfoDto::of) + .orElseThrow(); + + questionInfoDto = questionService.setQuestionLabelJson(surveyInfo.getSecurity_code(), questionInfoDto, surveyInfo.getAnswer_id()); + questionInfoDto.setLoop_id(-1); + + regexLabel.labelToAnswerChange(surveyInfo.getSecurity_code(), surveyInfo.getAnswer_id(), questionInfoDto); + + questionInfoDto.setQuestion_option(questionService.getQuestionOptionValueJson(surveyInfo.getSecurity_code(), questionInfoDto.getQuestion_unique_key())); + questionInfoDto.setQuestion_block_option(questionService.getQuestionBlockOptionValueJson(surveyInfo.getSecurity_code(), 0)); + questionInfoDto.setBlock_id(0); + + + questionInfoList.add(questionInfoDto); + } + + return questionInfoList; + } + + public IndexFormSetupDto getIndexPage(SurveyInfo surveyInfo) throws Exception { + surveyInfo.setSecurity_code(projectCodeDecrypt(surveyInfo.getSecurity_code())); + + SurveyTypeEnum surveyTypeEnum = SurveyTypeEnum.typeCodeOfTypeString(surveyInfo.getSurvey_type().toUpperCase()); + int surveyTypeCode = surveyTypeEnum.getTypeCode(); + + ///////roll : INDEX, ALREADY, CLOSE 여기서 반환 + QuestionEntity indexPageEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(surveyInfo.getSecurity_code(), "INDEX", 0); + + //////surveyRespondentEntitu의 생태값 완료인지 확인 + //////완료면 Already + SurveyRespondentEntity surveyRespondentEntity = surveyRespondentRepository.findFirstByProjectCodeAndAnswerId(surveyInfo.getSecurity_code(), surveyInfo.getAnswer_id()); + + AnswerStateEnum answerStateEnum = AnswerStateEnum.stateCodeOfStateString("END"); + + if(surveyRespondentEntity == null){ + surveyRespondentEntity = SurveyRespondentEntity.of(surveyInfo.getSecurity_code(), surveyInfo.getAnswer_id(), surveyTypeCode, AnswerStateEnum.ONGOING.getStateCode(), indexPageEntity.getQuestionUniqueKey(), -1); + surveyRespondentRepository.save(surveyRespondentEntity); + }else if(surveyRespondentEntity.getAnswerState() == answerStateEnum.getStateCode()){ + indexPageEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(surveyInfo.getSecurity_code(), "ALREADY", 0); + }else if(surveyRespondentEntity.getAnswerState() != 1){ + //todo : Project 닫혀 있는지 확인 필요 닫혀 있으면 CLOSE + indexPageEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(surveyInfo.getSecurity_code(), "CLOSE", 0); + } + + List indexPageInfoList = new ArrayList<>(); + QuestionInfoDto indexPageInfoDto = questionService.setQuestionLabelJson(surveyInfo.getSecurity_code(), QuestionInfoDto.of(indexPageEntity), null); + indexPageInfoList.add(indexPageInfoDto); + + return new IndexFormSetupDto(surveyInfo.getSecurity_code(), surveyInfo.getAnswer_id(),0, indexPageInfoList); + } + + public SurveyFormSetupDto startSurvey(IndexParameterDto indexParameterDto) throws Exception { + indexParameterDto.setSecurity_code(projectCodeDecrypt(indexParameterDto.getSecurity_code())); + + ///응답자 ID에 대한 마지막 응답 문항 가져오기 + SurveyRespondentEntity surveyRespondentEntity = surveyRespondentRepository.findFirstByProjectCodeAndAnswerId(indexParameterDto.getSecurity_code(), indexParameterDto.getAnswer_id()); + int startQuestionUniqueKey = surveyRespondentEntity.getAnswerEndQuestionUniqueKey(); + int indexQuestionUniqueKey = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(indexParameterDto.getSecurity_code(), "INDEX", 0).getQuestionUniqueKey(); + + saveParameter(indexParameterDto); + + if(startQuestionUniqueKey == indexQuestionUniqueKey){ //첫 시작인 경우 나중에 조치 필요 + List dataSaveDtoList = new ArrayList<>(); + dataSaveDtoList.add(new DataSaveDto(indexParameterDto.getSecurity_code(), + indexParameterDto.getAnswer_id(), + startQuestionUniqueKey, + -1, + -1, + null)); + + startQuestionUniqueKey = processAfterLogic(dataSaveDtoList).getQuestionUniqueKey(); + } + + //진행 해야 하는 문항 가져 오기 + NextLoopInfo nextLoopInfo = new NextLoopInfo(startQuestionUniqueKey, surveyRespondentEntity.getAnswerLoopId()); + QuestionEntity startQuestionEntity = getNextQuestionEntity(indexParameterDto.getSecurity_code(), indexParameterDto.getAnswer_id(), surveyRespondentEntity.getAnswerLoopId(), nextLoopInfo); + + List questionUniqueKeyList = new ArrayList<>(); + + //블록 체크 + QuestionBlockCollectEntity questionBlockCollectEntity = questionBlockCollectionRepository.findByProjectCodeAndQuestionUniqueKey(startQuestionEntity.getProjectCode(), startQuestionUniqueKey); + + if(questionBlockCollectEntity != null){ //블록 있을 시 + questionUniqueKeyList.addAll(questionBlockCollectionRepository.findAllByProjectCodeAndBlockCode(questionBlockCollectEntity.getProjectCode(), questionBlockCollectEntity.getBlockCode()).stream().map(QuestionBlockCollectEntity::getQuestionUniqueKey).collect(Collectors.toList())); + }else{ + questionUniqueKeyList.add(startQuestionEntity.getQuestionUniqueKey()); + } + + int surveyProgress = questionService.getProgressPercent(indexParameterDto.getSecurity_code(), startQuestionEntity.getQuestionOrder()); + + return new SurveyFormSetupDto(indexParameterDto.getSecurity_code(), indexParameterDto.getAnswer_id(), surveyProgress, questionUniqueKeyList, nextLoopInfo.getLoopId()); + } + + public SurveyFormSetupDto saveSurveyData(List dataSaveDtoList) throws Exception { + for(DataSaveDto dataSaveDto : dataSaveDtoList){ + dataSaveDto.setSecurity_code(projectCodeDecrypt(dataSaveDto.getSecurity_code())); + } + + //data 저장, after 로직 처리 + int nextQuestionUniqueKey = saveDataAndProcessAfterLogic(dataSaveDtoList); + + //루프 데이터 체크 + NextLoopInfo nextLoopInfo = blockLoopCheck(dataSaveDtoList.get(0), nextQuestionUniqueKey); + + //진행 해야 하는 문항 가져 오기 + QuestionEntity nextQuestionEntity = getNextQuestionEntity(dataSaveDtoList.get(dataSaveDtoList.size() - 1).getSecurity_code(), + dataSaveDtoList.get(dataSaveDtoList.size() - 1).getAnswer_id(), + dataSaveDtoList.get(dataSaveDtoList.size() - 1).getLoop_id(), + nextLoopInfo); + + //블록 대비 + List questionUniqueKeyList = new ArrayList<>(); + + //블록 체크 + QuestionBlockCollectEntity questionBlockCollectEntity = questionBlockCollectionRepository.findByProjectCodeAndQuestionUniqueKey(nextQuestionEntity.getProjectCode(), nextQuestionEntity.getQuestionUniqueKey()); + + if(questionBlockCollectEntity != null){ + QuestionBlockOptionEntity questionBlockOptionEntity = questionBolckOptionRepository.findByProjectCodeAndBlockCode(questionBlockCollectEntity.getProjectCode(), questionBlockCollectEntity.getBlockCode()); + + boolean optionFlag = false; + + if(questionBlockOptionEntity != null){ + Gson gson = new Gson(); + Type blockOptionType = new TypeToken>(){}.getType(); + List blockOptionList = gson.fromJson(questionBlockOptionEntity.getOptionValue(), blockOptionType); + + for(QuestionOptionDto blockOption : blockOptionList){ //옵션 체크 + if(blockOption.getTypeTotalCode().equals("100103")) { //반복 질문 옵션 있을 시, 선택한 보기 저장 + optionFlag = true; + } + } + } + + if(optionFlag){ + questionUniqueKeyList.add(nextQuestionEntity.getQuestionUniqueKey()); + }else{ + questionUniqueKeyList.addAll(questionBlockCollectionRepository.findAllByProjectCodeAndBlockCode(questionBlockCollectEntity.getProjectCode(), questionBlockCollectEntity.getBlockCode()).stream().map(QuestionBlockCollectEntity::getQuestionUniqueKey).collect(Collectors.toList())); + } + + }else{ + questionUniqueKeyList.add(nextQuestionEntity.getQuestionUniqueKey()); + } + + int surveyProgress = questionService.getProgressPercent(dataSaveDtoList.get(dataSaveDtoList.size() - 1).getSecurity_code(), nextQuestionEntity.getQuestionOrder()); + + return new SurveyFormSetupDto(dataSaveDtoList.get(dataSaveDtoList.size() - 1).getSecurity_code() + ,dataSaveDtoList.get(dataSaveDtoList.size() - 1).getAnswer_id() + ,surveyProgress + ,questionUniqueKeyList + ,nextLoopInfo.getLoopId()); + } + + @SuppressWarnings("unchecked") + public String getRedirectUrl(SurveyInfo surveyInfo) throws Exception { + surveyInfo.setSecurity_code(projectCodeDecrypt(surveyInfo.getSecurity_code())); + + QuestionEntity questionEntity = questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(surveyInfo.getSecurity_code(), surveyInfo.getQuestion_unique_key(), 0); + + String redirectUrl = "", panelCode = ""; + RedirectDto redirectDto = null; + SurveyDataEntity surveyDataEntity = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKey(surveyInfo.getSecurity_code(), surveyInfo.getAnswer_id(), 1); + + Gson gson = new Gson(); + Type indexDataType = new TypeToken>>>(){}.getType(); + Map indexQueryString = surveyDataEntity == null ? new HashMap<>() : gson.fromJson(surveyDataEntity.getAnswerData(), indexDataType); + ArrayList parameterString = indexQueryString.size() == 0 ? new ArrayList<>() : (ArrayList) indexQueryString.get("Parameter"); + + if(parameterString.size() > 0){ + Map parameterList = (HashMap) parameterString.get(0); + + if(parameterList.get("PANEL") != null) panelCode = parameterList.get("PANEL"); + + if(!panelCode.equals("")){ + ProjectRedirectEntity projectRedirectEntity = projectRedirectRepository.findByProjectCodeAndPanelCode(surveyInfo.getSecurity_code(), panelCode); + + if(projectRedirectEntity != null){ + redirectDto = RedirectDto.of(projectRedirectEntity); + + switch (questionEntity.getQuestionID()){ + case "END" -> redirectUrl = redirectDto.getCompleteUrl(); + case "QUOTA" -> redirectUrl = redirectDto.getQuotaUrl(); + case "SCREEN" -> redirectUrl = redirectDto.getScreenUrl(); + } + + if(!redirectUrl.equals("")){ + for(String parameterKey : parameterList.keySet()){ + redirectUrl = redirectUrl.replace("{" + parameterKey + "}", parameterList.get(parameterKey)); + } + } + } + + + // 고정패널 특정값 치환 + // 키위 - LASTQID(Q_UK) + // 클라우드패널 - CHECKSUM(CLOUDKEY, CAMPAIGNID, IDKEY, RESULT) 붙여서 MD5로암호화 치환 + if(panelCode.equals("KIWI")){ + redirectUrl = redirectUrl.replace("{SID}", surveyInfo.getAnswer_id()); + + String lastQid = surveyDataQueryRepository.getLastQid(questionEntity.getProjectCode(), surveyInfo.getAnswer_id()); + parameterList.put("LASTQID", lastQid); + } + + redirectUrl = FixedPanelRedirect.redirectChange(redirectUrl, panelCode, parameterList, questionEntity); + } + } + + return redirectUrl; + } + + public int saveDataAndProcessAfterLogic(List dataSaveDtoList){ + + //data 저장 + if(!dataSaveDtoList.isEmpty()) saveData(dataSaveDtoList); + + + //after 로직 처리 + QuestionEntity nextQuestionEntity = processAfterLogic(dataSaveDtoList); + + return nextQuestionEntity.getQuestionUniqueKey(); + } + + @Transactional + public void saveParameter(IndexParameterDto indexParameterDto){ + //등록되지 않은 파라미터 체크 + Set parameterNoDupList = new HashSet<>(); + List parameterEntityList = projectParameterRepository.findByProjectCode(indexParameterDto.getSecurity_code()); + + if(indexParameterDto.getParameter_info().size() > 0){ + for(String useParam : indexParameterDto.getParameter_info().get(0).keySet()){ + boolean isUse = false; + + for(ProjectParameterEntity grantParam : parameterEntityList){ + if (grantParam.getParameterName().equals(useParam)) { + isUse = true; + break; + } + } + + if(!isUse) parameterNoDupList.add(useParam); + } + } + System.out.println(parameterNoDupList.toString()); + if(parameterNoDupList.size() > 0){ + throw new TextException(HttpStatus.NOT_FOUND, "PM404", "등록되지 않은 파라미터입니다.", "0"); + }else{ + //데이터 key 세팅 + Map parameterMap = new HashMap<>(); + parameterMap.put("Parameter", indexParameterDto.getParameter_info()); + parameterMap.put("AgentInfo", new ArrayList<>()); + + //데이터 저장 + Gson gson = new Gson(); + String answerDataString = gson.toJson(parameterMap); + String answerDateString = Common.getNow(null); + SurveyDataEntity surveyDataEntity = SurveyDataEntity.toEntity(indexParameterDto.getSecurity_code(), indexParameterDto.getAnswer_id(), 1, -1, answerDataString, answerDateString); + surveyDataRepository.save(surveyDataEntity); + } + } + + @Transactional + public void saveData(List dataSaveDtoList){ + + Gson gson = new Gson(); + String answerDataString = null, answerDateString = null; + List surveyDataEntityList = new ArrayList<>(); + + for(DataSaveDto dataSaveDto : dataSaveDtoList){ + answerDataString = gson.toJson(dataSaveDto.getSurveyDataList()); + answerDateString = Common.getNow(null); + + surveyDataEntityList.add(SurveyDataEntity.toEntity( + dataSaveDto.getSecurity_code(), + dataSaveDto.getAnswer_id(), + dataSaveDto.getQuestion_unique_key(), + dataSaveDto.getLoop_id(), + answerDataString, + answerDateString + )); + } + + surveyDataRepository.saveAll(surveyDataEntityList); + } + + public void injectEndQuestionInfo(String projectCode, String answerId, int loopId, int questionUniqueKey){ + SurveyRespondentEntity surveyRespondentEntity = surveyRespondentRepository.findFirstByProjectCodeAndAnswerId(projectCode, answerId); + surveyRespondentEntity.setAnswerLoopId(loopId); + surveyRespondentEntity.setAnswerEndDate(Common.getNow(null)); + surveyRespondentEntity.setAnswerEndQuestionUniqueKey(questionUniqueKey); + surveyRespondentRepository.save(surveyRespondentEntity); + } + + public QuestionEntity getNextQuestionEntity(String projectCode, String answerId, int loopId, NextLoopInfo nextLoopInfo){ + //시작 문항 + QuestionEntity nextQuestionEntity; + + //쿼터 체크 + if(quotaCheck(projectCode, answerId)){ // quota over인 경우가 true + //quota Over + nextQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(projectCode,"QUOTA", 0); + + QuestionEntity beforeLogicQuestionEntity = processBeforeLogic(projectCode, answerId, nextLoopInfo.getNextUniqueKey()); + + //Screen 있을 때 우선 처리 + if(beforeLogicQuestionEntity.getQuestionID().equals("SCREEN")){ + nextQuestionEntity = beforeLogicQuestionEntity; + } + }else{ + //before Logic Loop + nextQuestionEntity = processBeforeLogic(projectCode, answerId, nextLoopInfo.getNextUniqueKey()); + } + + //end screen quota check후 Respondent 상태 변경 후 빠져 나가기 + ArrayList surveyEndPageArray =new ArrayList<>(Arrays.asList("END", "SCREEN", "QUOTA")); + if(surveyEndPageArray.contains(nextQuestionEntity.getQuestionID().toUpperCase())){ + AnswerStateEnum answerStateEnum = AnswerStateEnum.stateCodeOfStateString(nextQuestionEntity.getQuestionID().toUpperCase()); + + SurveyRespondentEntity surveyRespondentEntity = surveyRespondentRepository.findFirstByProjectCodeAndAnswerId(projectCode, answerId); + surveyRespondentEntity.setAnswerState(answerStateEnum.getStateCode()); + surveyRespondentRepository.save(surveyRespondentEntity); + + return nextQuestionEntity; + } + + ///Respondent E_Q_UK, E_Q_DT 갱신 + injectEndQuestionInfo(projectCode, answerId, loopId, nextQuestionEntity.getQuestionUniqueKey()); + + //auto 문항 처리 아마 재귀호출이 일어날 것이다... + if(nextQuestionEntity.getQuestionDimension() == 9){ + int nextUniqueKey = nextQuestionEntity.getQuestionUniqueKey(); + + //AUTO_RECODE(IF/91) 실행 + if((nextQuestionEntity.getQuestionType() / 100) == 1){ + nextUniqueKey = autoRecode_if(projectCode, answerId, nextQuestionEntity.getQuestionUniqueKey()); + } + + //AUTO_RECODE(List/92) 실행 + if((nextQuestionEntity.getQuestionType() / 100) == 2){ + nextUniqueKey = autoRecode_list(projectCode, answerId, nextQuestionEntity.getQuestionUniqueKey()); + } + + //AUTO_RECODE(BrandSelect/93) 실행 + if((nextQuestionEntity.getQuestionType() / 100) == 3){ + QuestionOptionEntity questionOptionEntity = questionOptionRepository.findByProjectCodeAndQuestionUniqueKey(nextQuestionEntity.getProjectCode(), nextQuestionEntity.getQuestionUniqueKey()); + + Gson gson = new Gson(); + Type listType = new TypeToken>(){}.getType(); + List questionOptionDtoList = questionOptionEntity == null ? new ArrayList<>() : gson.fromJson(questionOptionEntity.getOptionValue(), listType); + + //옵션 type 코드 리스트 + List optionTypeTotalCodeList = questionOptionDtoList.stream().map(QuestionOptionDto::getTotalCode).collect(Collectors.toList()); + + if(optionTypeTotalCodeList.contains("900101||1")){ + //BrandSelect(랜덤) 실행 + nextUniqueKey = autoRecode_random(projectCode, answerId, nextQuestionEntity.getQuestionUniqueKey()); + }else if(optionTypeTotalCodeList.contains("900101||2")){ + //BrandSelect(균등 - 쿼터 비슷!!) 실행 + nextUniqueKey = autoRecode_even(projectCode, answerId, nextQuestionEntity.getQuestionUniqueKey()); + } + + } + + //재귀 호출 + nextQuestionEntity = getNextQuestionEntity(projectCode, answerId, loopId, new NextLoopInfo(nextUniqueKey, loopId)); + + } + + //프로젝트 Close 체크 + if(false){ + //todo : Project 닫혀 있는지 확인 필요 닫혀 있으면 CLOSE + nextQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(projectCode, "CLOSE", 0); + } + + return nextQuestionEntity; + } + + @Transactional(readOnly = true) + public QuestionEntity processBeforeLogic(String projectCode, String answerId, int questionUniqueKey){ + Gson gson = new Gson(); + int nextPageUniqueKey = questionUniqueKey; + + ////////////////여기서 뭘 내려줘야 하는가? + //////////questionUniqueKey로 로직 정보를 가져와서 체크 후 뭐하지??? + try{ + boolean logicEndFlag; + do{ + logicEndFlag = true; + List questionLogicEntityList = new ArrayList<>(); + + QuestionBlockCollectEntity questionBlockCollectEntity = questionBlockCollectionRepository.findByProjectCodeAndQuestionUniqueKey(projectCode, questionUniqueKey); + + if(questionBlockCollectEntity != null){ // + List questionBlockCollectEntityList = questionBlockCollectionRepository.findAllByProjectCodeAndBlockCode(projectCode, questionBlockCollectEntity.getBlockCode()).stream().map(QuestionBlockCollectEntity::getQuestionUniqueKey).toList(); + + questionLogicEntityList.addAll(questionLogicRepository.findByProjectCodeAndQuestionUniqueKeyIn(projectCode, questionBlockCollectEntityList)); + }else{ + QuestionLogicEntity questionLogicEntity = questionLogicRepository.findByProjectCodeAndQuestionUniqueKey(projectCode, nextPageUniqueKey); + + if(questionLogicEntity != null){ + questionLogicEntityList.add(questionLogicEntity); + } + } + + for(QuestionLogicEntity beforeLogicEntity : questionLogicEntityList){ + if(!Objects.equals(beforeLogicEntity.getBeforeLogic(), "[]") && !beforeLogicEntity.getBeforeLogic().isEmpty()){ + ///수행할 로직이 있다 + List beforeLogicJsonList = gson.fromJson(beforeLogicEntity.getBeforeLogic(), new TypeToken>(){}.getType()); + for(QuestionLogicJsonDto beforeLogicJson : beforeLogicJsonList){ + if(checkLogic(projectCode, answerId, beforeLogicJson.getLogic())){ + nextPageUniqueKey = Integer.parseInt(beforeLogicJson.getPage().replace("[UK:","").replace("]","")); + System.out.println(nextPageUniqueKey); + logicEndFlag = false; + break; + } + } + } + } + }while(!logicEndFlag);////다음 문항 진입 시까지 계속 loop + + + } + catch (Exception ex){ + ////// todo : log찍기 + } + return questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, nextPageUniqueKey, 0); + } + + @Transactional(readOnly = true) + public QuestionEntity processAfterLogic(List dataSaveDtoList){ + Gson gson = new Gson(); + + String projectCode = "", answerId = ""; + QuestionEntity nextQuestionEntity = null; + QuestionLogicEntity afterLogicEntity = null; + List questionLogicEntityList = new ArrayList<>(); + List afterLogicJsonList = new ArrayList<>(); + + + try{ + if(dataSaveDtoList.size() > 0){ + projectCode = dataSaveDtoList.get(0).getSecurity_code(); + + answerId = dataSaveDtoList.get(0).getAnswer_id(); + + int questionOrder = questionRepository + .findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, dataSaveDtoList.get(dataSaveDtoList.size() - 1).getQuestion_unique_key(),0) + .getQuestionOrder(); + + nextQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionOrderGreaterThanAndIsDeleteOrderByQuestionOrder(projectCode, questionOrder, 0); + } + + // 로직 체크 + for(DataSaveDto dataSaveDto : dataSaveDtoList){ + afterLogicEntity = questionLogicRepository.findByProjectCodeAndQuestionUniqueKey(dataSaveDto.getSecurity_code(), dataSaveDto.getQuestion_unique_key()); + + if(afterLogicEntity != null && !Objects.equals(afterLogicEntity.getAfterLogic(), "[]") && !afterLogicEntity.getAfterLogic().isEmpty()) { + questionLogicEntityList.add(afterLogicEntity); + } + } + + //로직 JSON -> 리스트로 변경 + for(QuestionLogicEntity questionLogicEntity : questionLogicEntityList){ + afterLogicJsonList = gson.fromJson(questionLogicEntity.getAfterLogic(), new TypeToken>(){}.getType()); + + for(QuestionLogicJsonDto afterLogicJson : afterLogicJsonList){ + if(checkLogic(projectCode, answerId, afterLogicJson.getLogic())){ + int nextPageUniqueKey = Integer.parseInt(afterLogicJson.getPage().replace("[UK:","").replace("]","")); + nextQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, nextPageUniqueKey, 0); + break; + } + } + } + + if(nextQuestionEntity == null){ + nextQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(projectCode,"END", 0); + } + + }catch (Exception ex){ + //log + System.out.println(ex); + } + + + + return nextQuestionEntity; + } + + @Transactional(readOnly = true) + public boolean checkLogic(String projectCode, String answerId, String logicString){ + ///////////네이티브 쿼리 이용/////////// + //////////매우 동적으로 Where문이 작성 되기 때문에 JPQL,QueryDSL 등으로 극복 불가능 + + //todo 2023-12-06 박준성 기술부채 : sq5=sq6의 값처럼 문항의 값과 값을 비교 하는 쿼리 동작할 수 있게 수정 필요 + String useQuestionUniqueKey = RegexLogic.getUseQuestionUniqueKey(logicString); + + logicString = RegexLogic.makeSyntaxString(logicString); + + String logicQuery = ""; + logicQuery += " select ANS_ID " + System.lineSeparator(); + logicQuery += " from " + System.lineSeparator(); + logicQuery += " ( " + System.lineSeparator(); + logicQuery += " select ifnull(ANS_ID,'" + answerId + "') as ANS_ID " + System.lineSeparator(); + logicQuery += " , JSON_OBJECTAGG(q.Q_UK, ifnull(JS.ANS_DATA, cast('[]' as json))) as ANS_DATA " + System.lineSeparator(); + logicQuery += " from question q " + System.lineSeparator(); + logicQuery += " left join (" + System.lineSeparator(); + logicQuery += " select sd.PRJ_CD, sd.ANS_ID, sd.Q_UK, JSON_ARRAYAGG(JSON_INSERT(CASE WHEN q.TY=41 then json_replace(j.myvalue,'$.s',CAST(j.myvalue -> '$.o' as SIGNED)) else j.myvalue end,'$.l',sd.LOOP_ID)) as ANS_DATA " + System.lineSeparator(); + logicQuery += " from survey_data sd " + System.lineSeparator(); + logicQuery += " inner join question q on sd.PRJ_CD = q.PRJ_CD and sd.Q_UK = q.Q_UK " + System.lineSeparator(); + logicQuery += " , JSON_TABLE(sd.ANS_DATA, '$[*]' COLUMNS(myvalue JSON PATH '$')) AS j " + System.lineSeparator(); + logicQuery += " where sd.PRJ_CD ='" + projectCode + "' AND sd.ANS_ID ='" + answerId + "' and json_valid(sd.ANS_DATA) " + System.lineSeparator(); + logicQuery += " group by sd.PRJ_CD, sd.ANS_ID, sd.Q_UK " + System.lineSeparator(); + logicQuery += " ) JS on q.PRJ_CD =JS.PRJ_CD and q.Q_UK = JS.Q_UK " + System.lineSeparator(); + logicQuery += " where q.PRJ_CD ='" + projectCode + "' AND q.Q_UK in (" + useQuestionUniqueKey + ")" + System.lineSeparator(); //조건에 들어가는 Q_ID들 + logicQuery += " group by ANS_ID" + 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); + boolean logicResult = !query.getResultList().isEmpty(); + + entityManager.clear(); + entityManager.close(); + return logicResult; + } + + public boolean surveyDataVerify(List dataSaveDtoList) throws Exception{ + for(DataSaveDto dataSaveDto : dataSaveDtoList){ + dataSaveDto.setSecurity_code(projectCodeDecrypt(dataSaveDto.getSecurity_code())); + + //해당 문항 옵션 + QuestionOptionEntity questionOptionEntity = questionOptionRepository.findByProjectCodeAndQuestionUniqueKey(dataSaveDto.getSecurity_code(), dataSaveDto.getQuestion_unique_key()); + //해당 문항 정보 + QuestionInfoDto questionInfoDto = QuestionInfoDto.of(questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(dataSaveDto.getSecurity_code(), dataSaveDto.getQuestion_unique_key(), 0)); + + questionInfoDto = questionService.setQuestionLabelJson(dataSaveDto.getSecurity_code(), questionInfoDto, dataSaveDto.getAnswer_id()); + + QuestionLabelInfoDto defaultQuestionLabelInfoDto = new QuestionLabelInfoDto(); + + //문항 정보 + List tensorList = questionInfoDto.getTensor_label() == null ? new ArrayList<>(Collections.singletonList(defaultQuestionLabelInfoDto)) : questionInfoDto.getTensor_label().getLabel_info(); + List matrixList = questionInfoDto.getMatrix_label() == null ? new ArrayList<>(Collections.singletonList(defaultQuestionLabelInfoDto)) : questionInfoDto.getMatrix_label().getLabel_info(); + List isEtcList = questionInfoDto.getScalar_label() == null ? new ArrayList<>() : questionInfoDto.getScalar_label().getLabel_info().stream().filter(x -> x.getIs_etc() == 1).collect(Collectors.toList()); + List isNotList = questionInfoDto.getScalar_label() == null ? new ArrayList<>() : questionInfoDto.getScalar_label().getLabel_info().stream().filter(x -> x.getIs_not() == 1).collect(Collectors.toList()); + + //옵션 리스트 + Gson gson = new Gson(); + Type listType = new TypeToken>(){}.getType(); + List questionOptionDtoList = questionOptionEntity == null ? new ArrayList<>() : gson.fromJson(questionOptionEntity.getOptionValue(), listType); + + //옵션 total 코드 리스트 + List optionTotalCodeList = questionOptionDtoList.stream().map(QuestionOptionDto::getTotalCode).collect(Collectors.toList()); + //옵션 type 코드 리스트 + List optionTypeTotalCodeList = questionOptionDtoList.stream().map(QuestionOptionDto::getTypeTotalCode).collect(Collectors.toList()); + + long answerCount = 0; + long numericSum = 0, minNum = 0, maxNum = 0, someNum = 0; + + for(QuestionLabelInfoDto tensor : tensorList){ + for(QuestionLabelInfoDto matrix : matrixList){ + answerCount = dataSaveDto.getSurveyDataList().stream().filter(dl -> dl.getT() == tensor.getValue() && dl.getM() == matrix.getValue()).count(); + + for(QuestionLabelInfoDto etc : isEtcList) { + if(dataSaveDto.getSurveyDataList().stream().anyMatch(dl -> dl.getS() == etc.getValue() && dl.getO().equals(""))) + throw new ApiException(HttpStatus.BAD_REQUEST, "QVE400", "오픈입력값 넣어주세요.", tensor.getValue()+"||"+matrix.getValue()+"||"+etc.getValue(), "0"); + } + + //필수 응답 (나중에 확인 필요!! SCALAR값 체크) + if(answerCount == 0 && optionTotalCodeList.contains("100103||1")) + throw new ApiException(HttpStatus.BAD_REQUEST, "QVE400", "문항에 응답해주세요.", tensor.getValue()+"||"+matrix.getValue()+"||0", "0"); + + //랭크 필수 순위 + if(optionTypeTotalCodeList.contains("300301")){ + int optionValue = Integer.parseInt(optionTotalCodeList.get(optionTypeTotalCodeList.indexOf("300301")).split("\\|\\|")[1]); + + if(!dataSaveDto.rankAnswerCheck(tensor.getValue(), matrix.getValue(), optionValue, isNotList)) + throw new ApiException(HttpStatus.BAD_REQUEST, "QVE400", optionValue + "순위까지 응답부탁드립니다.", tensor.getValue()+"||"+matrix.getValue()+"||0", "0"); + } + + //파일 업로드 최소 개수 + if(optionTypeTotalCodeList.contains("300701")){ + int optionValue = Integer.parseInt(optionTotalCodeList.get(optionTypeTotalCodeList.indexOf("300701")).split("\\|\\|")[1]); + + if(!dataSaveDto.fileUploadCheck(tensor.getValue(), matrix.getValue(), optionValue)) + throw new ApiException(HttpStatus.BAD_REQUEST, "QVE400", "파일 " + optionValue + "개 이상 업로드 부탁드립니다.", tensor.getValue()+"||"+matrix.getValue()+"||0", "0"); + } + + } + + //합계 범위 체크 + if(optionTypeTotalCodeList.contains("300602")){ + String optionValue = optionTotalCodeList.get(optionTypeTotalCodeList.indexOf("300602")).split("\\|\\|")[1]; + numericSum = dataSaveDto.getSurveyDataList().stream().filter(data -> data.getT() == tensor.getValue()).map(data -> Integer.parseInt(data.getO().equals("") ? "0" : data.getO())).reduce(0, Integer::sum); + + if(optionValue.contains("~")){ + List numList = Arrays.stream(optionValue.split("~")).filter(e -> !e.equals("")).map(Integer::parseInt).toList(); + if(numList.size() > 1){ // 양 범위 + minNum = numList.get(0); + maxNum = numList.get(1); + + if(minNum > numericSum || maxNum < numericSum) + throw new ApiException(HttpStatus.BAD_REQUEST, "QVE400", "합계를 " + minNum + " ~ " + maxNum + " 사이로 입력해주세요.", tensor.getValue()+"||0||0", "0"); + }else{ + if(optionValue.indexOf("~") == 0){ //이하 범위 + minNum = numList.get(0); + + if(minNum > numericSum) + throw new ApiException(HttpStatus.BAD_REQUEST, "QVE400", "합계를 " + minNum + " 이상 입력해주세요.", tensor.getValue()+"||0||0", "0"); + + }else{ //이상 범위 + maxNum = numList.get(0); + + if(maxNum > numericSum) + throw new ApiException(HttpStatus.BAD_REQUEST, "QVE400", "합계를 " + maxNum + " 이하 입력해주세요.", tensor.getValue()+"||0||0", "0"); + } + } + }else{ // 딱 맞아야 하는 범위 + someNum = Integer.parseInt(optionValue); + + if(someNum != numericSum) + throw new ApiException(HttpStatus.BAD_REQUEST, "QVE400", "합계를 " + someNum + "에 맞춰주세요.", tensor.getValue()+"||0||0", "0"); + } + } + } + } + + return true; + } + + //Numeric 검증 + public boolean numericVerify(List dataSaveDtoList) throws Exception { + for(DataSaveDto dataSaveDto : dataSaveDtoList){ + dataSaveDto.setSecurity_code(projectCodeDecrypt(dataSaveDto.getSecurity_code())); + + //해당 문항 정보 + QuestionInfoDto questionInfoDto = QuestionInfoDto.of(questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(dataSaveDto.getSecurity_code(), dataSaveDto.getQuestion_unique_key(), 0)); + + //문항 Dimension + int dimension = questionInfoDto.getQuestion_dimension() == 1 ? 1 : 2; + + //라벨 정보 가져오기 + QuestionLabelEntity questionLabelEntity = questionLabelRepository.findByProjectCodeAndQuestionUniqueKeyAndLabelDimension(dataSaveDto.getSecurity_code(), questionInfoDto.getQuestion_unique_key(), dimension); + + //문항 라벨 정보 리스트 변환 + Gson gson = new Gson(); + Type listType = new TypeToken>(){}.getType(); + List questionLabelInfoList = questionLabelEntity == null ? null : gson.fromJson(questionLabelEntity.getLabelInfo(), listType); + + if(questionLabelInfoList != null) { + List numRangeList = null; //세팅한 숫자 범위 리스트 + List dateRangeList = null; //세팅한 날짜 범위 리스트 + List dataList = null; // 데이터 리스트 + double inputNum = 0, minNum = 0, maxNum = 0, someNum = 0; //inputNum: 입력값, minNum: 최소범위, maxNum: 최대범위, someNum: 같은범위 + Date inputDate, beforeDate, afterDate, someDate; // 날짜 변수 + + for(QuestionLabelInfoDto qli : questionLabelInfoList) { + if(!qli.getRange().equals("")){ + + if(dimension == 1) { // 스칼라는 그대로 + dataList = dataSaveDto.getSurveyDataList(); + }else { // 매트릭스, 텐서는 매트릭스 라벨 정보 + dataList = dataSaveDto.getSurveyDataList().stream().filter(e -> e.getM() == qli.getValue()).toList(); + } + + for(SurveyDataStructureDto sds : dataList) { + + String errorPoint = sds.getT()+"||" + sds.getM() + "||" + sds.getS(); + + //일반, 소수점 + if(qli.getOpen_type() < 3) { + inputNum = Double.parseDouble(sds.getO()); + + if(qli.getRange().contains("~")){ + numRangeList = Arrays.stream(qli.getRange().split("~")).filter(e -> !e.equals("")).map(Double::parseDouble).toList(); + + if(numRangeList.size() > 1){ // 양 범위 + minNum = numRangeList.get(0); + maxNum = numRangeList.get(1); + + if(minNum > inputNum || maxNum < inputNum) + throw new ApiException(HttpStatus.BAD_REQUEST, "LVE400", "숫자를 " + Common.doubleCheck(minNum) + " ~ " + Common.doubleCheck(maxNum) + " 사이로 입력해주세요.", errorPoint, "0"); + }else{ + if(qli.getRange().indexOf("~") == 0){ //미만 범위 + minNum = numRangeList.get(0); + + if(minNum < inputNum) + throw new ApiException(HttpStatus.BAD_REQUEST, "LVE400", "숫자를 " + Common.doubleCheck(minNum) + " 보다 작게 입력해주세요.", errorPoint, "0"); + + }else{ //초과 범위 + maxNum = numRangeList.get(0); + + if(maxNum > inputNum) + throw new ApiException(HttpStatus.BAD_REQUEST, "LVE400", "숫자를 " + Common.doubleCheck(maxNum) + " 보다 크게 입력해주세요.", errorPoint, "0"); + } + } + }else{ //같은 범위 + someNum = Integer.parseInt(qli.getRange()); + + if(someNum != inputNum) + throw new ApiException(HttpStatus.BAD_REQUEST, "LVE400", "숫자를 " + Common.doubleCheck(someNum) + "에 맞춰주세요.", errorPoint, "0"); + } + }else { // 날짜 + inputDate = Common.convertStringToDate(sds.getO()); + + if(qli.getRange().contains("~")){ + dateRangeList = Arrays.stream(qli.getRange().split("~")).filter(e -> !e.equals("")).toList(); + + if(dateRangeList.size() > 1){ // 양 범위 + beforeDate = Common.convertStringToDate(dateRangeList.get(0)); + afterDate = Common.convertStringToDate(dateRangeList.get(1)); + + if(beforeDate.after(inputDate) || afterDate.before(inputDate)) + throw new ApiException(HttpStatus.BAD_REQUEST, "LVE400", "날짜를 " + Common.convertDateToString(beforeDate) + " ~ " + Common.convertDateToString(afterDate) + " 사이로 입력해주세요.", errorPoint, "0"); + }else{ + if(qli.getRange().indexOf("~") == 0){ //미만 범위 + afterDate = Common.convertStringToDate(dateRangeList.get(0)); + + if(afterDate.before(inputDate)) + throw new ApiException(HttpStatus.BAD_REQUEST, "LVE400", "날짜를 " + Common.convertDateToString(afterDate) + " 전으로 입력해주세요.", errorPoint, "0"); + + }else{ //초과 범위 + beforeDate = Common.convertStringToDate(dateRangeList.get(0)); + + if(beforeDate.after(inputDate)) + throw new ApiException(HttpStatus.BAD_REQUEST, "LVE400", "날짜를 " + Common.convertDateToString(beforeDate) + " 후로 입력해주세요.", errorPoint, "0"); + } + } + }else { //같은 범위 + someDate = Common.convertStringToDate(qli.getRange()); + + if(!someDate.equals(inputDate)) + throw new ApiException(HttpStatus.BAD_REQUEST, "LVE400", "날짜를 " + Common.convertDateToString(someDate) + "에 맞춰서 입력해주세요.", errorPoint, "0"); + } + } + } + } + } + } + } + + return true; + } + + public List getAutoCheckAnswerData(SurveyInfo surveyInfo) throws Exception { + surveyInfo.setSecurity_code(projectCodeDecrypt(surveyInfo.getSecurity_code())); + + //데이터 리스트 + List autoCheckAnswerDataList = null; + + //해당 문항 옵션 정보 + QuestionOptionEntity questionOptionEntity = questionOptionRepository.findByProjectCodeAndQuestionUniqueKey(surveyInfo.getSecurity_code(), surveyInfo.getQuestion_unique_key()); + + //옵션 리스트 + Gson gson = new Gson(); + Type optionType = new TypeToken>(){}.getType(); + List questionOptionDtoList = questionOptionEntity == null ? new ArrayList<>() : gson.fromJson(questionOptionEntity.getOptionValue(), optionType); + + Type surveyDataType = new TypeToken>(){}.getType(); + + //옵션 total 코드 리스트 + List optionTotalCodeList = questionOptionDtoList.stream().map(QuestionOptionDto::getTotalCode).collect(Collectors.toList()); + + for(String option : optionTotalCodeList) { + String code = option.split("\\|\\|")[0]; + String value = option.split("\\|\\|")[1]; + + if(code.equals("300202")) { + int autoCheckUniqueKey = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(surveyInfo.getSecurity_code(), value, 0).getQuestionUniqueKey(); + + SurveyDataEntity surveyDataEntity = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKey(surveyInfo.getSecurity_code(), surveyInfo.getAnswer_id(), autoCheckUniqueKey); + + if(surveyDataEntity.getAnswerData() != null) autoCheckAnswerDataList = gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType); + } + } + + if(autoCheckAnswerDataList == null) { + throw new TextException(HttpStatus.NOT_FOUND, "AC404", "값이 존재하지 않습니다.", "0"); + }else { + return autoCheckAnswerDataList; + } + } + + public NextLoopInfo blockLoopCheck(DataSaveDto dataSaveDto, int nextQuestionUniqueKey){ + + NextLoopInfo nextLoopInfo = new NextLoopInfo(nextQuestionUniqueKey, dataSaveDto.getLoop_id()); + String projectCode = dataSaveDto.getSecurity_code(); + String answerId = dataSaveDto.getAnswer_id(); + + QuestionBlockCollectEntity questionBlockCollectEntity = questionBlockCollectionRepository.findByProjectCodeAndQuestionUniqueKey(projectCode, nextQuestionUniqueKey); + + //진입 + String loopQuestionId = null; + Integer loopQuestionUniqueKey = null; + + if(questionBlockCollectEntity != null){ + + QuestionBlockOptionEntity questionBlockOptionEntity = questionBolckOptionRepository.findByProjectCodeAndBlockCode(questionBlockCollectEntity.getProjectCode(), questionBlockCollectEntity.getBlockCode()); + + Gson gson = new Gson(); + Type blockOptionType = new TypeToken>(){}.getType(); + List blockOptionList = gson.fromJson(questionBlockOptionEntity.getOptionValue(), blockOptionType); + + for(QuestionOptionDto blockOption : blockOptionList){ //옵션 체크 + if(blockOption.getTypeTotalCode().equals("100103")) { //반복 질문 옵션 있을 시, 선택한 보기 저장 + loopQuestionUniqueKey = Integer.parseInt(blockOption.getValue()); + } + } + + if(dataSaveDto.getBlock_id() != questionBlockCollectEntity.getBlockCode() && loopQuestionUniqueKey != null){ + QuestionEntity loopQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, loopQuestionUniqueKey, 0); + SurveyDataEntity surveyDataEntity = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKey(projectCode, answerId, loopQuestionEntity.getQuestionUniqueKey()); + + if(surveyDataEntity != null) { // loop 저장 + Type surveyDataType = new TypeToken>(){}.getType(); + List answerDataList = gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType); + + answerDataList.sort(Comparator.comparing(SurveyDataStructureDto::getR).thenComparing(SurveyDataStructureDto::getS)); + + List blockLoopEntityList = new ArrayList<>(); + + int index = 1; + for(SurveyDataStructureDto surveyDataStructureDto : answerDataList){ + blockLoopEntityList.add(SurveyBlockLoopEntity.builder(). + projectCode(projectCode). + blockCode(questionBlockCollectEntity.getBlockCode()). + order(index++). + answerId(answerId). + loopId(surveyDataStructureDto.getS()). + build()); + } + + questionBlockLoopRepository.deleteByProjectCodeAndAnswerIdAndBlockCode(projectCode, answerId, questionBlockCollectEntity.getBlockCode()); + questionBlockLoopRepository.saveAll(blockLoopEntityList); + + nextLoopInfo.setLoopId(blockLoopEntityList.get(0).getLoopId()); + } + } + } +// //혹시 추후 솔로문항 문항반복 시 추가 +// else{ +// QuestionOptionEntity questionOptionEntity = questionOptionRepository.findByProjectCodeAndQuestionUniqueKey(projectCode, nextQuestionUniqueKey); +// +// Gson gson = new Gson(); +// Type blockOptionType = new TypeToken>(){}.getType(); +// List optionList = gson.fromJson(questionOptionEntity.getOptionValue(), blockOptionType); +// +// for(QuestionOptionDto option : optionList){ //옵션 체크 +// if(option.getTypeTotalCode().equals("100102")) { //반복 질문 옵션 있을 시, 선택한 보기 저장 +// loopQuestionId = option.getValue(); +// } +// } +// +// QuestionEntity loopQuestionEntity = questionRepository.findFirstByProjectCodeAndQuestionIDAndIsDelete(projectCode, loopQuestionId, 0); +// +// if(loopQuestionEntity != null) { +// SurveyDataEntity surveyDataEntity = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKey(projectCode, answerId, loopQuestionEntity.getQuestionUniqueKey()); +// +// if(surveyDataEntity != null ) { // loop 저장 +// Type surveyDataType = new TypeToken>(){}.getType(); +// List answerDataList = gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType); +// +// answerDataList.sort(Comparator.comparing(SurveyDataStructureDto::getR).thenComparing(SurveyDataStructureDto::getS)); +// +// List blockLoopEntityList = new ArrayList<>(); +// +// int index = 1; +// for(SurveyDataStructureDto surveyDataStructureDto : answerDataList){ +// blockLoopEntityList.add(SurveyBlockLoopEntity.builder(). +// projectCode(projectCode). +// blockCode(-1). +// order(index++). +// answerId(answerId). +// loopId(surveyDataStructureDto.getS()). +// build()); +// } +// +// questionBlockLoopRepository.deleteByProjectCodeAndBlockCode(projectCode, -1); +// questionBlockLoopRepository.saveAll(blockLoopEntityList); +// +// nextLoopInfo.setLoopId(blockLoopEntityList.get(0).getLoopId()); +// } +// } +// } + + //루프아이디 변경 / 탈출 + int nextBlockCode = questionBlockCollectEntity == null ? -1 : questionBlockCollectEntity.getBlockCode(); + + if(dataSaveDto.getBlock_id() != nextBlockCode && dataSaveDto.getLoop_id() > -1){ + + List surveyBlockLoopEntityList = questionBlockLoopRepository.findAllByProjectCodeAndAnswerIdAndBlockCode(projectCode, answerId, dataSaveDto.getBlock_id()); + + //루프아이디 체크 후 루프 마지막 값이면 루프 -1/nextUK 반환 + if(surveyBlockLoopEntityList.size() == 0 || dataSaveDto.getLoop_id() == surveyBlockLoopEntityList.get(surveyBlockLoopEntityList.size() - 1).getLoopId()){ + if(nextBlockCode == -1) nextLoopInfo.setLoopId(-1); + }else{ //, 아니면 루프 다음 값/블록 처음 UK 반환 + List questionBlockCollectEntityList = questionBlockCollectionRepository.findAllByProjectCodeAndBlockCode(projectCode, dataSaveDto.getBlock_id()); + + boolean flag = false; + + for(SurveyBlockLoopEntity surveyBlockLoopEntity : surveyBlockLoopEntityList){ + if(flag){ + nextLoopInfo.setLoopId(surveyBlockLoopEntity.getLoopId()); + break; + } + + if(surveyBlockLoopEntity.getLoopId() == dataSaveDto.getLoop_id()){ + flag = true; + } + } + + nextLoopInfo.setNextUniqueKey(questionBlockCollectEntityList.get(0).getQuestionUniqueKey()); + } + } + + return nextLoopInfo; + } + + + private boolean quotaCheck(String projectCode, String answerId){ + //★★★★★★★★★★★추후 수정사항★★★★★★★★★ + //★★★ 쿼터 단계별로 다 체크 해야 할 것.★★★ + //★★★★★★★★★★★★★★★★★★★★★★★★★★★ + + //데이터 리스트 + List dataList = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKeyNot(projectCode, answerId, 1).stream().map(DataSaveDto::of).toList(); + + //쿼터 정보 + List quotaEntityList = quotaRepository.findAllByProjectCode(projectCode).stream().map(QuotaListDto::of).toList(); + + //해당 쿼터 있는지 체크 + for(QuotaListDto quotaListDto : quotaEntityList){ + int quotaUKCheck = 0; + List quotaUniqueKeyList = new ArrayList<>(); + + //Quota Col/Row UK 합치기 + quotaUniqueKeyList.addAll(quotaListDto.getColQuestionList()); + quotaUniqueKeyList.addAll(quotaListDto.getRowQuestionList()); + + //Data에서 Quota Col/Row UK 찾아서 값이 있는지 체크 + for(DataSaveDto surveyData : dataList){ + if(quotaUniqueKeyList.contains(surveyData.getQuestion_unique_key())) quotaUKCheck++; + } + + // 쿼터 UK 개수 == 데이터 UK 개수 + if(quotaUKCheck == quotaUniqueKeyList.size()){ + //세부 쿼터 정보(UK/VALUE) + List quotaCellEntityList = quotaCellRepository.findAllByProjectCodeAndQuotaCodeOrderByIdx(projectCode, quotaListDto.getQuotaCode()).stream().map(QuotaCellDto::of).collect(Collectors.toList()); + //쿼터에 맞는 데이터 리스트 필터링 + List surveyDataQuotaFilteringList = dataList.stream().filter(e -> quotaUniqueKeyList.contains(e.getQuestion_unique_key())).toList(); + + for(QuotaCellDto quotaCellDto : quotaCellEntityList){ + int quotaDetailUkCheck = 0; + QuotaCellDto matchQuotaCell = null; + + for(QuotaCellJsonDto quotaCellJsonDto : quotaCellDto.getQuotaInfo()){ //세부쿼터 + for(DataSaveDto dataSaveDto : surveyDataQuotaFilteringList){ //데이터리스트 + if(quotaCellJsonDto.getQuk() == dataSaveDto.getQuestion_unique_key()){ //UK체크 + for(SurveyDataStructureDto surveyDataStructureDto : dataSaveDto.getSurveyDataList()){ //보기값 체크 + if(surveyDataStructureDto.getS() == quotaCellJsonDto.getVal()) quotaDetailUkCheck++; + } + } + } + } + + //quota(quotaUkCheck)와 data(quotaDetailUkCheck) 일치할 때, + if(quotaUKCheck == quotaDetailUkCheck){ + matchQuotaCell = quotaCellDto; + + if(matchQuotaCell != null){ + List quotaDataList = quotaQueryRepository.findQuotaSurveyCount(projectCode, matchQuotaCell); + if(matchQuotaCell.getQuotaCount() <= quotaDataList.size()){ + return true; + } + } + } + + } + } + + } + + return false; + } + + public List getSavedDataLabelList(SurveyInfo surveyInfo) throws Exception { + surveyInfo.setSecurity_code(projectCodeDecrypt(surveyInfo.getSecurity_code())); + String strRegExp = "<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>"; + + + Gson gson = new Gson(); + List questionUniqueKeyAndDataList = new ArrayList<>(); + List surveyDataEntityList = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKeyNot(surveyInfo.getSecurity_code(), surveyInfo.getAnswer_id(), 1); + + Type surveyDataType = new TypeToken>(){}.getType(); + for(SurveyDataEntity surveyDataEntity : surveyDataEntityList){ + if(surveyDataEntity.getAnswerData() != null){ + questionUniqueKeyAndDataList.add(QuestionUniqueKeyAndDataDto.of(surveyDataEntity.getQuestionUniqueKey(), surveyDataEntity.getLoopId(), gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType))); + } + } + + List getDataLabelList = new ArrayList<>(); + + questionUniqueKeyAndDataList.sort(Comparator.comparing(QuestionUniqueKeyAndDataDto::getQuestion_unique_key)); + + //데이터 each + for(QuestionUniqueKeyAndDataDto questionUniqueKeyAndDataDto : questionUniqueKeyAndDataList){ + //정렬(1:T, 2:M, 3:R, 4:S 순서) + questionUniqueKeyAndDataDto.getSaved_data_list().sort(Comparator.comparing(SurveyDataStructureDto::getT) + .thenComparing(SurveyDataStructureDto::getM) + .thenComparing(SurveyDataStructureDto::getR) + .thenComparing(SurveyDataStructureDto::getS)); + + //최종 텍스트 + StringBuilder dataLabel = new StringBuilder(); + //Tensor, Matrix 숫자 달라질 때 + int tensorNum = 0, matrixNum = 0; + //문항 조회 + QuestionEntity questionEntity = questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(surveyInfo.getSecurity_code(), questionUniqueKeyAndDataDto.getQuestion_unique_key(), 0); + //Scalar 라벨 정보 + QuestionLabelJsonDto scalarLabelInfo = null; + //Matrix 라벨 정보 + QuestionLabelJsonDto matrixLabelInfo = null; + //Tensor 라벨 정보 + QuestionLabelJsonDto tensorLabelInfo = null; + + //라벨정보 세팅 + int dimension = questionEntity.getQuestionDimension(); + + if(questionEntity.getQuestionDimension() > 3){ + dimension = 3; + } + + for(int dim = dimension; dim>0; dim--){ + //문항 라벨 조회 + QuestionLabelEntity questionLabelEntity = questionLabelRepository.findByProjectCodeAndQuestionUniqueKeyAndLabelDimension(surveyInfo.getSecurity_code(), questionUniqueKeyAndDataDto.getQuestion_unique_key(), dim); + + if(questionLabelEntity != null){ + Type listType = new TypeToken>(){}.getType(); + List labelInfoDtoList = gson.fromJson(questionLabelEntity.getLabelInfo(), listType); + QuestionLabelOptionDto labelOptionDto = gson.fromJson(questionLabelEntity.getLabelOption(), QuestionLabelOptionDto.class); + + switch (dim){ + case 1 -> { + scalarLabelInfo = new QuestionLabelJsonDto(labelInfoDtoList, labelOptionDto); + } + case 2 -> { + matrixLabelInfo = new QuestionLabelJsonDto(labelInfoDtoList, labelOptionDto); + } + case 3 -> { + tensorLabelInfo = new QuestionLabelJsonDto(labelInfoDtoList, labelOptionDto); + } + } + } + } + + //데이터 개수 체크 + int scalarDataCheck = 0, matrixDataCheck = 0, tensorDataCheck = 0, loopDataCheck = 0; + + //데이터 체크 + QuestionLabelInfoDto matchTensorLabelInfo = null; + QuestionLabelInfoDto matchMatrixLabelInfo = null; + QuestionLabelInfoDto matchScalarLabelInfo = null; + + //루프데이터일 경우 + if(questionUniqueKeyAndDataDto.getLoopId() > -1){ + dataLabel.append(questionUniqueKeyAndDataDto.getLoopId()).append(" - 【 "); + } + + for(SurveyDataStructureDto surveyData : questionUniqueKeyAndDataDto.getSaved_data_list()){ + + //데이터와 맞는 Tensor 라벨 정보 + if(surveyData.getT() > 0 && (matchTensorLabelInfo == null || surveyData.getT() != matchTensorLabelInfo.getValue())){ + for(QuestionLabelInfoDto questionLabelInfoDto : tensorLabelInfo.getLabel_info()){ + if(surveyData.getT() == questionLabelInfoDto.getValue()){ + matchTensorLabelInfo = questionLabelInfoDto; + break; + } + } + } + + //데이터와 맞는 Matrix 라벨 정보 + if(surveyData.getM() > 0 && (matchMatrixLabelInfo == null || surveyData.getM() != matchMatrixLabelInfo.getValue())){ + for(QuestionLabelInfoDto questionLabelInfoDto : matrixLabelInfo.getLabel_info()){ + if(surveyData.getM() == questionLabelInfoDto.getValue()){ + matchMatrixLabelInfo = questionLabelInfoDto; + break; + } + } + } + + //데이터와 맞는 Scalar 라벨 정보 + for(QuestionLabelInfoDto questionLabelInfoDto : scalarLabelInfo.getLabel_info()){ + if(surveyData.getS() == questionLabelInfoDto.getValue()){ + matchScalarLabelInfo = questionLabelInfoDto; + break; + } + } + + //매트릭스 끝날 때 + if(matchMatrixLabelInfo != null && matrixNum != matchMatrixLabelInfo.getValue() && matrixDataCheck != 0){ + //텐서 끝날 때 + if(matchTensorLabelInfo != null && tensorNum != matchTensorLabelInfo.getValue() && tensorDataCheck != 0){ + dataLabel.append(" }
").append(" ],
"); + + tensorDataCheck = 0; + }else if(tensorDataCheck != 0){ + dataLabel.append(" }, "); + }else{ + dataLabel.append(" },
"); + } + + scalarDataCheck = 0; + matrixDataCheck = 0; + } + + if(surveyData.getT() != tensorNum && tensorDataCheck == 0){ //텐서 시작할 때 + dataLabel.append(matchTensorLabelInfo.getValue()) + .append("(") + .append(matchTensorLabelInfo.getLabel().replaceAll(strRegExp,"")) + .append(")") + .append(": [
"); + + tensorNum = matchTensorLabelInfo.getValue(); + tensorDataCheck++; + } + + if(surveyData.getM() != matrixNum && matrixDataCheck == 0){ //매트릭스 시작할 때 + dataLabel.append(matchMatrixLabelInfo.getValue()) + .append("(") + .append(matchMatrixLabelInfo.getLabel().replaceAll(strRegExp,"")) + .append(")") + .append(": { "); + + matrixNum = matchMatrixLabelInfo.getValue(); + matrixDataCheck++; + } + + switch (questionEntity.getQuestionType()){ + case 21, 22, 121, 122, 221, 222, 321, 322 -> { + dataLabel.append(surveyData.getS()) + .append("(") + .append(matchScalarLabelInfo.getLabel().replaceAll(strRegExp,"")); + + if(!surveyData.getO().equals("")){ + dataLabel.append(" || ") + .append(surveyData.getO()); + } + + dataLabel.append(")"); + } + + case 31, 131, 231, 331 -> { + if(scalarDataCheck == 0){ + dataLabel.append(surveyData.getS()) + .append("(") + .append(matchScalarLabelInfo.getLabel().replaceAll(strRegExp,"")); + }else{ + dataLabel.append(", ") + .append(matchScalarLabelInfo.getValue()) + .append("(") + .append(matchScalarLabelInfo.getLabel().replaceAll(strRegExp,"")); + } + + if(!surveyData.getO().equals("")){ + dataLabel.append(" || ") + .append(surveyData.getO()); + } + + dataLabel.append(")"); + } + + case 32 -> { + if(scalarDataCheck == 0){ + dataLabel.append(surveyData.getR()) + .append("순위: ") + .append(surveyData.getS()) + .append("(") + .append(matchScalarLabelInfo.getLabel().replaceAll(strRegExp,"")); + }else{ + dataLabel.append(", ") + .append(surveyData.getR()) + .append("순위: ") + .append(surveyData.getS()) + .append("(") + .append(matchScalarLabelInfo.getLabel().replaceAll(strRegExp,"")); + } + + if(!surveyData.getO().equals("")){ + dataLabel.append(" || ") + .append(surveyData.getO()); + } + + dataLabel.append(")"); + + } + + case 41, 42 -> { + dataLabel.append(surveyData.getO()); + } + + case 91 -> { + dataLabel.append("파일명: ") + .append(surveyData.getO()); + } + } + + scalarDataCheck++; + } + + if(matrixDataCheck > 0){ + dataLabel.append(" }"); + } + + if(tensorDataCheck > 0){ + dataLabel.append("
]"); + } + + if(dataLabel.toString().trim().equals("")){ + dataLabel.append("데이터 없음"); + } + + if(questionUniqueKeyAndDataDto.getLoopId() > -1){ + dataLabel.append(" 】"); + } + + getDataLabelList.add(QuestionUniqueKeyAndLabelDto.builder() + .question_unique_key(questionUniqueKeyAndDataDto.getQuestion_unique_key()) + .loopId(questionUniqueKeyAndDataDto.getLoopId()) + .saved_data_list(dataLabel.toString()) + .build()); + } + + //중복키 필터링(루프 데이터 있을 경우, 합치는 로직) + int qulIndex = 0; + StringBuilder dataLabel = new StringBuilder(); + List loopFilterDataList = new ArrayList<>(); + + + for(QuestionUniqueKeyAndLabelDto qul : getDataLabelList){ + + if(qulIndex != getDataLabelList.size() - 1){ //마지막 요소가 아닐때, + if(getDataLabelList.get(qulIndex).getQuestion_unique_key() == getDataLabelList.get(qulIndex+1).getQuestion_unique_key()){ //뒤 문항이 같을 때, (루프만 다른경우임) + dataLabel.append(getDataLabelList.get(qulIndex).getSaved_data_list()).append(",
"); + }else{ + if(qulIndex == 0){ //맨 첫번째 + loopFilterDataList.add(QuestionUniqueKeyAndLabelDto.builder() + .question_unique_key(qul.getQuestion_unique_key()) + .saved_data_list(qul.getSaved_data_list()) + .build()); + }else if(getDataLabelList.get(qulIndex).getQuestion_unique_key() == getDataLabelList.get(qulIndex - 1).getQuestion_unique_key()){ + + dataLabel.append(getDataLabelList.get(qulIndex).getSaved_data_list()); + + loopFilterDataList.add(QuestionUniqueKeyAndLabelDto.builder() + .question_unique_key(qul.getQuestion_unique_key()) + .saved_data_list(dataLabel.toString()) + .build()); + }else{ + loopFilterDataList.add(QuestionUniqueKeyAndLabelDto.builder() + .question_unique_key(qul.getQuestion_unique_key()) + .saved_data_list(qul.getSaved_data_list()) + .build()); + } + + //데이터 초기화 + dataLabel.setLength(0); + } + }else{ // 마지막 요소일때 + if(getDataLabelList.get(qulIndex).getQuestion_unique_key() == getDataLabelList.get(qulIndex - 1).getQuestion_unique_key()){ //앞 문항이 같을 때, (루프만 다른경우임) + dataLabel.append(getDataLabelList.get(qulIndex).getSaved_data_list()); + + loopFilterDataList.add(QuestionUniqueKeyAndLabelDto.builder() + .question_unique_key(qul.getQuestion_unique_key()) + .saved_data_list(dataLabel.toString()) + .build()); + }else{ // 다르면 리스트 추가 + loopFilterDataList.add(QuestionUniqueKeyAndLabelDto.builder() + .question_unique_key(qul.getQuestion_unique_key()) + .saved_data_list(qul.getSaved_data_list()) + .build()); + } + } + + qulIndex++; + } + + + return loopFilterDataList; + } + + public ListContentGetResponseDto gangLogin(GangLoginRequestDto gangLoginRequestDto) throws Exception { + gangLoginRequestDto.setProjectCode(projectCodeDecrypt(gangLoginRequestDto.getProjectCode())); + + List listHeaderEntityList = listHeaderRepository.findAllByProjectCodeAndTypeLessThanEqualOrderByOrderNo(gangLoginRequestDto.getProjectCode(), 2); + List listContentEntityList = listContentRepository.findAllByProjectCode(gangLoginRequestDto.getProjectCode()); + + + List listContentGetResponseDtoList = listContentEntityList.stream().map(ListContentGetResponseDto::of).collect(Collectors.toList()); + + boolean idFlag = false, pwdFlag = false; + ListContentGetResponseDto matchList = null; + + for(ListContentGetResponseDto list : listContentGetResponseDtoList){ + LinkedHashMap listInfo = list.getListContent().get(0); + + idFlag = false; pwdFlag = false; + for(ListHeaderEntity listHeaderEntity : listHeaderEntityList){ + switch (listHeaderEntity.getType()){ + case 1 -> { + if(listInfo.get(listHeaderEntity.getName()).equals(gangLoginRequestDto.getLoginId())){ + idFlag = true; + } + } + case 2 -> { + if(listInfo.get(listHeaderEntity.getName()).equals(gangLoginRequestDto.getLoginPwd())){ + pwdFlag = true; + } + } + } + + if(idFlag && pwdFlag){ + matchList = list; + } + } + + if(matchList != null){ + break; + } + } + + if(matchList == null){ + throw new ApiException(HttpStatus.NOT_FOUND, "GLE404", "아이디와 비밀번호를 다시 확인해주세요.", null, "0"); + }else{ + return matchList; + } + } +} diff --git a/src/main/java/com/krt/sun/util/Common.java b/src/main/java/com/krt/sun/util/Common.java new file mode 100644 index 0000000..55841dd --- /dev/null +++ b/src/main/java/com/krt/sun/util/Common.java @@ -0,0 +1,56 @@ +package com.krt.sun.util; + +import com.krt.sun.exception.TextException; +import jakarta.activation.MimetypesFileTypeMap; +import org.springframework.core.io.Resource; +import org.springframework.http.HttpStatus; + +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; + +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); + } + + //문자열 -> 날짜 메소드 + public static Date convertStringToDate(String date) { + Date changeDate = null; + + try { + SimpleDateFormat dtFormat = new SimpleDateFormat("yyyy/MM/dd"); + changeDate = dtFormat.parse(date); + }catch (Exception e) { + throw new TextException(HttpStatus.BAD_REQUEST, "LVE400", "입력한 날짜 형식을 확인해주세요.", "0"); + } + + return changeDate; + } + + //날짜 -> 문자열 메소드 + public static String convertDateToString(Date date) { + String changeDate = null; + + try { + SimpleDateFormat dtFormat = new SimpleDateFormat("yyyy년 MM월 dd일"); + changeDate = dtFormat.format(date); + }catch (Exception e) { + throw new TextException(HttpStatus.BAD_REQUEST, "LVE400", "입력한 날짜 형식을 확인해주세요.", "0"); + } + return changeDate; + } + + //변환 시, 정수면 소수점 제거 + public static Object doubleCheck(Double num) { + return Math.round(num) == num ? String.format("%.0f", num) : num; + } +} diff --git a/src/main/java/com/krt/sun/util/FixedPanelRedirect.java b/src/main/java/com/krt/sun/util/FixedPanelRedirect.java new file mode 100644 index 0000000..e0220a3 --- /dev/null +++ b/src/main/java/com/krt/sun/util/FixedPanelRedirect.java @@ -0,0 +1,32 @@ +package com.krt.sun.util; + +import com.krt.sun.entity.question.QuestionEntity; +import com.krt.sun.repository.survey.SurveyDataQueryRepository; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.HashMap; +import java.util.Map; + +public class FixedPanelRedirect { + + public static String redirectChange(String redirectUrl, String panelCode, Map parameterList, QuestionEntity questionEntity) throws Exception { + + switch (panelCode){ + case "CLD": + String checkSum = ""; + String cloudKey = "FCBE24DF-9E69-4BE4-966A-ACEF39D47534"; + + //합치기 + checkSum = SecurityUtil.md5AndHexUpper(cloudKey + parameterList.get("SID") + parameterList.get("ECHO") + parameterList.get("RESULT")); + + redirectUrl = redirectUrl.replaceAll("\\[#CHECKSUM#\\]", checkSum); + break; + case "KIWI": + + redirectUrl += "&questionItemNumber=" + parameterList.get("LASTQID"); + break; + } + + return redirectUrl; + } +} diff --git a/src/main/java/com/krt/sun/util/IpUtil.java b/src/main/java/com/krt/sun/util/IpUtil.java new file mode 100644 index 0000000..4cb52ed --- /dev/null +++ b/src/main/java/com/krt/sun/util/IpUtil.java @@ -0,0 +1,56 @@ +package com.krt.sun.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/sun/util/RegexLabel.java b/src/main/java/com/krt/sun/util/RegexLabel.java new file mode 100644 index 0000000..4490f34 --- /dev/null +++ b/src/main/java/com/krt/sun/util/RegexLabel.java @@ -0,0 +1,241 @@ +package com.krt.sun.util; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.krt.sun.dto.question.label.QuestionLabelInfoDto; +import com.krt.sun.dto.question.label.QuestionLabelJsonDto; +import com.krt.sun.dto.question.label.QuestionLabelOptionDto; +import com.krt.sun.dto.question.response.QuestionInfoDto; +import com.krt.sun.dto.survey.response.SurveyDataStructureDto; +import com.krt.sun.entity.question.QuestionEntity; +import com.krt.sun.entity.question.QuestionLabelEntity; +import com.krt.sun.entity.survey.SurveyDataEntity; +import com.krt.sun.repository.question.QuestionLabelRepository; +import com.krt.sun.repository.question.QuestionRepository; +import com.krt.sun.repository.survey.SurveyDataRepository; +import com.krt.sun.service.QuestionService; +import com.krt.sun.service.SurveyService; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +@Component +@RequiredArgsConstructor +public class RegexLabel { + + private final SurveyDataRepository surveyDataRepository; + 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+)+(?![^\\[]*\\])"); + //questionDimension Regex + private final Pattern questionDimensionTypeRegex = Pattern.compile("(\\[){1}(\\w\\|?){1,}(\\]){1}"); + + // 응답값 치환 필요한 라벨을 UK -> QID로 변경 + public String UniqueKeyToQuestionIdLabelReplace(String projectCode, String text) { + Matcher textMatcher = pipingRegex.matcher(text); + StringBuilder stringBuilder = new StringBuilder(); + + while(textMatcher.find()) { + String regexText = textMatcher.group(); + Matcher questionIdMatcher = questionIdRegex.matcher(regexText); + String questionId = ""; + + if(questionIdMatcher.find()) { + int regexQuestionUniqueKey = Integer.parseInt(questionIdMatcher.group().replace("UK:", "")); + + QuestionEntity questionEntity = questionRepository.findFirstByProjectCodeAndQuestionUniqueKeyAndIsDelete(projectCode, regexQuestionUniqueKey, 0); + + if(questionEntity != null) + questionId = questionEntity.getQuestionID(); + + textMatcher.appendReplacement(stringBuilder, regexText.replace("UK:"+regexQuestionUniqueKey, questionId)); + } + } + + textMatcher.appendTail(stringBuilder); + + return stringBuilder.toString(); + } + + //응답값을 라벨과 변경 + public String answerToLabelReplace(String projectCode, String answer_id, String text, int loopId) { + Matcher textMatcher = pipingRegex.matcher(text); + StringBuilder stringBuilder = new StringBuilder(); + + Gson gson = new Gson(); + List responseAnswerDataList = null; + Type surveyDataType = new TypeToken>(){}.getType(); + + String strRegExp = "<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>"; + + while(textMatcher.find()) { + String regexText = textMatcher.group(); + Matcher questionIdMatcher = questionIdRegex.matcher(regexText); + Integer regexQuestionUniqueKey = null; + SurveyDataEntity surveyDataEntity = null; + List pipingList = new ArrayList<>(); + QuestionLabelJsonDto questionLabelJsonDto = null; + + if(questionIdMatcher.find()) + regexQuestionUniqueKey = Integer.parseInt(questionIdMatcher.group().replace("UK:", "")); + + if(regexQuestionUniqueKey != null) { + //응답 데이터 + surveyDataEntity = surveyDataRepository.findByProjectCodeAndAnswerIdAndQuestionUniqueKey(projectCode, answer_id, regexQuestionUniqueKey); + //라벨 정보 가져오기 + QuestionLabelEntity questionLabelEntity = questionLabelRepository.findByProjectCodeAndQuestionUniqueKeyAndLabelDimension(projectCode, regexQuestionUniqueKey, 1); + + if(questionLabelEntity != null){ + Type listType = new TypeToken>(){}.getType(); + List labelInfoDtoList = gson.fromJson(questionLabelEntity.getLabelInfo(), listType); + QuestionLabelOptionDto labelOptionDto = gson.fromJson(questionLabelEntity.getLabelOption(), QuestionLabelOptionDto.class); + + questionLabelJsonDto = new QuestionLabelJsonDto(labelInfoDtoList, labelOptionDto); + } + + } + + + if(surveyDataEntity != null) { + responseAnswerDataList = gson.fromJson(surveyDataEntity.getAnswerData(), surveyDataType); + + Matcher questionSelectMatcher = questionDimensionTypeRegex.matcher(regexText); + + if(questionSelectMatcher.find()) { //특정 값일 경우 필터링 + + //차원 배열 + List pipingQuestionStructure = Arrays.stream(questionSelectMatcher.group().toLowerCase().split("[\\|\\[\\]]")) + .filter(e -> !e.equals("")) + .map(String::trim) + .toList(); + + for(String qs : pipingQuestionStructure) { + String structure = qs.replaceAll("[\\d]", ""); + int value = Integer.parseInt(qs.replaceAll("[\\D]", "")); + + switch (structure) { + case "t": + responseAnswerDataList = responseAnswerDataList.stream().filter(e -> e.getT() == value).toList(); + break; + case "m": + responseAnswerDataList = responseAnswerDataList.stream().filter(e -> e.getM() == value).toList(); + break; + case "s": + responseAnswerDataList = responseAnswerDataList.stream().filter(e -> e.getS() == value).toList(); + break; + case "r": + responseAnswerDataList = responseAnswerDataList.stream().filter(e -> e.getR() == value).toList(); + break; + } + } + } + if(loopId != -1){ + for(QuestionLabelInfoDto label : questionLabelJsonDto.getLabel_info()) { + if(loopId == label.getValue()) pipingList.add(label.getLabel().replaceAll(strRegExp, "")); + } + }else{ + for(SurveyDataStructureDto sds : responseAnswerDataList) { + if(!sds.getO().equals("")) { + pipingList.add(sds.getO()); + }else { + for(QuestionLabelInfoDto label : questionLabelJsonDto.getLabel_info()) { + if(sds.getS() == label.getValue()) pipingList.add(label.getLabel().replaceAll(strRegExp, "")); + } + } + } + } + + textMatcher.appendReplacement(stringBuilder, String.join(",", pipingList)); + } + } + + textMatcher.appendTail(stringBuilder); + + return stringBuilder.toString(); + } + + //QuestionUniqueKey -> QID로 변경 + public void UniqueKeyToQuestionIdChange(String projectCode, QuestionInfoDto questionInfoDto) { + //타이틀 + questionInfoDto.setQuestion_title(UniqueKeyToQuestionIdLabelReplace(projectCode, questionInfoDto.getQuestion_title())); + //안내문 + questionInfoDto.setQuestion_description(UniqueKeyToQuestionIdLabelReplace(projectCode, questionInfoDto.getQuestion_description())); + + //라벨(Tensor) + int index = 0; + + if(questionInfoDto.getTensor_label() != null) { + for(QuestionLabelInfoDto qli : questionInfoDto.getTensor_label().getLabel_info()) { + qli.setLabel(UniqueKeyToQuestionIdLabelReplace(projectCode, qli.getLabel())); + questionInfoDto.getTensor_label().getLabel_info().set(index++, qli); + } + } + + //라벨(Matrix) + if(questionInfoDto.getMatrix_label() != null) { + index = 0; + for(QuestionLabelInfoDto qli : questionInfoDto.getMatrix_label().getLabel_info()) { + qli.setLabel(UniqueKeyToQuestionIdLabelReplace(projectCode, qli.getLabel())); + questionInfoDto.getMatrix_label().getLabel_info().set(index++, qli); + } + } + + //라벨(Scalar) + if(questionInfoDto.getScalar_label() != null) { + index = 0; + for(QuestionLabelInfoDto qli : questionInfoDto.getScalar_label().getLabel_info()) { + qli.setLabel(UniqueKeyToQuestionIdLabelReplace(projectCode, qli.getLabel())); + questionInfoDto.getScalar_label().getLabel_info().set(index++, qli); + } + } + } + + //PipingLabel -> answer로 변경 + public void labelToAnswerChange(String projectCode, String answer_id, QuestionInfoDto questionInfoDto) { + //타이틀 + questionInfoDto.setQuestion_title(answerToLabelReplace(projectCode, answer_id, questionInfoDto.getQuestion_title(), questionInfoDto.getLoop_id())); + //안내문 + questionInfoDto.setQuestion_description(answerToLabelReplace(projectCode, answer_id, questionInfoDto.getQuestion_description(), questionInfoDto.getLoop_id())); + + int index = 0; + + if(questionInfoDto.getTensor_label() != null) { + for(QuestionLabelInfoDto qli : questionInfoDto.getTensor_label().getLabel_info()) { + qli.setLabel(answerToLabelReplace(projectCode, answer_id, qli.getLabel(), questionInfoDto.getLoop_id())); + questionInfoDto.getTensor_label().getLabel_info().set(index++, qli); + } + } + + //라벨(Matrix) + if(questionInfoDto.getMatrix_label() != null) { + index = 0; + for(QuestionLabelInfoDto qli : questionInfoDto.getMatrix_label().getLabel_info()) { + qli.setLabel(answerToLabelReplace(projectCode, answer_id, qli.getLabel(), questionInfoDto.getLoop_id())); + questionInfoDto.getMatrix_label().getLabel_info().set(index++, qli); + } + } + + //라벨(Scalar) + if(questionInfoDto.getScalar_label() != null) { + index = 0; + for(QuestionLabelInfoDto qli : questionInfoDto.getScalar_label().getLabel_info()) { + qli.setLabel(answerToLabelReplace(projectCode, answer_id, qli.getLabel(), questionInfoDto.getLoop_id())); + questionInfoDto.getScalar_label().getLabel_info().set(index++, qli); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/com/krt/sun/util/RegexLogic.java b/src/main/java/com/krt/sun/util/RegexLogic.java new file mode 100644 index 0000000..2e64419 --- /dev/null +++ b/src/main/java/com/krt/sun/util/RegexLogic.java @@ -0,0 +1,155 @@ +package com.krt.sun.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 = "\\[(UK|uk)\\:\\d+\\]+(?![^\\[]*\\])(\\[.*?\\])*\\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 getUseQuestionUniqueKey(String logicString){ + List questionUniqueKeyList = new ArrayList<>(); + StringJoiner useQuestionUniqueKeyJoiner = new StringJoiner(","); + Pattern questionUniqueKeyPattern = Pattern.compile(questionUniqueKeyRegex); + Matcher questionUniqueKeyMatcher = questionUniqueKeyPattern.matcher(logicString); + + while (questionUniqueKeyMatcher.find()) { + String matchString = questionUniqueKeyMatcher.group().trim(); + Matcher uniqueKeyNumberMatcher = valuePattern.matcher(matchString); + uniqueKeyNumberMatcher.find(); + questionUniqueKeyList.add(uniqueKeyNumberMatcher.group().trim()); + } + + return questionUniqueKeyList.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 questionUniqueKeyPattern = Pattern.compile(questionUniqueKeyRegex); + Pattern operatorValuePattern = Pattern.compile(operatorValueRegex); + + String[] reservedTargetArray = new String[]{"t","m","r","l"}; + while (fullSyntaxMatcher.find()){ + String questionUniqueKey = ""; + StringJoiner fullSyntaxJoiner = new StringJoiner(" AND" + System.lineSeparator()); + + String fullSyntax = fullSyntaxMatcher.group(); + Matcher questionUniqueKeyMatcher = questionUniqueKeyPattern.matcher(fullSyntax); + while (questionUniqueKeyMatcher.find()) { + String matchString = questionUniqueKeyMatcher.group().trim(); + + Matcher uniqueKeyNumberMatcher = valuePattern.matcher(matchString); + uniqueKeyNumberMatcher.find(); + questionUniqueKey = uniqueKeyNumberMatcher.group().trim(); + 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 -> '\\$.\""+questionUniqueKey+"\"[*].\""+reservedTarget+"\"',json_array("+inValueString(reservedString)+"))"); + } + } + + //값 비교 쿼리 작성 + Matcher operatorValueMatcher = operatorValuePattern.matcher(fullSyntax); + while (operatorValueMatcher.find()) { + String matchString = operatorValueMatcher.group().trim(); + fullSyntaxJoiner.add(replaceLogicValueString(matchString, questionUniqueKey)); + } + + //쿼리문 조립 + 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 questionUniqueKey){ + ///////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 -> '\\$.\"" + questionUniqueKey + "\"[*].\"s\"',json_array(" + inValueString(operatorValueString) + "))"; + } + else if(positiveOrPattern.matcher(operatorValueString).matches()){ + returnString = "JSON_OVERLAPS(a.ANS_DATA -> '\\$.\"" + questionUniqueKey + "\"[*].\"s\"',json_array(" + inValueString(operatorValueString) + "))"; + } + else if(positiveNullPattern.matcher(operatorValueString).matches()){ + returnString = "a.ANS_DATA -> '\\$.\"" + questionUniqueKey + "\"[*].\"s\"' is null"; + } + else if(negativeAndPattern.matcher(operatorValueString).matches()){ + returnString = "( JSON_OVERLAPS(a.ANS_DATA -> '\\$.\"" + questionUniqueKey + "\"[*].\"s\"',json_array(" + inValueString(operatorValueString) + ")) = false OR a.ANS_DATA -> '\\$.\"" + questionUniqueKey + "\"[*].\"s\"' is null ) "; + } + else if(negativeOrPattern.matcher(operatorValueString).matches()){ + returnString = "( JSON_CONTAINS(a.ANS_DATA -> '\\$.\"" + questionUniqueKey + "\"[*].\"s\"',json_array(" + inValueString(operatorValueString) + ")) = false OR a.ANS_DATA -> '\\$.\"" + questionUniqueKey + "\"[*].\"s\"' is null ) "; + } + else if(negativeNullPattern.matcher(operatorValueString).matches()){ + returnString = "a.ANS_DATA -> '\\$.\"" + questionUniqueKey + "\"[*].\"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 -> '\\$.\"" + questionUniqueKey + "\"', '\\$[*]' 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/sun/util/SecurityUtil.java b/src/main/java/com/krt/sun/util/SecurityUtil.java new file mode 100644 index 0000000..c13a4e0 --- /dev/null +++ b/src/main/java/com/krt/sun/util/SecurityUtil.java @@ -0,0 +1,53 @@ +package com.krt.sun.util; + +import jakarta.xml.bind.DatatypeConverter; +import org.springframework.util.DigestUtils; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.util.Base64; + +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 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(StandardCharsets.UTF_8)); + //base64로 인코딩 + 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); + + Base64.Decoder decoder = Base64.getDecoder(); + byte[] decodedBytes = decoder.decode(cipherText.replaceAll("\\r\\n|\\r|\\n","")); + byte[] decrypted = c.doFinal(decodedBytes); + return new String(decrypted, StandardCharsets.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/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..32405bf --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,29 @@ +server.port=7070 +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 + +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.orm.jdbc.bind=trace + +#File Upload +spring.servlet.multipart.enabled=true +spring.servlet.multipart.file-size-threshold=2KB +spring.servlet.multipart.max-file-size=200MB +spring.servlet.multipart.max-request-size=215MB + +#jwt Secret Key +jwt.secret=VlwEyVBsYt9V7zq57TejMnVUyzblYcfPQye08f7MGVA9XkHa \ No newline at end of file diff --git a/src/test/java/com/krt/sun/SunApplicationTests.java b/src/test/java/com/krt/sun/SunApplicationTests.java new file mode 100644 index 0000000..4b54394 --- /dev/null +++ b/src/test/java/com/krt/sun/SunApplicationTests.java @@ -0,0 +1,13 @@ +package com.krt.sun; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class SunApplicationTests { + + @Test + void contextLoads() { + } + +}