From 3e9264ebc67077a41c9b3eab4fa9edb3be4e596e Mon Sep 17 00:00:00 2001 From: 8324144 Date: Mon, 18 May 2026 14:39:26 +0800 Subject: [PATCH] first commit --- pom.xml | 651 ++++++++++++++++ .../dfm/training/TrainingApplication.java | 32 + .../training/config/InterceptorConfigure.java | 35 + .../dfm/training/config/PageHelperConfig.java | 35 + .../dfm/training/config/TokenInterceptor.java | 28 + .../wepact/dfm/training/config/WebConfig.java | 21 + .../training/controller/BaseController.java | 48 ++ .../BehaviorEvidenceController.java | 95 +++ .../controller/DictionaryController.java | 43 ++ .../InternalInformationController.java | 153 ++++ .../controller/JobApplicationController.java | 415 +++++++++++ .../ProfessionalFeedbackController.java | 223 ++++++ .../training/controller/SyncController.java | 132 ++++ .../training/controller/UserController.java | 136 ++++ .../wepact/dfm/training/dto/AppliedParam.java | 23 + .../dfm/training/dto/CourseListRequest.java | 10 + .../dfm/training/dto/CourseListResponse.java | 36 + .../wepact/dfm/training/dto/Experience.java | 59 ++ .../dfm/training/dto/InternalInfoParam.java | 10 + .../cn/wepact/dfm/training/dto/PageParam.java | 11 + .../wepact/dfm/training/dto/Performance.java | 40 + .../dfm/training/dto/ProjectJoinRequest.java | 10 + .../dfm/training/dto/ProjectJoinResponse.java | 49 ++ .../dto/QualificationApplicationParam.java | 31 + .../dfm/training/dto/SequenceLevel.java | 18 + .../wepact/dfm/training/dto/SyncRequest.java | 27 + .../cn/wepact/dfm/training/dto/TaskInfo.java | 11 + .../dfm/training/dto/TaskScoreSummary.java | 45 ++ .../wepact/dfm/training/dto/UserBaseInfo.java | 49 ++ .../dfm/training/dto/entity/LevelScores.java | 50 ++ .../dfm/training/dto/entity/SyncTaskLog.java | 92 +++ .../training/dto/entity/SyncUserInfoLog.java | 51 ++ .../dfm/training/dto/entity/TAppCheck.java | 236 ++++++ .../dfm/training/dto/entity/TDictionary.java | 73 ++ .../dto/entity/TEvidenceSubmission.java | 87 +++ .../wepact/dfm/training/dto/entity/TOrg.java | 56 ++ .../training/dto/entity/TPerformanceRule.java | 188 +++++ .../dto/entity/TProfessionalFeedback.java | 141 ++++ .../dto/entity/TProfessionalStdRule.java | 131 ++++ .../dto/entity/TQualificationReview.java | 112 +++ .../dto/entity/TQualificationStandards.java | 62 ++ .../wepact/dfm/training/dto/entity/TUser.java | 60 ++ .../training/dto/entity/TUserPermission.java | 64 ++ .../training/mapper/LevelScoresMapper.java | 16 + .../dfm/training/mapper/LevelScoresMapper.xml | 28 + .../dfm/training/mapper/MyBatisBaseDao.java | 24 + .../training/mapper/MyBatisBaseMapper.java | 22 + .../training/mapper/SyncTaskLogMapper.java | 26 + .../dfm/training/mapper/SyncTaskLogMapper.xml | 382 ++++++++++ .../mapper/SyncUserInfoLogMapper.java | 25 + .../training/mapper/SyncUserInfoLogMapper.xml | 153 ++++ .../dfm/training/mapper/TAppCheckMapper.java | 15 + .../dfm/training/mapper/TAppCheckMapper.xml | 186 +++++ .../training/mapper/TDictionaryMapper.java | 15 + .../dfm/training/mapper/TDictionaryMapper.xml | 178 +++++ .../mapper/TEvidenceSubmissionMapper.java | 17 + .../mapper/TEvidenceSubmissionMapper.xml | 252 +++++++ .../dfm/training/mapper/TOrgMapper.java | 17 + .../wepact/dfm/training/mapper/TOrgMapper.xml | 144 ++++ .../mapper/TPerformanceRuleMapper.java | 15 + .../mapper/TPerformanceRuleMapper.xml | 144 ++++ .../mapper/TProfessionalFeedbackMapper.java | 16 + .../mapper/TProfessionalFeedbackMapper.xml | 457 ++++++++++++ .../mapper/TProfessionalStdRuleMapper.java | 16 + .../mapper/TProfessionalStdRuleMapper.xml | 246 ++++++ .../mapper/TQualificationReviewMapper.java | 34 + .../mapper/TQualificationReviewMapper.xml | 414 +++++++++++ .../mapper/TQualificationStandardsMapper.java | 36 + .../mapper/TQualificationStandardsMapper.xml | 231 ++++++ .../dfm/training/mapper/TUserMapper.java | 25 + .../dfm/training/mapper/TUserMapper.xml | 193 +++++ .../mapper/TUserPermissionMapper.java | 15 + .../training/mapper/TUserPermissionMapper.xml | 154 ++++ .../service/BehaviorEvidenceService.java | 47 ++ .../training/service/DictionaryService.java | 27 + .../service/InternalInformationService.java | 108 +++ .../service/JobApplicationService.java | 391 ++++++++++ .../service/ProfessionalFeedbackService.java | 231 ++++++ .../training/service/ProjectJoinService.java | 148 ++++ .../dfm/training/service/SyncTaskService.java | 635 ++++++++++++++++ .../training/service/SyncUserInfoService.java | 457 ++++++++++++ .../dfm/training/service/UserService.java | 144 ++++ .../dfm/training/util/AuthorizationUtil.java | 194 +++++ .../wepact/dfm/training/util/CodeUtils.java | 20 + .../cn/wepact/dfm/training/util/Constant.java | 138 ++++ .../wepact/dfm/training/util/CryptoUtil.java | 129 ++++ .../cn/wepact/dfm/training/util/DESUtils.java | 451 +++++++++++ .../wepact/dfm/training/util/DateHelper.java | 608 +++++++++++++++ .../dfm/training/util/HttpApiUtils.java | 164 ++++ .../dfm/training/util/HttpClientUtil.java | 77 ++ .../cn/wepact/dfm/training/util/IpUtil.java | 33 + .../cn/wepact/dfm/training/util/ListUtil.java | 33 + .../cn/wepact/dfm/training/util/PageUtil.java | 50 ++ .../wepact/dfm/training/util/PinYinUtil.java | 97 +++ .../wepact/dfm/training/util/RedisUtils.java | 703 ++++++++++++++++++ .../cn/wepact/dfm/training/util/SHA256.java | 50 ++ .../cn/wepact/dfm/training/util/SignUtil.java | 57 ++ .../dfm/training/util/StringSplitsUtil.java | 88 +++ .../cn/wepact/dfm/training/util/UUID16.java | 34 + .../dfm/training/util/WorkingDayUtil.java | 170 +++++ .../wepact/dfm/training/utils/EmailUtil.java | 74 ++ .../wepact/dfm/training/utils/FileUtil.java | 29 + .../cn/wepact/dfm/training/utils/Md5Util.java | 31 + .../wepact/dfm/training/utils/TokenUtil.java | 59 ++ src/main/resources/application-custom.yml | 67 ++ src/main/resources/application-local.yml | 61 ++ src/main/resources/application-test.yml | 65 ++ src/main/resources/application.yml | 3 + src/main/resources/logback-spring.xml | 91 +++ 109 files changed, 13139 insertions(+) create mode 100644 pom.xml create mode 100644 src/main/java/cn/wepact/dfm/training/TrainingApplication.java create mode 100644 src/main/java/cn/wepact/dfm/training/config/InterceptorConfigure.java create mode 100644 src/main/java/cn/wepact/dfm/training/config/PageHelperConfig.java create mode 100644 src/main/java/cn/wepact/dfm/training/config/TokenInterceptor.java create mode 100644 src/main/java/cn/wepact/dfm/training/config/WebConfig.java create mode 100644 src/main/java/cn/wepact/dfm/training/controller/BaseController.java create mode 100644 src/main/java/cn/wepact/dfm/training/controller/BehaviorEvidenceController.java create mode 100644 src/main/java/cn/wepact/dfm/training/controller/DictionaryController.java create mode 100644 src/main/java/cn/wepact/dfm/training/controller/InternalInformationController.java create mode 100644 src/main/java/cn/wepact/dfm/training/controller/JobApplicationController.java create mode 100644 src/main/java/cn/wepact/dfm/training/controller/ProfessionalFeedbackController.java create mode 100644 src/main/java/cn/wepact/dfm/training/controller/SyncController.java create mode 100644 src/main/java/cn/wepact/dfm/training/controller/UserController.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/AppliedParam.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/CourseListRequest.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/CourseListResponse.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/Experience.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/InternalInfoParam.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/PageParam.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/Performance.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/ProjectJoinRequest.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/ProjectJoinResponse.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/QualificationApplicationParam.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/SequenceLevel.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/SyncRequest.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/TaskInfo.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/TaskScoreSummary.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/UserBaseInfo.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/LevelScores.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/SyncTaskLog.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/SyncUserInfoLog.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/TAppCheck.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/TDictionary.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/TEvidenceSubmission.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/TOrg.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/TPerformanceRule.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/TProfessionalFeedback.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/TProfessionalStdRule.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/TQualificationReview.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/TQualificationStandards.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/TUser.java create mode 100644 src/main/java/cn/wepact/dfm/training/dto/entity/TUserPermission.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/LevelScoresMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/LevelScoresMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/MyBatisBaseDao.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/MyBatisBaseMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/SyncTaskLogMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/SyncTaskLogMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/SyncUserInfoLogMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/SyncUserInfoLogMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TAppCheckMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TAppCheckMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TDictionaryMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TDictionaryMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TEvidenceSubmissionMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TEvidenceSubmissionMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TOrgMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TOrgMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TPerformanceRuleMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TPerformanceRuleMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TProfessionalFeedbackMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TProfessionalFeedbackMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TProfessionalStdRuleMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TProfessionalStdRuleMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TQualificationReviewMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TQualificationReviewMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TQualificationStandardsMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TQualificationStandardsMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TUserMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TUserMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TUserPermissionMapper.java create mode 100644 src/main/java/cn/wepact/dfm/training/mapper/TUserPermissionMapper.xml create mode 100644 src/main/java/cn/wepact/dfm/training/service/BehaviorEvidenceService.java create mode 100644 src/main/java/cn/wepact/dfm/training/service/DictionaryService.java create mode 100644 src/main/java/cn/wepact/dfm/training/service/InternalInformationService.java create mode 100644 src/main/java/cn/wepact/dfm/training/service/JobApplicationService.java create mode 100644 src/main/java/cn/wepact/dfm/training/service/ProfessionalFeedbackService.java create mode 100644 src/main/java/cn/wepact/dfm/training/service/ProjectJoinService.java create mode 100644 src/main/java/cn/wepact/dfm/training/service/SyncTaskService.java create mode 100644 src/main/java/cn/wepact/dfm/training/service/SyncUserInfoService.java create mode 100644 src/main/java/cn/wepact/dfm/training/service/UserService.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/AuthorizationUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/CodeUtils.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/Constant.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/CryptoUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/DESUtils.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/DateHelper.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/HttpApiUtils.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/HttpClientUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/IpUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/ListUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/PageUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/PinYinUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/RedisUtils.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/SHA256.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/SignUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/StringSplitsUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/UUID16.java create mode 100644 src/main/java/cn/wepact/dfm/training/util/WorkingDayUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/utils/EmailUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/utils/FileUtil.java create mode 100644 src/main/java/cn/wepact/dfm/training/utils/Md5Util.java create mode 100644 src/main/java/cn/wepact/dfm/training/utils/TokenUtil.java create mode 100644 src/main/resources/application-custom.yml create mode 100644 src/main/resources/application-local.yml create mode 100644 src/main/resources/application-test.yml create mode 100644 src/main/resources/application.yml create mode 100644 src/main/resources/logback-spring.xml diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..f6d80f4 --- /dev/null +++ b/pom.xml @@ -0,0 +1,651 @@ + + + 4.0.0 + + cn.wepact.dfm + dependency-service + 1.0.2 + + + qualifications-management-service + 1.0.4 + qualifications-management-service + jar + + + + 1.8 + Greenwich.SR1 + 2.9.2 + + + + + com.xuxueli + xxl-job-core + 2.1.0 + + + + org.springframework.boot + spring-boot-starter-quartz + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.apache.httpcomponents + httpclient + 4.5.2 + + + org.apache.httpcomponents + httpcore + + + org.apache.httpcomponents + httpmime + + + com.alibaba + fastjson + 1.2.83 + + + + + io.springfox + springfox-swagger2 + ${swagger2.version} + + + io.springfox + springfox-swagger-ui + ${swagger2.version} + + + net.sf.json-lib + json-lib + 2.4 + jdk15 + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.0.1 + + + com.github.pagehelper + pagehelper-spring-boot-starter + 1.4.6 + + + + + + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + + org.springframework.boot + spring-boot-starter-amqp + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + com.google.code.gson + gson + 2.8.8 + + + + + + + + + mysql + mysql-connector-java + 8.0.18 + runtime + + + org.springframework.boot + spring-boot-starter-test + test + + + + cn.wepact.dfm + common-util + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.apache.commons + commons-lang3 + + + net.logstash.logback + logstash-logback-encoder + + + org.springframework.cloud + spring-cloud-starter-sleuth + + + org.springframework.cloud + spring-cloud-starter-zipkin + + + org.springframework.boot + spring-boot-starter-data-redis + 2.1.4.RELEASE + + + + + + + + + + + + + com.belerweb + pinyin4j + 2.5.0 + + + com.alibaba + druid-spring-boot-starter + 1.1.24 + + + + + + + + + + + + + + + com.alibaba + easyexcel + 2.1.4 + + + + javax.servlet + javax.servlet-api + 4.0.1 + provided + + + cn.hutool + hutool-all + 5.3.10 + + + + + + + + + + + + + + + + de.codecentric + spring-boot-admin-starter-client + 2.1.6 + + + + + com.sun.mail + javax.mail + 1.5.2 + + + + + + + + + + + + + + + + + + + org.apache.httpcomponents + httpcore + + + org.apache.httpcomponents + httpmime + + + com.alibaba + druid-spring-boot-starter + 1.1.24 + + + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + io.springfox + springfox-swagger2 + ${swagger2.version} + + + io.springfox + springfox-swagger-ui + ${swagger2.version} + + + net.sf.json-lib + json-lib + 2.4 + jdk15 + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.0.1 + + + + + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + org.projectlombok + lombok + + + + + + + + mysql + mysql-connector-java + 8.0.18 + runtime + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + + cn.wepact.dfm + common-util + [1.0.0,) + + + + org.apache.commons + commons-lang3 + + + + com.xuxueli + xxl-excel + 1.1.1 + + + cn.afterturn + easypoi-base + 3.2.0 + + + cn.afterturn + easypoi-annotation + 3.2.0 + + + cn.afterturn + easypoi-web + 3.2.0 + + + org.apache.poi + ooxml-schemas + 1.1 + + + com.itextpdf + itextpdf + 5.5.10 + + + com.github.tobato + fastdfs-client + 1.26.6 + + + + + + + com.itextpdf + itext-asian + 5.2.0 + + + com.aliyun + aliyun-java-sdk-airec + 1.2.0 + + + com.aliyun + aliyun-java-sdk-core + 4.5.7 + + + com.aliyun + aliyun-java-sdk-dysmsapi + 2.1.0 + + + com.aliyun + aliyun-java-sdk-push + 3.13.5 + + + + + org.apache.xmlgraphics + batik-codec + 1.12 + + + de.codecentric + spring-boot-admin-starter-client + 2.1.6 + + + junit + junit + 4.11 + + + com.alibaba + fastjson + 1.2.74 + + + + org.springframework.boot + spring-boot-starter-data-jpa + 2.1.4.RELEASE + + + + + + com.alibaba + easyexcel + 2.1.4 + + + + + + + + + + cn.hutool + hutool-all + 5.3.10 + + + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + + + + + + + org.apache.tomcat + tomcat-servlet-api + 9.0.45 + provided + + + + com.auth0 + java-jwt + 3.10.3 + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + qualifications-management-service + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + src/main/java + + **/*.properties + **/*.xml + + + false + + + src/main/resources + + **/*.properties + **/*.xml + **/*.yml + **/*.xlsx + **/*.xls + **/*.docx + **/*.pdf + + false + + + + + + + nexus-devcloud-releases + https://devcloud.dfmc.com.cn/nexus/repository/maven-public/ + + + + + nexus-devcloud-releases + https://devcloud.dfmc.com.cn/nexus/repository/maven-public/ + + + + + nexus-devcloud-releases + https://devcloud.dfmc.com.cn/nexus/repository/maven-releases/ + + + nexus-devcloud-snapshots + https://devcloud.dfmc.com.cn/nexus/repository/maven-snapshots/ + + + + diff --git a/src/main/java/cn/wepact/dfm/training/TrainingApplication.java b/src/main/java/cn/wepact/dfm/training/TrainingApplication.java new file mode 100644 index 0000000..8d9b1f9 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/TrainingApplication.java @@ -0,0 +1,32 @@ +package cn.wepact.dfm.training; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; + +@SpringBootApplication +@ComponentScan("cn.wepact") +@EnableAsync +@EnableScheduling +@MapperScan({"cn.wepact.dfm.training.mapper"}) +//@EnableDiscoveryClient + +public class TrainingApplication extends SpringBootServletInitializer { + + public static void main(String[] args) { + SpringApplication.run(TrainingApplication.class, args); + } + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + // 注意这里要指向原先用main方法执行的Application启动类 + return builder.sources(TrainingApplication.class); + } + +} diff --git a/src/main/java/cn/wepact/dfm/training/config/InterceptorConfigure.java b/src/main/java/cn/wepact/dfm/training/config/InterceptorConfigure.java new file mode 100644 index 0000000..fd16a73 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/config/InterceptorConfigure.java @@ -0,0 +1,35 @@ +package cn.wepact.dfm.training.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class InterceptorConfigure implements WebMvcConfigurer { + @Override + public void addCorsMappings(CorsRegistry corsRegistry){ + /** + * 所有请求都允许跨域,使用这种配置就不需要 + * 在interceptor中配置header了 + */ +// corsRegistry.addMapping("/**") //接口匹配 +// .allowCredentials(true) +// .allowedOrigins("*") +// .allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE") +// .allowedHeaders("*") +// .maxAge(3600); + // 设置允许跨域的路径 + corsRegistry.addMapping("/**") + // 设置允许跨域请求的域名 + .allowedOrigins("*") + // 是否允许cookie + .allowCredentials(true) + // 设置允许的请求方式 + .allowedMethods("GET", "POST", "DELETE", "PUT") + // 设置允许的header属性 + .allowedHeaders("*") + // 跨域允许时间 + .maxAge(3600); + + } +} diff --git a/src/main/java/cn/wepact/dfm/training/config/PageHelperConfig.java b/src/main/java/cn/wepact/dfm/training/config/PageHelperConfig.java new file mode 100644 index 0000000..f1c3171 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/config/PageHelperConfig.java @@ -0,0 +1,35 @@ +package cn.wepact.dfm.training.config; + +import com.github.pagehelper.PageInterceptor; +import org.apache.ibatis.session.SqlSessionFactory; +import org.springframework.context.annotation.Configuration; +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.util.List; +import java.util.Properties; + +/** + * @author pcc + * 这是分页插件PageHelper的配置信息 + * 使用PageHelper的原因是MP的分页对于多表分页查询和自定义查询的分页支持不够优秀 + */ +@Configuration +public class PageHelperConfig { + + /** + * 可能存在多个连接工厂,是允许这么注入的 + */ + @Resource + private List sqlSessionFactoryList; + + @PostConstruct + public void initConfig(){ + PageInterceptor pageInterceptor = new PageInterceptor(); + Properties properties = new Properties(); + // 设置数据源方言,使用mysql + properties.setProperty("helperDialect","mysql"); + + pageInterceptor.setProperties(properties); + sqlSessionFactoryList.forEach(factory ->factory.getConfiguration().addInterceptor(pageInterceptor)); + } +} diff --git a/src/main/java/cn/wepact/dfm/training/config/TokenInterceptor.java b/src/main/java/cn/wepact/dfm/training/config/TokenInterceptor.java new file mode 100644 index 0000000..990ef3b --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/config/TokenInterceptor.java @@ -0,0 +1,28 @@ +package cn.wepact.dfm.training.config; + +import cn.wepact.dfm.training.utils.TokenUtil; +import com.auth0.jwt.interfaces.Claim; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; + +@Component +public class TokenInterceptor implements HandlerInterceptor { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + String token = request.getHeader("Authorization"); + if (token != null && !token.isEmpty()) { + Map claims = TokenUtil.verifyToken(token); + if (claims != null) { + return true; + } + } + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + response.getWriter().write("Unauthorized"); + return false; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/config/WebConfig.java b/src/main/java/cn/wepact/dfm/training/config/WebConfig.java new file mode 100644 index 0000000..2770bbf --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/config/WebConfig.java @@ -0,0 +1,21 @@ +package cn.wepact.dfm.training.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +//@Configuration +public class WebConfig implements WebMvcConfigurer { + + @Autowired + private TokenInterceptor tokenInterceptor; + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(tokenInterceptor).addPathPatterns("/**") + .excludePathPatterns("/users/login", + "/users/getDeptList", + "/public/**"); + } +} diff --git a/src/main/java/cn/wepact/dfm/training/controller/BaseController.java b/src/main/java/cn/wepact/dfm/training/controller/BaseController.java new file mode 100644 index 0000000..bf8046b --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/controller/BaseController.java @@ -0,0 +1,48 @@ +package cn.wepact.dfm.training.controller; + +import cn.wepact.dfm.training.dto.entity.TUser; +import cn.wepact.dfm.training.utils.TokenUtil; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.OutputStream; + +public class BaseController { + @Resource + HttpServletRequest request; + + /** + * 获取用户信息 + * + * @return + */ + public TUser getUserInfo() { + String token = request.getHeader("Authorization"); + TUser userInfo = TokenUtil.getUserInfo(token); + return userInfo; + } + + public void downloadFile(String filePath, HttpServletResponse response) throws IOException { + File file = new File(filePath); + // 将文件转为文件输入流 + FileInputStream fileInputStream = new FileInputStream(file); + // 获取响应的输出流 + OutputStream outputStream = response.getOutputStream(); + // 将文件转成字节数组,再将数组写入响应的输出流 + byte[] buffer = new byte[1024]; + int bytesRead = -1; + while ((bytesRead = fileInputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + // 刷新输出流 + outputStream.flush(); + // 关闭流 + fileInputStream.close(); + outputStream.close(); + } + +} diff --git a/src/main/java/cn/wepact/dfm/training/controller/BehaviorEvidenceController.java b/src/main/java/cn/wepact/dfm/training/controller/BehaviorEvidenceController.java new file mode 100644 index 0000000..c4689c4 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/controller/BehaviorEvidenceController.java @@ -0,0 +1,95 @@ +package cn.wepact.dfm.training.controller; + + +import cn.wepact.dfm.common.util.GeneralRespBean; +import cn.wepact.dfm.common.util.StringUtils; +import cn.wepact.dfm.training.dto.PageParam; +import cn.wepact.dfm.training.dto.UserBaseInfo; +import cn.wepact.dfm.training.dto.entity.TEvidenceSubmission; +import cn.wepact.dfm.training.dto.entity.TProfessionalFeedback; +import cn.wepact.dfm.training.dto.entity.TQualificationStandards; +import cn.wepact.dfm.training.dto.entity.TUser; +import cn.wepact.dfm.training.service.BehaviorEvidenceService; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Date; +import java.util.List; + +@RestController +@RequestMapping("behavior-evidences") +public class BehaviorEvidenceController extends BaseController { + @Autowired + private BehaviorEvidenceService behaviorEvidenceService; + + // 获取个人行为举证列表 + @RequestMapping("/getPersonalBehaviorEvidenceList") + public GeneralRespBean> getPersonalBehaviorEvidenceList(@RequestBody PageParam tEvidenceSubmissionPageParam) { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + tEvidenceSubmissionPageParam.getCondition().setUserId(userInfo.getId()); + tEvidenceSubmissionPageParam.getCondition().setOrgCode(userInfo.getOrgCode()); + PageInfo personalBehaviorEvidenceList = behaviorEvidenceService.getPersonalBehaviorEvidenceList(tEvidenceSubmissionPageParam); + respBean.setData(personalBehaviorEvidenceList); + respBean.setMsg("获取个人行为举证列表成功!"); + respBean.setCode("200"); + return respBean; + } + + // 新增个人行为举证 + @RequestMapping("/addPersonalBehaviorEvidence") + public GeneralRespBean addPersonalBehaviorEvidence(@RequestBody TEvidenceSubmission evidence) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + evidence.setUserId(userInfo.getId()); + evidence.setCreatedBy(userInfo.getUserNo()); + evidence.setCreatedAt(new Date()); + evidence.setUpdatedBy(userInfo.getUserNo()); + evidence.setUpdatedAt(new Date()); + Boolean result = behaviorEvidenceService.addPersonalBehaviorEvidence(evidence); + if (result){ + respBean.setMsg("新增个人行为举证成功!"); + respBean.setCode("200"); + }else { + respBean.setMsg("新增个人行为举证失败!"); + respBean.setCode("500"); + } + return respBean; + } + + // 上传个人行为举证附件材料 + @RequestMapping("/uploadPersonalBehaviorEvidenceAttachment") + public GeneralRespBean uploadPersonalBehaviorEvidenceAttachment(@RequestParam("file") MultipartFile file) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + String uploadUrl = behaviorEvidenceService.uploadPersonalBehaviorEvidenceAttachment(userInfo, file); + if(StringUtils.isNotEmpty(uploadUrl)){ + respBean.setData(uploadUrl); + respBean.setMsg("上传专业回馈附件材料成功!"); + respBean.setCode("200"); + }else { + respBean.setMsg("上传专业回馈附件材料失败!"); + respBean.setCode("500"); + } + return respBean; + } + // 下载个人行为举证材料 + @RequestMapping("/downloadPersonalBehaviorEvidenceAttachment") + public void downloadProfessionalFeedbackAttachment(@RequestBody TEvidenceSubmission tEvidenceSubmission, + HttpServletResponse response) throws IOException { + TUser userInfo = getUserInfo(); + String filePath = tEvidenceSubmission.getEvidenceAttachment(); + if (StringUtils.isNotEmpty(filePath)) { + downloadFile(filePath, response); + } + } + +} diff --git a/src/main/java/cn/wepact/dfm/training/controller/DictionaryController.java b/src/main/java/cn/wepact/dfm/training/controller/DictionaryController.java new file mode 100644 index 0000000..e23d8af --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/controller/DictionaryController.java @@ -0,0 +1,43 @@ +package cn.wepact.dfm.training.controller; + + +import cn.wepact.dfm.common.util.GeneralRespBean; +import cn.wepact.dfm.training.dto.entity.TDictionary; +import cn.wepact.dfm.training.dto.entity.TEvidenceSubmission; +import cn.wepact.dfm.training.dto.entity.TUser; +import cn.wepact.dfm.training.service.BehaviorEvidenceService; +import cn.wepact.dfm.training.service.DictionaryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("dictionary") +public class DictionaryController extends BaseController { + @Autowired + private DictionaryService dictionaryService; + + // 获取个人行为举证列表 + @RequestMapping("/getDictionary") + public GeneralRespBean> getDictionary(@RequestBody TDictionary tDictionary) { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + tDictionary.setOrgCode(userInfo.getOrgCode()); + List result = dictionaryService.getDictionaryList(tDictionary); + if(!CollectionUtils.isEmpty(result)){ + respBean.setData(result); + respBean.setMsg("获取字典列表成功!"); + respBean.setCode("200"); + }else{ + respBean.setMsg("获取字典列表失败!"); + respBean.setCode("500"); + } + return respBean; + } + + +} diff --git a/src/main/java/cn/wepact/dfm/training/controller/InternalInformationController.java b/src/main/java/cn/wepact/dfm/training/controller/InternalInformationController.java new file mode 100644 index 0000000..78b34c6 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/controller/InternalInformationController.java @@ -0,0 +1,153 @@ +package cn.wepact.dfm.training.controller; + + +import cn.wepact.dfm.common.util.GeneralRespBean; +import cn.wepact.dfm.common.util.StringUtils; +import cn.wepact.dfm.training.dto.InternalInfoParam; +import cn.wepact.dfm.training.dto.PageParam; +import cn.wepact.dfm.training.dto.entity.TDictionary; +import cn.wepact.dfm.training.dto.entity.TQualificationStandards; +import cn.wepact.dfm.training.dto.entity.TUser; +import cn.wepact.dfm.training.service.InternalInformationService; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@RestController +@RequestMapping("internal-informations") +public class InternalInformationController extends BaseController { + @Autowired + private InternalInformationService internalInformationService; + + // 获取信息内置列表 + @PostMapping("/getInternalInformationList") + public GeneralRespBean> getInternalInformationList(@RequestBody PageParam internalInfoParam) { + GeneralRespBean> respBean = new GeneralRespBean<>(); + PageInfo internalInformationList = internalInformationService.getInternalInformationList(internalInfoParam); + respBean.setData(internalInformationList); + respBean.setMsg("获取信息内置列表成功!"); + respBean.setCode("200"); + return respBean; + } + + // 获取信息内置情况(废弃) +// @RequestMapping("/getInternalInformationSituation") +// public void getInternalInformationSituation() { +// internalInformationService.getInternalInformationSituation(); +// } + + // 岗位序列等级新增 + @RequestMapping("/addPositionSequenceLevel") + public GeneralRespBean addPositionSequenceLevel(@RequestBody TQualificationStandards tQualificationStandards) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + Boolean result = internalInformationService.addPositionSequenceLevel(tQualificationStandards, userInfo); + if (result){ + respBean.setMsg("岗位序列等级新增成功!"); + respBean.setCode("200"); + }else { + respBean.setMsg("岗位序列等级新增失败!"); + respBean.setCode("500"); + } + return respBean; + } + + // 岗位序列等级修改 + @RequestMapping("/modifyPositionSequenceLevel") + public GeneralRespBean modifyPositionSequenceLevel(@RequestBody TQualificationStandards tQualificationStandards) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + Boolean result = internalInformationService.modifyPositionSequenceLevel(tQualificationStandards, userInfo); + if (result){ + respBean.setMsg("岗位序列等级修改成功!"); + respBean.setCode("200"); + }else { + respBean.setMsg("岗位序列等级修改失败!"); + respBean.setCode("500"); + } + return respBean; + } + + // 岗位序列等级删除 + @RequestMapping("/deletePositionSequenceLevel") + public GeneralRespBean deletePositionSequenceLevel(@RequestBody TQualificationStandards tQualificationStandards) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + Boolean result = internalInformationService.deletePositionSequenceLevel(tQualificationStandards, userInfo); + if (result){ + respBean.setMsg("岗位序列等级删除成功!"); + respBean.setCode("200"); + }else { + respBean.setMsg("岗位序列等级删除失败!"); + respBean.setCode("500"); + } + return respBean; + } + + // 上传任职资格管理办法 + @RequestMapping("/uploadQualificationManagementMeasures") + public GeneralRespBean uploadQualificationManagementMeasures(@RequestParam("file") MultipartFile file) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + internalInformationService.uploadQualificationManagementMeasures(userInfo, file); + respBean.setMsg("上传任职资格管理办法成功!"); + respBean.setCode("200"); + return respBean; + } + + // 上传任职资格标准 + @RequestMapping("/uploadQualificationStandard/{path}") + public GeneralRespBean uploadQualificationStandard(@RequestParam("file") MultipartFile file, + @PathVariable("path") String path) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + String filePath = internalInformationService.uploadQualificationStandard(userInfo, file, path); + respBean.setData(filePath); + respBean.setMsg("上传任职资格标准成功!"); + respBean.setCode("200"); + return respBean; + } + + // 获取任职资格管理办法 + @RequestMapping("/getQualificationManagementMeasures") + public GeneralRespBean getQualificationManagementMeasures() { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + TDictionary qualificationManagementMeasures = internalInformationService.getQualificationManagementMeasures(userInfo); + if (qualificationManagementMeasures != null) { + respBean.setData(qualificationManagementMeasures); + respBean.setMsg("获取任职资格管理办法成功!"); + respBean.setCode("200"); + }else { + respBean.setMsg("获取任职资格管理办法失败!"); + respBean.setCode("500"); + } + return respBean; + } + + // 下载任职资格管理办法 + @RequestMapping("/downloadQualificationManagementMeasures") + public void downloadQualificationManagementMeasures(HttpServletResponse response) throws IOException { + TUser userInfo = getUserInfo(); + TDictionary qualificationManagementMeasures = internalInformationService.getQualificationManagementMeasures(userInfo); + if (qualificationManagementMeasures != null) { + downloadFile(qualificationManagementMeasures.getValue(), response); + } + } + + // 下载任职资格标准 + @RequestMapping("/downloadQualificationStandard") + public void downloadQualificationStandard(@RequestBody TQualificationStandards tQualificationStandard, + HttpServletResponse response) throws IOException { + TUser userInfo = getUserInfo(); + String filePath = tQualificationStandard.getQualificationCriteria(); + if (StringUtils.isNotEmpty(filePath)) { + downloadFile(filePath, response); + } + } + +} diff --git a/src/main/java/cn/wepact/dfm/training/controller/JobApplicationController.java b/src/main/java/cn/wepact/dfm/training/controller/JobApplicationController.java new file mode 100644 index 0000000..80d443c --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/controller/JobApplicationController.java @@ -0,0 +1,415 @@ +package cn.wepact.dfm.training.controller; + + +import cn.wepact.dfm.common.util.GeneralRespBean; +import cn.wepact.dfm.training.dto.*; +import cn.wepact.dfm.training.dto.entity.*; +import cn.wepact.dfm.training.service.JobApplicationService; +import cn.wepact.dfm.training.service.ProjectJoinService; +import cn.wepact.dfm.training.util.HttpApiUtils; +import com.github.pagehelper.PageInfo; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import io.swagger.annotations.ApiOperation; +import org.jboss.logging.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; +import java.util.*; + + +@RestController +@RequestMapping("job-applications") +public class JobApplicationController extends BaseController{ + @Autowired + private JobApplicationService jobApplicationService; + + @Value("${api.employeeResume.url}") + private String apiEmployeeResumeUrl; + @Resource + private HttpApiUtils httpApiUtils; + @Autowired + private ProjectJoinService projectJoinService; + Logger logger = Logger.getLogger(JobApplicationController.class); + @ApiOperation(value = "员工个人信息查询", notes = "") + @RequestMapping(value = "/getFullEmployeeResumeInformation/{employeeNo}", method = RequestMethod.GET) + public Map getFullEmployeeResumeInformation(@PathVariable("employeeNo") String employeeNo) { + Map map = new HashMap<>(); + try { + logger.info("获取员工个人信息开始"); + String url = apiEmployeeResumeUrl; + if (httpApiUtils == null) { + logger.error("httpApiUtils is null"); + } + logger.info("httpApiUtils: " + httpApiUtils); + logger.info("apiEmployeeResumeUrl: " + apiEmployeeResumeUrl); + logger.info("employeeNo: " + employeeNo); + String response = httpApiUtils.getRequestApi(url, employeeNo, 3); + System.out.println("Response: " + response); + // 解析 JSON + JsonObject jsonObject = JsonParser.parseString(response).getAsJsonObject(); + + // 提取 token + jsonObject = jsonObject.getAsJsonObject("data"); + + // 创建 Map + + + // 将 JsonObject 转换为 Map + for (Map.Entry entry : jsonObject.entrySet()) { + String key = entry.getKey(); + JsonElement valueElement = entry.getValue(); + // 将 JsonElement 转换为 Object + Object value = valueElement.isJsonPrimitive() ? valueElement.getAsString() : valueElement; + map.put(key, value); + } + + // 打印结果 + System.out.println("转换后的 Map: " + map); + logger.info("获取员工个人信息结束"); +// respBean.setCode(Constant.SUCCESS_CODE); +// respBean.setMsg(Constant.SUCCESS_MSG); +// respBean.setData(map); + // 解析 JSON + } catch (Exception e) { + e.printStackTrace(); + } + return map; + } + + // 任职申请基本信息查询 + @RequestMapping("/queryBasicInformation") + public GeneralRespBean queryBasicInformation() { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); +// //TODO 从ehr中拿到的数据转化为UserBaseInfo, userInfo.getUserNo() 为员工编号 +// //获取到ehr信息 + Map fullEmployeeResumeInformationMap = this.getFullEmployeeResumeInformation(userInfo.getUserNo()); +// //TODO 将ehr信息转化为UserBaseInfo, map -> UserBaseInfo实体 + Object name = fullEmployeeResumeInformationMap.get("name"); + String nameStr = (name != null) ? name.toString() : null; // 转换为字符串,如果为null则返回null + Object departName = fullEmployeeResumeInformationMap.get("departName"); + String departNameStr = (departName != null) ? departName.toString() : null; // 转换为字符串,如果为null则返回null + Object duty = fullEmployeeResumeInformationMap.get("duty"); + String dutyStr = (duty!= null) ? duty.toString() : null; // 转换为字符串,如果为null则返回null + Object highEduName = fullEmployeeResumeInformationMap.get("highEduName"); + String highEduNameStr = (highEduName!= null) ? highEduName.toString() : null; // 转换为字符串,如果为null则返回null + Object major = fullEmployeeResumeInformationMap.get("major"); + String majorStr = (major!= null) ? major.toString() : null; // 转换为字符串,如果为null则返回null + Object workDate = fullEmployeeResumeInformationMap.get("workDate"); + String workDateStr = (workDate!= null) ? workDate.toString() : null; // 转换为字符串,如果为null则返回null + Object orgDate = fullEmployeeResumeInformationMap.get("orgDate"); + String orgDateStr = (orgDate!= null) ? orgDate.toString() : null; // 转换为字符串,如果为null则返回null + Object performanceInRecentTwoYears = fullEmployeeResumeInformationMap.get("performanceInRecentTwoYears"); + String performanceInRecentTwoYearsStr = (performanceInRecentTwoYears!= null) ? performanceInRecentTwoYears.toString() : null; // 转换为字符串,如果为null则返回null + + UserBaseInfo userBaseInfo = UserBaseInfo.builder().userName(nameStr) + .curDepartment(departNameStr).curPosition(dutyStr) +// .curDeptTime("ehr找不到") + .highestDegree(highEduNameStr).major(majorStr).startWorkTime(workDateStr) + .joinTime(orgDateStr).performance(performanceInRecentTwoYearsStr).build(); + + //获取近两年的任职资格情况 + AppliedParam appliedParam = new AppliedParam(); + appliedParam.setUserId(userInfo.getId()); + appliedParam.setOrgCode(userInfo.getOrgCode()); + DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + List passedQualificationList = jobApplicationService.getPassedQualificationList(appliedParam); + for (TQualificationReview tQualificationReview : passedQualificationList) { + userBaseInfo.getSequenceLevel().add(SequenceLevel.builder() + .sequence(tQualificationReview.getPositionName()) + .level(tQualificationReview.getQualificationLevel()) + .startTime(df.format(tQualificationReview.getReviewTime())) + .endTime(df.format(tQualificationReview.getReviewEndTime())) + .status(tQualificationReview.getStatus()) + .validTime(tQualificationReview.getValidTime()).build()); + } + // 动态插入工作经历 + for (int i = 0; i ()); + } + + for (int i = 0; i < 2; i++) { + // 获取绩效信息,如果为 null 则设置为空值 + String performanceYear = null; + String performanceSelf = null; + + if (fullEmployeeResumeInformationMap.get("performanceYear" + i) != null) { + performanceYear = fullEmployeeResumeInformationMap.get("performanceYear" + i).toString(); + } + + if (fullEmployeeResumeInformationMap.get("performanceSelf" + i) != null) { + performanceSelf = fullEmployeeResumeInformationMap.get("performanceSelf" + i).toString(); + } + + // 检查是否有对应的绩效信息 + if (performanceYear != null || performanceSelf != null) { + userBaseInfo.getPerformanceList().add( + Performance.builder() + .performanceYear(performanceYear != null ? performanceYear : "-") // 如果为空,使用默认值 "-" + .performanceSelf(performanceSelf != null ? performanceSelf : "-") + .build() + ); + } + } + } else { + // 处理 fullEmployeeResumeInformationMap 为 null 的情况 +// log.error("fullEmployeeResumeInformationMap is null"); + } + + respBean.setData(userBaseInfo); + respBean.setMsg("获取任职申请基本信息成功!"); + respBean.setCode("200"); + return respBean; + } + + // 任职资格序列列表 + @GetMapping("/getQualificationSequenceList") + public GeneralRespBean> getQualificationSequenceList(String orgCode) { + GeneralRespBean> respBean = new GeneralRespBean(); + List tQualificationStandardsList = jobApplicationService.getQualificationSequenceList(orgCode); + respBean.setData(tQualificationStandardsList); + respBean.setMsg("获取任职资格序列列表成功!"); + respBean.setCode("200"); + return respBean; + } + + // 任职资格等级列表(废弃) +// @RequestMapping("/getQualificationLevelList") +// public void getQualificationLevelList() { +// jobApplicationService.getQualificationLevelList(); +// } + + // 任职资格课程清单列表 + // @RequestMapping("/getQualificationCourseList") + // public void getQualificationCourseList() { + // jobApplicationService.getQualificationCourseList(); + // } + + // 申请规则校验情况查询,废弃 +// @RequestMapping("/queryRuleValidationStatus") +// public void queryRuleValidationStatus() { +// jobApplicationService.queryRuleValidationStatus(); +// } + @RequestMapping(value = "/courseList", method = RequestMethod.POST) + public GeneralRespBean getCourseList(@RequestBody CourseListRequest request) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + // 获取单位简称 + TOrg tOrg = jobApplicationService.getOrgByCode(userInfo.getOrgCode()); + String shortName = tOrg != null ? tOrg.getShortName() : ""; + + // 拼接项目名称:单位简称-项目名称 + String projectName = request.getProjectName(); + request.setProjectName(shortName + "-" + projectName); + CourseListResponse response = projectJoinService.getCourseList(request); + if (response != null) { + respBean.setData(response); + respBean.setMsg("获取课程列表成功!"); + respBean.setCode("200"); + } else { + respBean.setMsg("获取课程列表失败!"); + respBean.setCode("500"); + } + return respBean; + } + // 提交任职申请 + @RequestMapping("/submitQualificationApplication") + public GeneralRespBean submitQualificationApplication(@RequestBody QualificationApplicationParam param) { + TUser userInfo = getUserInfo(); + GeneralRespBean respBean = new GeneralRespBean<>(); + String result = jobApplicationService.submitQualificationApplication(param, userInfo); + if (result.equals("申请成功")) { + respBean.setData(true); + respBean.setMsg("提交任职申请成功!"); + respBean.setCode("200"); + + }else { + respBean.setData(false); + respBean.setMsg(result); + respBean.setCode("500"); + } + return respBean; + } + + // 获取是否有学习考试进行中 + @RequestMapping("/isLearningExamInProgress") + public GeneralRespBean> isLearningExamInProgress() { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + Map learningExamInProgress = jobApplicationService.isLearningExamInProgress(userInfo); + if (learningExamInProgress !=null){ + respBean.setData(learningExamInProgress); + respBean.setMsg("有学习考试进行中!"); + respBean.setCode("200"); + }else { + respBean.setData(null); + respBean.setMsg("没有学习考试进行中!"); + respBean.setCode("500"); + } + return respBean; + } + + // 获取已申报任职资格列表 + @RequestMapping("/getDeclaredQualificationList") + public GeneralRespBean> getDeclaredQualificationList(@RequestBody PageParam appliedParam ) { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + if (appliedParam.getCondition() == null) { + appliedParam.setCondition(new AppliedParam()); + } + appliedParam.getCondition().setUserId(userInfo.getId()); + appliedParam.getCondition().setOrgCode(userInfo.getOrgCode()); + try { + PageInfo pageInfo = jobApplicationService.getDeclaredQualificationList(appliedParam); + respBean.setData(pageInfo); + respBean.setMsg("获取已申报任职资格列表成功!"); + respBean.setCode("200"); + }catch (Exception e) { + respBean.setMsg("获取已申报任职资格列表失败!"); + respBean.setCode("500"); + } + return respBean; + } + + // 获取资格审核列表 + @RequestMapping("/getQualificationAuditList") + public GeneralRespBean> getQualificationAuditList(@RequestBody PageParam appliedParam) { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + if (appliedParam.getCondition() == null) { + appliedParam.setCondition(new AppliedParam()); + } + appliedParam.getCondition().setOrgCode(userInfo.getOrgCode()); + try { + PageInfo pageInfo = jobApplicationService.getQualificationAuditList(appliedParam, userInfo); + respBean.setData(pageInfo); + respBean.setMsg("获取已申报任职资格列表成功!"); + respBean.setCode("200"); + }catch (Exception e) { + respBean.setMsg("获取已申报任职资格列表失败!"); + respBean.setCode("500"); + } + return respBean; + + } + + // 获取资格审核详情信息(废弃) +// @RequestMapping("/getQualificationAuditDetailInfo") +// public void getQualificationAuditDetailInfo() { +// jobApplicationService.getQualificationAuditDetailInfo(); +// } + + // 资格审核通过/驳回 + @RequestMapping("/qualificationAuditStatus") + public GeneralRespBean qualificationAuditStatus(@RequestBody TQualificationReview param) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + TQualificationReview tQualificationReview = new TQualificationReview(); + tQualificationReview.setId(param.getId()); + tQualificationReview.setStatus(param.getStatus()); + tQualificationReview.setReviewTime(new Date()); + tQualificationReview.setUpdatedBy(userInfo.getUserNo()); + tQualificationReview.setUpdatedAt(new Date()); + tQualificationReview.setOfflineScore(param.getOfflineScore()); + Boolean result = jobApplicationService.qualificationAuditStatus(tQualificationReview); + if (result) { + respBean.setData(true); + respBean.setMsg("资格审核成功!"); + respBean.setCode("200"); + }else { + respBean.setData(false); + respBean.setMsg("资格审核失败!"); + respBean.setCode("500"); + } + return respBean; + } + + + // 手动同步学习积分 + @RequestMapping("/manualSyncLearningPoints") + public void manualSyncLearningPoints() { + jobApplicationService.manualSyncLearningPoints(); + } + +// private static Map jsonToMap(JSONObject jsonObject) { +// Map map = new HashMap<>(); +// Iterator keys = jsonObject.keys(); +// +// while (keys.hasNext()) { +// String key = keys.next(); +// Object value = jsonObject.get(key); +// map.put(key, value); +// } +// +// return map; +// } + + //获取绩点计算规则 + @RequestMapping("/getPerformanceRuleList") + public GeneralRespBean> getPerformanceRuleList() { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + List tPerformanceRuleList = jobApplicationService.getPerformanceRuleList(userInfo.getOrgCode()); + if (CollectionUtils.isEmpty(tPerformanceRuleList)) { + respBean.setMsg("获取绩点计算规则失败!"); + respBean.setCode("500"); + }else { + respBean.setData(tPerformanceRuleList); + respBean.setMsg("获取绩点计算规则成功!"); + respBean.setCode("200"); + } + return respBean; + } + //获取任职申请校验规则 + @RequestMapping("/getAppCheck") + public GeneralRespBean getAppCheck(@RequestBody TAppCheck param) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser tUser = getUserInfo(); + param.setOrgCode(tUser.getOrgCode()); + TAppCheck tAppCheck = jobApplicationService.getAppCheck(param); + if (tAppCheck == null) { + respBean.setMsg("获取任职申请校验规则失败!"); + respBean.setCode("500"); + }else { + respBean.setData(tAppCheck); + respBean.setMsg("获取任职申请校验规则成功!"); + respBean.setCode("200"); + } + return respBean; + } + +} + + diff --git a/src/main/java/cn/wepact/dfm/training/controller/ProfessionalFeedbackController.java b/src/main/java/cn/wepact/dfm/training/controller/ProfessionalFeedbackController.java new file mode 100644 index 0000000..94496e1 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/controller/ProfessionalFeedbackController.java @@ -0,0 +1,223 @@ +package cn.wepact.dfm.training.controller; + + +import cn.wepact.dfm.common.util.GeneralRespBean; +import cn.wepact.dfm.common.util.StringUtils; +import cn.wepact.dfm.training.dto.PageParam; +import cn.wepact.dfm.training.dto.entity.TDictionary; +import cn.wepact.dfm.training.dto.entity.TProfessionalFeedback; +import cn.wepact.dfm.training.dto.entity.TProfessionalStdRule; +import cn.wepact.dfm.training.dto.entity.TUser; +import cn.wepact.dfm.training.service.ProfessionalFeedbackService; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +@RestController +@RequestMapping("professional-feedbacks") +public class ProfessionalFeedbackController extends BaseController{ + @Autowired + private ProfessionalFeedbackService professionalFeedbackService; + + // 获取专业回馈列表 + @PostMapping("/getProfessionalFeedbackList") + public GeneralRespBean> getProfessionalFeedbackList(@RequestBody PageParam tProfessionalFeedback) { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + tProfessionalFeedback.getCondition().setOrgCode(userInfo.getOrgCode()); + tProfessionalFeedback.getCondition().setUserId(userInfo.getId()); + PageInfo professionalFeedbackList = professionalFeedbackService.getProfessionalFeedbackList(tProfessionalFeedback); + respBean.setData(professionalFeedbackList); + respBean.setMsg("获取专业回馈列表成功!"); + respBean.setCode("200"); + return respBean; + } + // 获取专业回馈列表,管理员 + @PostMapping("/getProfessionalFeedbackByRoleList") + public GeneralRespBean> getProfessionalFeedbackByRoleList(@RequestBody PageParam tProfessionalFeedback) { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser tUser = getUserInfo(); + PageInfo professionalFeedbackList = professionalFeedbackService.getProfessionalFeedbackByRoleList(tProfessionalFeedback, tUser); + respBean.setData(professionalFeedbackList); + respBean.setMsg("获取专业回馈列表成功!"); + respBean.setCode("200"); + return respBean; + } + + // 新增专业回馈信息 + @PostMapping("/addProfessionalFeedbackInfo") + public GeneralRespBean addProfessionalFeedbackInfo(@RequestBody TProfessionalFeedback tProfessionalFeedback) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + tProfessionalFeedback.setUserId(userInfo.getId()); + tProfessionalFeedback.setOrgCode(userInfo.getOrgCode()); + tProfessionalFeedback.setCreatedBy(userInfo.getUserNo()); + tProfessionalFeedback.setUpdatedBy(userInfo.getUserNo()); + // 专业回馈数量不让员工自行填报,默认为1 + tProfessionalFeedback.setNumber(1); + Boolean result = professionalFeedbackService.addProfessionalFeedbackInfo(tProfessionalFeedback); + if (result){ + respBean.setMsg("新增专业回馈信息成功!"); + respBean.setCode("200"); + }else { + respBean.setMsg("新增专业回馈信息失败!"); + respBean.setCode("500"); + } + return respBean; + } + + // 上传专业回馈附件材料 + @PostMapping("/uploadProfessionalFeedbackAttachment") + public GeneralRespBean uploadProfessionalFeedbackAttachment(@RequestParam("file") MultipartFile file) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + String uploadUrl = professionalFeedbackService.uploadProfessionalFeedbackAttachment(userInfo, file); + if(StringUtils.isNotEmpty(uploadUrl)){ + respBean.setData(uploadUrl); + respBean.setMsg("上传专业回馈附件材料成功!"); + respBean.setCode("200"); + }else { + respBean.setMsg("上传专业回馈附件材料失败!"); + respBean.setCode("500"); + } + return respBean; + } + + // 下载任职资格管理办法 + @RequestMapping("/downloadProfessionalFeedbackAttachment") + public void downloadProfessionalFeedbackAttachment(@RequestBody TProfessionalFeedback tProfessionalFeedback, + HttpServletResponse response) throws IOException { + TUser userInfo = getUserInfo(); + String filePath = tProfessionalFeedback.getProofMaterial(); + if (StringUtils.isNotEmpty(filePath)) { + downloadFile(filePath, response); + } + } + + // 获取专业回馈类别列表 + @PostMapping("/getProfessionalFeedbackCategoryList") + public GeneralRespBean> getProfessionalFeedbackCategoryList() { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + List professionalFeedbackCategoryList = professionalFeedbackService.getProfessionalFeedbackCategoryList(userInfo); + respBean.setData(professionalFeedbackCategoryList); + respBean.setMsg("获取专业回馈类别列表成功!"); + respBean.setCode("200"); + return respBean; + } + + // 获取专业回馈类别结构 + @PostMapping("/getProfessionalFeedbackCategoryStruct") + public GeneralRespBean> getProfessionalFeedbackCategoryStruct() { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + List professionalFeedbackCategoryList = professionalFeedbackService.getProfessionalFeedbackCategoryStruct(userInfo); + respBean.setData(professionalFeedbackCategoryList); + respBean.setMsg("获取专业回馈类别列表成功!"); + respBean.setCode("200"); + return respBean; + } + + @PostMapping("/getProfessionalFeedbackDefineList") + public GeneralRespBean> getProfessionalFeedbackDefineList() { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + List data = professionalFeedbackService.getProfessionalFeedbackDefineList(userInfo); + respBean.setData(data); + respBean.setMsg("获取专业回馈定义列表成功!"); + respBean.setCode("200"); + return respBean; + } + + // 获取专业回馈单位列表 + @PostMapping("/getProfessionalFeedbackUnitList") + public GeneralRespBean> getProfessionalFeedbackUnitList() { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + List professionalFeedbackUnitList = professionalFeedbackService.getProfessionalFeedbackUnitList(userInfo); + respBean.setData(professionalFeedbackUnitList); + respBean.setMsg("获取专业回馈单位列表成功!"); + respBean.setCode("200"); + return respBean; + } + + // 获取专业回馈角色列表 + @PostMapping("/getProfessionalFeedbackRoleList") + public GeneralRespBean> getProfessionalFeedbackRoleList() { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + List professionalFeedbackRoleList = professionalFeedbackService.getProfessionalFeedbackRoleList(userInfo); + respBean.setData(professionalFeedbackRoleList); + respBean.setMsg("获取专业回馈角色列表成功!"); + respBean.setCode("200"); + return respBean; + } + + // 获取专业回馈层级列表 + @PostMapping("/getProfessionalFeedbackHierarchyList") + public GeneralRespBean> getProfessionalFeedbackHierarchyList() { + GeneralRespBean> respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + List professionalFeedbackHierarchyList = professionalFeedbackService.getProfessionalFeedbackHierarchyList(userInfo); + respBean.setData(professionalFeedbackHierarchyList); + respBean.setMsg("获取专业回馈层级列表成功!"); + respBean.setCode("200"); + return respBean; + } + + // 专业回馈附件查看(废弃) +// @PostMapping("/viewProfessionalFeedbackAttachment") +// public void viewProfessionalFeedbackAttachment() { +// professionalFeedbackService.viewProfessionalFeedbackAttachment(); +// } + + // 专业回馈审核通过 + @PostMapping("/professionalFeedbackAuditApproval") + public GeneralRespBean professionalFeedbackAuditApproval(@RequestBody TProfessionalFeedback tProfessionalFeedback) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + tProfessionalFeedback.setUpdatedBy(userInfo.getUserNo()); + tProfessionalFeedback.setAuditor(userInfo.getUsername()); + Boolean result = professionalFeedbackService.professionalFeedbackAuditApproval(tProfessionalFeedback); + if (result){ + respBean.setMsg("专业回馈审核通过成功!"); + respBean.setCode("200"); + }else { + respBean.setMsg("专业回馈审核通过失败!"); + respBean.setCode("500"); + } + return respBean; + } + + // 专业回馈审核驳回 + @PostMapping("/professionalFeedbackAuditRejection") + public GeneralRespBean professionalFeedbackAuditRejection(@RequestBody TProfessionalFeedback tProfessionalFeedback) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser userInfo = getUserInfo(); + tProfessionalFeedback.setUpdatedBy(userInfo.getUserNo()); + tProfessionalFeedback.setAuditor(userInfo.getUsername()); + Boolean result = professionalFeedbackService.professionalFeedbackAuditRejection(tProfessionalFeedback); + if (result){ + respBean.setMsg("专业回馈审核驳回成功!"); + respBean.setCode("200"); + }else { + respBean.setMsg("专业回馈审核驳回失败!"); + respBean.setCode("500"); + } + return respBean; + + } + + + // 查看专业回馈信息(废弃) +// @PostMapping("/viewProfessionalFeedbackInfo") +// public void viewProfessionalFeedbackInfo() { +// professionalFeedbackService.viewProfessionalFeedbackInfo(); +// } + +} diff --git a/src/main/java/cn/wepact/dfm/training/controller/SyncController.java b/src/main/java/cn/wepact/dfm/training/controller/SyncController.java new file mode 100644 index 0000000..6b0974b --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/controller/SyncController.java @@ -0,0 +1,132 @@ +package cn.wepact.dfm.training.controller; + +import cn.wepact.dfm.training.dto.SyncRequest; +import cn.wepact.dfm.training.dto.TaskScoreSummary; +import cn.wepact.dfm.training.service.SyncTaskService; +import cn.wepact.dfm.training.service.SyncUserInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.web.bind.annotation.*; + +import javax.transaction.Transactional; +import java.util.List; + +@RestController +@RequestMapping("sync") +public class SyncController { + + @Autowired + private SyncTaskService taskSyncService; + @Autowired + private SyncUserInfoService syncUserInfoService; + + @PostMapping("/syncTasks") + public ResponseEntity syncTasks(@RequestBody SyncRequest syncRequest) { + + // 调用 syncTasks 方法并传入请求数据 + taskSyncService.syncTasks(syncRequest); + + // 返回成功响应 + return ResponseEntity.ok("同步任务完成"); + } + @PostMapping("/syncUsers") + public ResponseEntity syncUsers(@RequestBody SyncRequest syncRequest) { + + // 调用 syncTasks 方法并传入请求数据 + syncUserInfoService.syncUserInfos(syncRequest); + + // 返回成功响应 + return ResponseEntity.ok("同步任务完成"); + } + +// /** +// * 获取每个学生每个项目下必修和选修的任务汇总分数 +// * @return 汇总任务分数的响应 +// */ +// @GetMapping("/task-scores") +// public ResponseEntity> getTaskScores() { +// List taskScoreSummaries = taskSyncService.getTaskScoreSummary(); +// return ResponseEntity.ok(taskScoreSummaries); +// } + /** + * 处理任务分数,插入或更新任职资格审核记录 + * @param taskScoreSummaries 学生任务汇总分数 + * @return 操作结果 + */ + @PostMapping("/process-scores") + public ResponseEntity processTaskScores() { + try { + List taskScoreSummaries = taskSyncService.getTaskScoreSummary(); + taskSyncService.processTaskScores(taskScoreSummaries); + return ResponseEntity.ok("任务分数处理成功"); + } catch (Exception e) { + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("任务分数处理失败: " + e.getMessage()); + } + } + + // 定时任务方法:每天某个时间点执行任务 +// @Scheduled(cron = "0 0 0 * * ?") // 每天0点执行,可以根据需求修改 cron 表达式 + @Scheduled(cron = "0 */10 * * * ?") // 每5分钟执行一次 + @PostMapping("/executeTasks") + @Transactional(rollbackOn = Exception.class) + public void executeTasks() { + + try { + // 第一个任务:同步用户 + syncUsers(); + + // 第二个任务:同步任务 + syncTasks(); + + // 第三个任务:处理任务分数 + processTaskScores(); + + } catch (Exception e) { + // 任务执行失败时的异常处理 + System.err.println("定时任务执行失败:" + e.getMessage()); + } + } + + // 同步用户信息 + + private void syncUsers() throws Exception { + try { + SyncRequest syncRequest = new SyncRequest(); + syncRequest.setDuration(0); + syncRequest.setSyncType("incremental"); + syncRequest.setOffset(0); + syncRequest.setLimit(20); + + ResponseEntity response = syncUserInfoService.syncUserInfos(syncRequest); + if (!response.getStatusCode().equals(HttpStatus.OK)) { + throw new Exception("同步用户失败: " + response.getBody()); + } + } catch (Exception e) { + System.err.println("同步用户失败: " + e.getMessage()); + throw new Exception("同步用户执行异常: " + e.getMessage()); + } + } + + // 同步任务 + private void syncTasks() throws Exception { + try { + SyncRequest syncRequest = new SyncRequest(); + syncRequest.setDuration(0); + syncRequest.setSyncType("incremental"); + syncRequest.setOffset(0); + syncRequest.setLimit(20); + ResponseEntity response = taskSyncService.syncTasks(syncRequest); + + if (!response.getStatusCode().equals(HttpStatus.OK)) { + throw new Exception("同步任务失败: " + response.getBody()); + } + } catch (Exception e) { + System.err.println("同步任务失败: " + e.getMessage()); + throw new Exception("同步任务执行异常: " + e.getMessage()); + } + } + + +} diff --git a/src/main/java/cn/wepact/dfm/training/controller/UserController.java b/src/main/java/cn/wepact/dfm/training/controller/UserController.java new file mode 100644 index 0000000..00cb559 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/controller/UserController.java @@ -0,0 +1,136 @@ +package cn.wepact.dfm.training.controller; + + +import cn.hutool.captcha.CaptchaUtil; +import cn.wepact.dfm.common.util.Constant; +import cn.wepact.dfm.common.util.GeneralRespBean; +import cn.wepact.dfm.common.util.StringUtils; +import cn.wepact.dfm.training.dto.entity.TOrg; +import cn.wepact.dfm.training.dto.entity.TUser; +import cn.wepact.dfm.training.service.UserService; +import cn.wepact.dfm.training.utils.EmailUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.util.List; + +@RestController +@RequestMapping("users") +public class UserController extends BaseController{ + @Autowired + private UserService userService; + + // 登录 + @PostMapping("/login") + public GeneralRespBean login(@RequestBody TUser loginRequest) { + GeneralRespBean respBean = new GeneralRespBean(); + TUser user = userService.loginAndGetUser(loginRequest); + String jsonString=null; + if (user != null) { + respBean.setData(user); + respBean.setMsg(Constant.SUCCESS_MSG); + respBean.setCode(Constant.SUCCESS_CODE); + } else { + respBean.setData(null); + respBean.setMsg("登录失败,账号密码错误,或单位选择有误!"); + respBean.setCode(Constant.ERROR_CODE); + } + + return respBean; + } + + // 注册 + @PostMapping("/register") + public GeneralRespBean register(@RequestBody TUser registerRequest) { + GeneralRespBean respBean = new GeneralRespBean(); + Boolean result = userService.register(registerRequest); + + if (result) { + respBean.setMsg(Constant.SUCCESS_MSG); + respBean.setCode(Constant.SUCCESS_CODE); + } else { + respBean.setMsg("注册失败,账号已经存在!"); + respBean.setCode(Constant.ERROR_CODE); + } + return respBean; + } + + @GetMapping("/getDeptList") + public GeneralRespBean> getDeptList() { + GeneralRespBean> respBean = new GeneralRespBean(); + List tOrgList = userService.getDeptList(); + respBean.setData(tOrgList); + respBean.setMsg(Constant.SUCCESS_MSG); + respBean.setCode(Constant.SUCCESS_CODE); + return respBean; + } + + /** + * 用于生成带六位数字验证码并发送邮件 + */ + @PostMapping(value = "/captcha") + public GeneralRespBean captchacode(HttpSession session) throws Exception { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser user = getUserInfo(); + String randomCode = userService.generateRandomCode(); + session.setAttribute("randomCode", randomCode); + session.setAttribute("codeTime",System.currentTimeMillis()); + //发送邮件 + EmailUtil.Email email = new EmailUtil.Email(); + email.setTo(user.getEmail()); + email.setSubject("任职资格管理系统验证码"); + email.setContent("您的验证码为:"+randomCode); + EmailUtil.sendMail(email); + respBean.setMsg("验证码发送成功!"); + respBean.setCode("200"); + + return respBean; + } + + /** + * 更新密码 + */ + @PostMapping(value = "/updatePwd") + public GeneralRespBean updatePwd(HttpSession session, + @RequestBody TUser tUser) throws Exception { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser user = getUserInfo(); + tUser.setUserNo(user.getUserNo()); + // 获得验证码对象 + Object cko = session.getAttribute("randomCode"); + if (cko == null) { + return respBean.processErrorMsg("验证码已失效,请重新获取!"); + } + String captcha = cko.toString(); + // 判断验证码输入是否正确 + if (StringUtils.isEmpty(tUser.getRandomCode()) || captcha == null || !(tUser.getRandomCode().equalsIgnoreCase(captcha))) { + return respBean.processErrorMsg("验证码错误,请重新输入!"); + } else { + Long codeTime = Long.valueOf(session.getAttribute("codeTime") + ""); + if ((System.currentTimeMillis() - codeTime) / 1000 / 60 > 4) { + return respBean.processErrorMsg("验证码已失效,请重新获取!"); + } + return userService.updatePwd(tUser); + } + } + + // 取消预览 + @PostMapping("/cancelPreview") + public GeneralRespBean cancelPreview() { + GeneralRespBean respBean = new GeneralRespBean(); + TUser user = getUserInfo(); + Boolean result = userService.cancelPreview(user); + respBean.setData(result); + if (result) { + respBean.setMsg(Constant.SUCCESS_MSG); + respBean.setCode(Constant.SUCCESS_CODE); + } else { + respBean.setMsg("取消预览失败"); + respBean.setCode(Constant.ERROR_CODE); + } + + return respBean; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/AppliedParam.java b/src/main/java/cn/wepact/dfm/training/dto/AppliedParam.java new file mode 100644 index 0000000..9ecf38a --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/AppliedParam.java @@ -0,0 +1,23 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; +import java.util.List; + +@Data +public class AppliedParam { + private String orgCode; + private String positionName; + private String level; + private String status; + private List statusList; + private Long userId; + private Date reviewTime; + private Date startTime; + private String username; + private String userNo; + + private List positionNameList; +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/CourseListRequest.java b/src/main/java/cn/wepact/dfm/training/dto/CourseListRequest.java new file mode 100644 index 0000000..40d143c --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/CourseListRequest.java @@ -0,0 +1,10 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Data; + +@Data +public class CourseListRequest { + private String projectName; // 项目名称 + + // Getter and Setter methods +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/CourseListResponse.java b/src/main/java/cn/wepact/dfm/training/dto/CourseListResponse.java new file mode 100644 index 0000000..9179250 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/CourseListResponse.java @@ -0,0 +1,36 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Data; + +import java.util.List; +@Data +public class CourseListResponse { + private String subCode; + private String subMsg; + private String code; + private String msg; + private String requestId; + private String projectId; + private String projectName; + private String projectStatusName; + private List tasks; + + @Data + public static class Task { + private String targetId; + private String taskId; + private String name; + private List kngs; + // 新增字段 + private Integer type; + private Integer required; + } + + @Data + public static class Kng { + private String kngTitle; + private String kngId; + // 新增字段 + private String kngType; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/Experience.java b/src/main/java/cn/wepact/dfm/training/dto/Experience.java new file mode 100644 index 0000000..70cb00e --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/Experience.java @@ -0,0 +1,59 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Builder; +import lombok.Data; + +@Data +public class Experience { + private String startDate; + private String endDate; + private String orgName; + private String positionName; + + public Experience() { + + } + + // 使用Builder模式 + public static ExperienceBuilder builder() { + return new ExperienceBuilder(); + } + + public static class ExperienceBuilder { + private String startDate; + private String endDate; + private String orgName; + private String positionName; + + public ExperienceBuilder startDate(String startDate) { + this.startDate = startDate; + return this; + } + + public ExperienceBuilder endDate(String endDate) { + this.endDate = endDate; + return this; + } + + public ExperienceBuilder orgName(String orgName) { + this.orgName = orgName; + return this; + } + + public ExperienceBuilder positionName(String positionName) { + this.positionName = positionName; + return this; + } + + public Experience build() { + Experience experience = new Experience(); + experience.startDate = this.startDate; + experience.endDate = this.endDate; + experience.orgName = this.orgName; + experience.positionName = this.positionName; + return experience; + } + } +} + + diff --git a/src/main/java/cn/wepact/dfm/training/dto/InternalInfoParam.java b/src/main/java/cn/wepact/dfm/training/dto/InternalInfoParam.java new file mode 100644 index 0000000..bc57c1a --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/InternalInfoParam.java @@ -0,0 +1,10 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +public class InternalInfoParam { + private String orgCode; + private String positionName; +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/PageParam.java b/src/main/java/cn/wepact/dfm/training/dto/PageParam.java new file mode 100644 index 0000000..7e1cdc5 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/PageParam.java @@ -0,0 +1,11 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Data; + +@Data +public class PageParam { + private Integer pageNo; + private Integer pageSize; + private Integer totalCount; + private T condition; +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/Performance.java b/src/main/java/cn/wepact/dfm/training/dto/Performance.java new file mode 100644 index 0000000..6382a22 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/Performance.java @@ -0,0 +1,40 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Builder; +import lombok.Data; + +@Data +public class Performance { + private String performanceYear; + private String performanceSelf; + public Performance() { + // 默认构造函数 + } + + // 使用Builder模式 + public static PerformanceBuilder builder() { + return new PerformanceBuilder(); + } + + public static class PerformanceBuilder { + private String performanceYear; + private String performanceSelf; + + public PerformanceBuilder performanceYear(String performanceYear) { + this.performanceYear = performanceYear; + return this; + } + + public PerformanceBuilder performanceSelf(String performanceSelf) { + this.performanceSelf = performanceSelf; + return this; + } + + public Performance build() { + Performance performance = new Performance(); + performance.performanceYear = this.performanceYear; + performance.performanceSelf = this.performanceSelf; + return performance; + } + } +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/ProjectJoinRequest.java b/src/main/java/cn/wepact/dfm/training/dto/ProjectJoinRequest.java new file mode 100644 index 0000000..c3440c9 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/ProjectJoinRequest.java @@ -0,0 +1,10 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Data; + +@Data +public class ProjectJoinRequest { + private String projectId; // 项目id + private String userInfo; // 用户名称 + private String dateStr; // 日期(YYYY-MM-DD) +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/ProjectJoinResponse.java b/src/main/java/cn/wepact/dfm/training/dto/ProjectJoinResponse.java new file mode 100644 index 0000000..f1e2e2c --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/ProjectJoinResponse.java @@ -0,0 +1,49 @@ +package cn.wepact.dfm.training.dto; + +public class ProjectJoinResponse { + private String code; + private String msg; + private String subCode; + private String subMsg; + + public ProjectJoinResponse() {} + + public ProjectJoinResponse(String code, String msg, String subCode, String subMsg) { + this.code = code; + this.msg = msg; + this.subCode = subCode; + this.subMsg = subMsg; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public String getSubCode() { + return subCode; + } + + public void setSubCode(String subCode) { + this.subCode = subCode; + } + + public String getSubMsg() { + return subMsg; + } + + public void setSubMsg(String subMsg) { + this.subMsg = subMsg; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/QualificationApplicationParam.java b/src/main/java/cn/wepact/dfm/training/dto/QualificationApplicationParam.java new file mode 100644 index 0000000..e5f65f3 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/QualificationApplicationParam.java @@ -0,0 +1,31 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Data; + +@Data +public class QualificationApplicationParam { + /** + * 任职资格标准ID + */ + private Long qualificationStandardsId; + + /** + * 组织机构代码 + */ + private String orgCode; + + /** + * 当前部门 + */ + private String currentDepartment; + + /** + * 用户工号 + */ + private String userNo; + + /** + * 项目ID + */ + private Long projectId; +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/SequenceLevel.java b/src/main/java/cn/wepact/dfm/training/dto/SequenceLevel.java new file mode 100644 index 0000000..09d0ea0 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/SequenceLevel.java @@ -0,0 +1,18 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Builder; +import lombok.Data; + +import java.util.List; + +@Data +@Builder +public class SequenceLevel { + private String sequence; + private String level; + private String startTime; + private String endTime; + private String status; + private Float validTime; + +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/SyncRequest.java b/src/main/java/cn/wepact/dfm/training/dto/SyncRequest.java new file mode 100644 index 0000000..d311e63 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/SyncRequest.java @@ -0,0 +1,27 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class SyncRequest { + private int offset; + private int limit; + private int duration; + private String searchStartTime; + private String searchEndTime; + private String syncType; // 新增字段:同步类型(full 或 incremental) + public SyncRequest(int offset, int limit, int duration, String searchStartTime, String searchEndTime, String syncType) { + this.offset = offset; + this.limit = limit; + this.duration = duration; + this.searchStartTime = searchStartTime; + this.searchEndTime = searchEndTime; + this.syncType = syncType; + } + + public SyncRequest() { + + } +} \ No newline at end of file diff --git a/src/main/java/cn/wepact/dfm/training/dto/TaskInfo.java b/src/main/java/cn/wepact/dfm/training/dto/TaskInfo.java new file mode 100644 index 0000000..7e0f1b8 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/TaskInfo.java @@ -0,0 +1,11 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Data; + +@Data +public class TaskInfo { + private String taskName; + private String taskType; + + // Getter and Setter methods +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/TaskScoreSummary.java b/src/main/java/cn/wepact/dfm/training/dto/TaskScoreSummary.java new file mode 100644 index 0000000..1adb246 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/TaskScoreSummary.java @@ -0,0 +1,45 @@ +package cn.wepact.dfm.training.dto; + +import java.math.BigDecimal; + +public class TaskScoreSummary { + + private String stuUserId; // 学生用户 ID + private Long projectId; // 项目 ID + private BigDecimal requiredTotalScores; // 必修任务总分 + private BigDecimal electiveTotalScores; // 选修任务总分 + + // Getters and Setters + + public String getStuUserId() { + return stuUserId; + } + + public void setStuUserId(String stuUserId) { + this.stuUserId = stuUserId; + } + + public Long getProjectId() { + return projectId; + } + + public void setProjectId(Long projectId) { + this.projectId = projectId; + } + + public BigDecimal getRequiredTotalScores() { + return requiredTotalScores; + } + + public void setRequiredTotalScores(BigDecimal requiredTotalScores) { + this.requiredTotalScores = requiredTotalScores; + } + + public BigDecimal getElectiveTotalScores() { + return electiveTotalScores; + } + + public void setElectiveTotalScores(BigDecimal electiveTotalScores) { + this.electiveTotalScores = electiveTotalScores; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/UserBaseInfo.java b/src/main/java/cn/wepact/dfm/training/dto/UserBaseInfo.java new file mode 100644 index 0000000..dc78ca0 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/UserBaseInfo.java @@ -0,0 +1,49 @@ +package cn.wepact.dfm.training.dto; + +import lombok.Builder; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +@Builder +public class UserBaseInfo { + private String userName; + private String curDepartment; + private String curPosition; + private String curDeptTime; + private String highestDegree; + private String major; + private String startWorkTime; + private String joinTime; + private String performance; + private String qualification; + private List sequenceLevel; + private List experience; + private List performanceList; + public UserBaseInfo() { + sequenceLevel = new ArrayList<>(); + experience = new ArrayList<>(); + performanceList = new ArrayList<>(); + } + + public UserBaseInfo(String userName, String curDepartment, String curPosition, String curDeptTime, + String highestDegree, String major, String startWorkTime, String joinTime, + String performance, String qualification, List sequenceLevel, + List experience, List performanceList) { + this.userName = userName; + this.curDepartment = curDepartment; + this.curPosition = curPosition; + this.curDeptTime = curDeptTime; + this.highestDegree = highestDegree; + this.major = major; + this.startWorkTime = startWorkTime; + this.joinTime = joinTime; + this.performance = performance; + this.qualification = qualification; + this.sequenceLevel = (sequenceLevel != null) ? sequenceLevel : new ArrayList<>(); + this.experience = (experience != null) ? experience : new ArrayList<>(); + this.performanceList = (performanceList != null) ? performanceList : new ArrayList<>(); + } +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/LevelScores.java b/src/main/java/cn/wepact/dfm/training/dto/entity/LevelScores.java new file mode 100644 index 0000000..f95c6ab --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/LevelScores.java @@ -0,0 +1,50 @@ +package cn.wepact.dfm.training.dto.entity; + +public class LevelScores { + private Long id; + private String level; + private int requiredScore; + private int electiveScore; + private String orgCode; + + // Getters and Setters + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public int getRequiredScore() { + return requiredScore; + } + + public void setRequiredScore(int requiredScore) { + this.requiredScore = requiredScore; + } + + public int getElectiveScore() { + return electiveScore; + } + + public void setElectiveScore(int electiveScore) { + this.electiveScore = electiveScore; + } + + public String getUnitCode() { + return orgCode; + } + + public void setUnitCode(String unitCode) { + this.orgCode = orgCode; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/SyncTaskLog.java b/src/main/java/cn/wepact/dfm/training/dto/entity/SyncTaskLog.java new file mode 100644 index 0000000..b4da525 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/SyncTaskLog.java @@ -0,0 +1,92 @@ +package cn.wepact.dfm.training.dto.entity; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.persistence.*; +import java.sql.Timestamp; +import java.math.BigDecimal; + +@Entity +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Table(name = "sync_task_log") +public class SyncTaskLog { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private Timestamp syncTime; + private int offset; + private int limit; + private Timestamp searchStartTime; + private Timestamp searchEndTime; + private int status; + + private Long taskId; + private String orgId; + private Long projectId; + private Long mainProjectId; + private String stuUserId; + private String thirdUserId; + private int formal; + private Long periodId; + private int resultRepeatFlag; + private Long subResultId; + private Long subTaskId; + private int repeatCount; + private Long subTaskResultId; + private int orderIndex; + private int taskStatus; + private int taskRequired; + private BigDecimal taskSchedule; + private int taskManualCompleted; + private Timestamp taskStartTime; + private Timestamp taskCompletedTime; + private int taskDuration; + private int isRated; + private BigDecimal taskTargetScores; + private int taskPassed; + private int taskIsExcellent; + private int taskDelay; + private int taskSignStatus; + private int taskSignoutStatus; + private Timestamp taskSignTime; + private Timestamp taskSignoutTime; + private String taskSignAddress; + private String taskSignoutAddress; + private String taskAnswer; + private BigDecimal taskGetScores; + private int taskGetPoints; + private int taskGetStudyHours; + private int stuDeleted; + private int taskResultDeleted; + private int taskHasTutor; + private String ojtTeacherId; + private String ojtTeacherFullname; + private int ojtStudyStatus; + private Timestamp ojtOutTime; + private Timestamp ojtInTime; + private String trCreateUserId; + private String trUpdateUserId; + private Timestamp trUpdateTime; + private int taskType; + private Timestamp trCreateTime; + private Timestamp updateTime; + private Timestamp dbCreateTime; + private Timestamp dbUpdateTime; + + @Lob + private String responseData; + + private String errorMessage; + private Timestamp createdAt; + private Timestamp updatedAt; + + // getters and setters +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/SyncUserInfoLog.java b/src/main/java/cn/wepact/dfm/training/dto/entity/SyncUserInfoLog.java new file mode 100644 index 0000000..dd6c678 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/SyncUserInfoLog.java @@ -0,0 +1,51 @@ +package cn.wepact.dfm.training.dto.entity; + +import lombok.Data; + +import javax.persistence.Lob; +import java.util.Date; + +@Data +public class SyncUserInfoLog { + private String id; // 用户ID + private Date syncTime; // 同步时间 + private Integer offset; // 偏移量 + private Integer syncLimit; // 同步限制 + private Date searchStartTime; // 搜索开始时间 + private Date searchEndTime; // 搜索结束时间 + private Integer status; // 状态 + private String userId; // 用户唯一标识 + private String username; // 用户名 + private String fullname; // 全名 + private Integer gender; // 性别 (1: 男, 2: 女) + private String idNo; // 身份证号 + private Date birthday; // 生日 + private String deptId; // 部门ID + private String deptName; // 部门名称 + private String positionId; // 职位ID + private String positionName; // 职位名称 + private String gradeId; // 等级ID + private String gradeName; // 等级名称 + private String managerId; // 经理ID + private String managerFullname; // 经理全名 + private String deptManagerId; // 部门经理ID + private String deptManagerFullname; // 部门经理全名 + private String mobile; // 手机号 + private String email; // 邮箱 + private String userNo; // 用户工号 + private Date hireDate; // 入职时间 + private Date expiredTime; // 到期时间 + private String areaCode; // 区号 + private Integer userStatus; // 用户状态 + private String avatarUrl; // 头像URL + private Integer admin; // 是否是管理员 + private Integer deleted; // 是否删除 + private String thirdUserId; // 第三方用户ID + private Date createTime; // 创建时间 + private Date updateTime; // 更新时间 + private Integer userType; // 用户类型 + @Lob + private String responseData; + + private String errorMessage; +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/TAppCheck.java b/src/main/java/cn/wepact/dfm/training/dto/entity/TAppCheck.java new file mode 100644 index 0000000..f844168 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/TAppCheck.java @@ -0,0 +1,236 @@ +package cn.wepact.dfm.training.dto.entity; + +import java.io.Serializable; +import java.util.Date; + +/** + * t_app_check + * @author + */ +public class TAppCheck implements Serializable { + /** + * 主键 + */ + private Long id; + + /** + * 单位编码 + */ + private String orgCode; + + /** + * 学位 + */ + private String degree; + + /** + * 序列等级 + */ + private String level; + + /** + * 专业年限 + */ + private Integer sYear; + + /** + * 上一级序列停留时间 + */ + private Integer pYear; + + /** + * 绩效点数 + */ + private Integer jx; + + /** + * 更新时间 + */ + private Date updatedAt; + + /** + * 更新者 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date createdAt; + + /** + * 创建者 + */ + private String createdBy; + + /** + * 删除标识(0显示 1删除) + */ + private String delFlag; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getOrgCode() { + return orgCode; + } + + public void setOrgCode(String orgCode) { + this.orgCode = orgCode; + } + + public String getDegree() { + return degree; + } + + public void setDegree(String degree) { + this.degree = degree; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public Integer getsYear() { + return sYear; + } + + public void setsYear(Integer sYear) { + this.sYear = sYear; + } + + public Integer getpYear() { + return pYear; + } + + public void setpYear(Integer pYear) { + this.pYear = pYear; + } + + public Integer getJx() { + return jx; + } + + public void setJx(Integer jx) { + this.jx = jx; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + TAppCheck other = (TAppCheck) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getOrgCode() == null ? other.getOrgCode() == null : this.getOrgCode().equals(other.getOrgCode())) + && (this.getDegree() == null ? other.getDegree() == null : this.getDegree().equals(other.getDegree())) + && (this.getLevel() == null ? other.getLevel() == null : this.getLevel().equals(other.getLevel())) + && (this.getsYear() == null ? other.getsYear() == null : this.getsYear().equals(other.getsYear())) + && (this.getpYear() == null ? other.getpYear() == null : this.getpYear().equals(other.getpYear())) + && (this.getJx() == null ? other.getJx() == null : this.getJx().equals(other.getJx())) + && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt())) + && (this.getUpdatedBy() == null ? other.getUpdatedBy() == null : this.getUpdatedBy().equals(other.getUpdatedBy())) + && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt())) + && (this.getCreatedBy() == null ? other.getCreatedBy() == null : this.getCreatedBy().equals(other.getCreatedBy())) + && (this.getDelFlag() == null ? other.getDelFlag() == null : this.getDelFlag().equals(other.getDelFlag())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getOrgCode() == null) ? 0 : getOrgCode().hashCode()); + result = prime * result + ((getDegree() == null) ? 0 : getDegree().hashCode()); + result = prime * result + ((getLevel() == null) ? 0 : getLevel().hashCode()); + result = prime * result + ((getsYear() == null) ? 0 : getsYear().hashCode()); + result = prime * result + ((getpYear() == null) ? 0 : getpYear().hashCode()); + result = prime * result + ((getJx() == null) ? 0 : getJx().hashCode()); + result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode()); + result = prime * result + ((getUpdatedBy() == null) ? 0 : getUpdatedBy().hashCode()); + result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode()); + result = prime * result + ((getCreatedBy() == null) ? 0 : getCreatedBy().hashCode()); + result = prime * result + ((getDelFlag() == null) ? 0 : getDelFlag().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", orgCode=").append(orgCode); + sb.append(", degree=").append(degree); + sb.append(", level=").append(level); + sb.append(", sYear=").append(sYear); + sb.append(", pYear=").append(pYear); + sb.append(", jx=").append(jx); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", updatedBy=").append(updatedBy); + sb.append(", createdAt=").append(createdAt); + sb.append(", createdBy=").append(createdBy); + sb.append(", delFlag=").append(delFlag); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/TDictionary.java b/src/main/java/cn/wepact/dfm/training/dto/entity/TDictionary.java new file mode 100644 index 0000000..0b1f2ef --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/TDictionary.java @@ -0,0 +1,73 @@ +package cn.wepact.dfm.training.dto.entity; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * t_dictionary + * @author + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class TDictionary{ + /** + * 主键 + */ + private Long id; + + /** + * 单位id + */ + private String orgCode; + + /** + * 类型 + */ + private String type; + + /** + * 代码 + */ + private String code; + + /** + * 值 + */ + private String value; + + /** + * 版本号 + */ + private Integer version; + + /** + * 更新时间 + */ + private Date updatedAt; + + /** + * 更新者 + */ + private String updatedBy; + + /** + * 创建时间 + */ + private Date createdAt; + + /** + * 创建者 + */ + private String createdBy; + + /** + * 删除标识(0显示 1删除) + */ + private String delFlag; +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/TEvidenceSubmission.java b/src/main/java/cn/wepact/dfm/training/dto/entity/TEvidenceSubmission.java new file mode 100644 index 0000000..c3eabf8 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/TEvidenceSubmission.java @@ -0,0 +1,87 @@ +package cn.wepact.dfm.training.dto.entity; + +import lombok.Data; + +import java.util.Date; + +/** + * t_evidence_submission + * @author + */ +@Data +public class TEvidenceSubmission { + /** + * 证据唯一标识符 + */ + private Long id; + + /** + * 用户id + */ + private Long userId; + + /** + * 单位id + */ + private String orgCode; + + /** + * 证据编码 + */ + private String evidenceNo; + + /** + * 证据名称 + */ + private String evidenceName; + + /** + * 证据证明人 + */ + private String evidenceWitness; + + /** + * 证据附件路径,文件存储路径或URL + */ + private String evidenceAttachment; + + /** + * 上传日期 + */ + private Date uploadDate; + + /** + * 记录创建时间 + */ + private Date createdAt; + + /** + * 记录创建人姓名 + */ + private String createdBy; + + /** + * 记录最后更新时间 + */ + private Date updatedAt; + + /** + * 记录最后更新人姓名 + */ + private String updatedBy; + + /** + * 删除标识(0显示 1删除) + */ + private String delFlag; + + /** + * 证据内容简介 + */ + private String evidenceDescription; + + /** + * 备注 + */ + private String remarks; +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/TOrg.java b/src/main/java/cn/wepact/dfm/training/dto/entity/TOrg.java new file mode 100644 index 0000000..9efb0f0 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/TOrg.java @@ -0,0 +1,56 @@ +package cn.wepact.dfm.training.dto.entity; + +import lombok.Data; + +import java.util.Date; + +/** + * t_org + * @author + */ +@Data +public class TOrg { + /** + * 主键 + */ + private Long id; + + /** + * 单位名 + */ + private String name; + + /** + * 单位编码 + */ + private String code; + + /** + * 更新时间 + */ + private Date updatedAt; + + /** + * 更新者 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date createdAt; + + /** + * 创建者 + */ + private String createdBy; + + /** + * 删除标识(0显示 1删除) + */ + private String delFlag; + + // 单位简称 + private String shortName; + +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/TPerformanceRule.java b/src/main/java/cn/wepact/dfm/training/dto/entity/TPerformanceRule.java new file mode 100644 index 0000000..a9ef5e0 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/TPerformanceRule.java @@ -0,0 +1,188 @@ +package cn.wepact.dfm.training.dto.entity; + +import java.io.Serializable; +import java.util.Date; + +/** + * t_performance_rule + * @author + */ +public class TPerformanceRule implements Serializable { + /** + * 主键 + */ + private Long id; + + /** + * 单位编码 + */ + private String orgCode; + + /** + * 绩效 + */ + private String jxName; + + /** + * 分值 + */ + private Integer score; + + /** + * 更新时间 + */ + private Date updatedAt; + + /** + * 更新者 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date createdAt; + + /** + * 创建者 + */ + private String createdBy; + + /** + * 删除标识(0显示 1删除) + */ + private String delFlag; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getOrgCode() { + return orgCode; + } + + public void setOrgCode(String orgCode) { + this.orgCode = orgCode; + } + + public String getJxName() { + return jxName; + } + + public void setJxName(String jxName) { + this.jxName = jxName; + } + + public Integer getScore() { + return score; + } + + public void setScore(Integer score) { + this.score = score; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + TPerformanceRule other = (TPerformanceRule) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getOrgCode() == null ? other.getOrgCode() == null : this.getOrgCode().equals(other.getOrgCode())) + && (this.getJxName() == null ? other.getJxName() == null : this.getJxName().equals(other.getJxName())) + && (this.getScore() == null ? other.getScore() == null : this.getScore().equals(other.getScore())) + && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt())) + && (this.getUpdatedBy() == null ? other.getUpdatedBy() == null : this.getUpdatedBy().equals(other.getUpdatedBy())) + && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt())) + && (this.getCreatedBy() == null ? other.getCreatedBy() == null : this.getCreatedBy().equals(other.getCreatedBy())) + && (this.getDelFlag() == null ? other.getDelFlag() == null : this.getDelFlag().equals(other.getDelFlag())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getOrgCode() == null) ? 0 : getOrgCode().hashCode()); + result = prime * result + ((getJxName() == null) ? 0 : getJxName().hashCode()); + result = prime * result + ((getScore() == null) ? 0 : getScore().hashCode()); + result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode()); + result = prime * result + ((getUpdatedBy() == null) ? 0 : getUpdatedBy().hashCode()); + result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode()); + result = prime * result + ((getCreatedBy() == null) ? 0 : getCreatedBy().hashCode()); + result = prime * result + ((getDelFlag() == null) ? 0 : getDelFlag().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", orgCode=").append(orgCode); + sb.append(", jxName=").append(jxName); + sb.append(", score=").append(score); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", updatedBy=").append(updatedBy); + sb.append(", createdAt=").append(createdAt); + sb.append(", createdBy=").append(createdBy); + sb.append(", delFlag=").append(delFlag); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/TProfessionalFeedback.java b/src/main/java/cn/wepact/dfm/training/dto/entity/TProfessionalFeedback.java new file mode 100644 index 0000000..d0097a5 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/TProfessionalFeedback.java @@ -0,0 +1,141 @@ +package cn.wepact.dfm.training.dto.entity; + +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * t_professional_feedback + * @author + */ +@Data +public class TProfessionalFeedback{ + /** + * 回馈记录唯一标识符 + */ + private Long id; + + /** + * 用户id + */ + private Long userId; + + /** + * 单位id + */ + private String orgCode; + + /** + * 回馈类别 + */ + private String categoryCode; + + /** + * 定义 + */ + private String defineCode; + + + /** + * 具体任务 + */ + private String specificTask; + + /** + * 开始时间 + */ + private Date startTime; + + /** + * 结束时间 + */ + private Date endTime; + + /** + * 数量 + */ + private Integer number; + + /** + * 单位 + */ + private String unitCode; + + /** + * 任务发起单位 + */ + private String initiatingDepartment; + + /** + * 角色 + */ + private String roleCode; + + /** + * 层级 + */ + private String levelCode; + + /** + * 证明材料路径,文件存储路径或URL + */ + private String proofMaterial; + + /** + * 审核状态,如:待审核、已审核、未通过 + */ + private String auditStatus; + + /** + * 审核人 + */ + private String auditor; + + /** + * 审核日期 + */ + private Date auditDate; + + /** + * 记录创建时间 + */ + private Date createdAt; + + /** + * 记录创建人姓名 + */ + private String createdBy; + + /** + * 记录最后更新时间 + */ + private Date updatedAt; + + /** + * 记录最后更新人姓名 + */ + private String updatedBy; + + /** + * 删除标识(0显示 1删除) + */ + private String delFlag; + + private Float score; + + /** + * 备注 + */ + private String remarks; + + private String username; + + private String userNo; + + private List defineCodeList; + + private Date selectStartTime; + + private Date selectEndTime; +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/TProfessionalStdRule.java b/src/main/java/cn/wepact/dfm/training/dto/entity/TProfessionalStdRule.java new file mode 100644 index 0000000..97cfea4 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/TProfessionalStdRule.java @@ -0,0 +1,131 @@ +package cn.wepact.dfm.training.dto.entity; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * t_professional_std_rule + * @author + */ +@Data +@Builder +@AllArgsConstructor +public class TProfessionalStdRule { + /** + * 回馈记录唯一标识符 + */ + private Long id; + + /** + * 单位code + */ + private String orgCode; + + /** + * 等级 + */ + private String qualificationLevel; + + /** + * 回馈类别 + */ + private String categoryCode; + + /** + * 定义 + */ + private String defineCode; + + /** + * 角色 + */ + private String roleCode; + + /** + * 层级 + */ + private String levelCode; + + /** + * 分值 + */ + private Float score; + + /** + * 必选的任职资格等级,以逗号间隔 + */ + private String requiredQlevel; + + + /** + * 上层id + */ + private Long parentId; + + /** + * 类型(1类别,2部门层级,3角色) + */ + private String type; + + /** + * 记录创建时间 + */ + private Date createdAt; + + /** + * 记录创建人姓名 + */ + private String createdBy; + + /** + * 记录最后更新时间 + */ + private Date updatedAt; + + /** + * 记录最后更新人姓名 + */ + private String updatedBy; + + /** + * 删除标识(0显示 1删除) + */ + private String delFlag; + + /** + * 回馈类别 + */ + private String categoryName; + + /** + * 定义 + */ + private String defineName; + + /** + * 角色 + */ + private String roleName; + + /** + * 层级 + */ + private String levelName; + + private List roleList; + private List levelList; + + public TProfessionalStdRule() { + this.roleList = new ArrayList<>(); + this.levelList = new ArrayList<>(); + } + +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/TQualificationReview.java b/src/main/java/cn/wepact/dfm/training/dto/entity/TQualificationReview.java new file mode 100644 index 0000000..96a59e6 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/TQualificationReview.java @@ -0,0 +1,112 @@ +package cn.wepact.dfm.training.dto.entity; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * t_qualification_review + * @author + */ +@Data +public class TQualificationReview{ + /** + * 记录唯一标识符 + */ + private Long id; + + /** + * 员工id + */ + private Long userId; + + /** + * 现部门 + */ + private String currentDepartment; + + /** + * 申请任职资格id + */ + private Long qualificationStandardsId; + + /** + * 状态(如待审核、审核通过、审核不通过) + */ + private String status; + + /** + * 审核时间 + */ + private Date reviewTime; + + /** + * 专业回馈得分 + */ + private BigDecimal professionalScore; + + /** + * 专业回馈提示(必选项的控制) + */ + private String professionalTip; + + /** + * 选修课得分 + */ + private BigDecimal electiveCourseScore; + + /** + * 必修课得分 + */ + private BigDecimal compulsoryCourseScore; + + /** + * 线下评审分数 + */ + private BigDecimal offlineScore; + + /** + * 单位id + */ + private String orgCode; + + /** + * 记录创建时间 + */ + private Date createdAt; + + /** + * 记录创建人姓名 + */ + private String createdBy; + + /** + * 记录最后更新时间 + */ + private Date updatedAt; + + /** + * 记录最后更新人姓名 + */ + private String updatedBy; + + /** + * 删除标识(0显示 1删除) + */ + private String delFlag; + // 新添加的字段 + private Long projectId; // 项目ID + private String positionName; + + private String qualificationLevel; + + private String username; + private String userNo; + + /** + * 审核结束时间 + */ + private Date reviewEndTime; + private Float validTime; +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/TQualificationStandards.java b/src/main/java/cn/wepact/dfm/training/dto/entity/TQualificationStandards.java new file mode 100644 index 0000000..7ca3c6b --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/TQualificationStandards.java @@ -0,0 +1,62 @@ +package cn.wepact.dfm.training.dto.entity; + +import lombok.Data; + +import java.util.Date; + +/** + * t_qualification_standards + * @author + */ +@Data +public class TQualificationStandards{ + /** + * 记录唯一标识符 + */ + private Long id; + + /** + * 职位的名称 + */ + private String positionName; + + /** + * 资格等级(如1, 2, 3等) + */ + private String qualificationLevel; + + /** + * 单位id + */ + private String orgCode; + + /** + * 记录创建时间 + */ + private Date createdAt; + + /** + * 记录创建人姓名 + */ + private String createdBy; + + /** + * 记录最后更新时间 + */ + private Date updatedAt; + + /** + * 记录最后更新人姓名 + */ + private String updatedBy; + + /** + * 删除标识(0显示 1删除) + */ + private String delFlag; + + /** + * 对应资格的标准描述 + */ + private String qualificationCriteria; +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/TUser.java b/src/main/java/cn/wepact/dfm/training/dto/entity/TUser.java new file mode 100644 index 0000000..584155c --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/TUser.java @@ -0,0 +1,60 @@ +package cn.wepact.dfm.training.dto.entity; + +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * t_user + * @author + */ +@Data +public class TUser { + private Long id; + + private String username; + + private String password; + + private String userAvatar; + + private String userNo; + + private String showTip; + + private Date updatedAt; + + private String updatedBy; + + private Date createdAt; + + private String createdBy; + + private String delFlag; + + private String departmentName; + + private String orgCode; + private List roles; + + private String token; + + /** + * 用户类型(1普通用户,2专业回馈管理员,3归口管理员) + */ + private String userType; + + + /** + * 专业回馈类别,当user_type为2时生效 + */ + private String preType; + + private String email; + + private String randomCode; + + private String newPwd; + private String confirmPwd; +} diff --git a/src/main/java/cn/wepact/dfm/training/dto/entity/TUserPermission.java b/src/main/java/cn/wepact/dfm/training/dto/entity/TUserPermission.java new file mode 100644 index 0000000..699daa8 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/dto/entity/TUserPermission.java @@ -0,0 +1,64 @@ +package cn.wepact.dfm.training.dto.entity; + +import lombok.Data; + +import java.util.Date; + +/** + * t_user_permission + * @author + */ + +@Data +public class TUserPermission { + /** + * 主键 + */ + private Long id; + + /** + * 用户名 + */ + private Long userId; + + /** + * 用户类型(1普通用户,2专业回馈管理员,3归口管理员) + */ + private String userType; + + /** + * 部门code + */ + private String orgCode; + + /** + * 专业回馈类别,当user_type为2时生效 + */ + private String preType; + + /** + * 更新时间 + */ + private Date updatedAt; + + /** + * 更新者 + */ + private String updatedBy; + + /** + * 创建时间 + */ + private Date createdAt; + + /** + * 创建者 + */ + private String createdBy; + + /** + * 删除标识(0显示 1删除) + */ + private String delFlag; + +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/LevelScoresMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/LevelScoresMapper.java new file mode 100644 index 0000000..cc2314e --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/LevelScoresMapper.java @@ -0,0 +1,16 @@ +package cn.wepact.dfm.training.mapper; + + +import cn.wepact.dfm.training.dto.entity.LevelScores; +import org.apache.ibatis.annotations.Select; + +public interface LevelScoresMapper { + /** + * 根据层级查找对应的记录 + * + * @param level 层级 + * @return LevelScores 对象 + */ + + LevelScores findByLevel(String level); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/LevelScoresMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/LevelScoresMapper.xml new file mode 100644 index 0000000..19e0fd9 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/LevelScoresMapper.xml @@ -0,0 +1,28 @@ + + + + + + + id, level, required_score, elective_score, org_code + + + + + + + + + + + + + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/MyBatisBaseDao.java b/src/main/java/cn/wepact/dfm/training/mapper/MyBatisBaseDao.java new file mode 100644 index 0000000..a52c16c --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/MyBatisBaseDao.java @@ -0,0 +1,24 @@ +package cn.wepact.dfm.training.mapper; + +import java.io.Serializable; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + * DAO公共基类,由MybatisGenerator自动生成请勿修改 + * @param The Model Class 这里是泛型不是Model类 + * @param The Primary Key Class 如果是无主键,则可以用Model来跳过,如果是多主键则是Key类 + */ +public interface MyBatisBaseDao { + int deleteByPrimaryKey(PK id); + + int insert(Model record); + + int insertSelective(Model record); + + Model selectByPrimaryKey(PK id); + + int updateByPrimaryKeySelective(Model record); + + int updateByPrimaryKey(Model record); +} \ No newline at end of file diff --git a/src/main/java/cn/wepact/dfm/training/mapper/MyBatisBaseMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/MyBatisBaseMapper.java new file mode 100644 index 0000000..753770b --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/MyBatisBaseMapper.java @@ -0,0 +1,22 @@ +package cn.wepact.dfm.training.mapper; + +import java.io.Serializable; + +/** + * DAO公共基类,由MybatisGenerator自动生成请勿修改 + * @param The Model Class 这里是泛型不是Model类 + * @param The Primary Key Class 如果是无主键,则可以用Model来跳过,如果是多主键则是Key类 + */ +public interface MyBatisBaseMapper { + int deleteByPrimaryKey(PK id); + + int insert(Model record); + + int insertSelective(Model record); + + Model selectByPrimaryKey(PK id); + + int updateByPrimaryKeySelective(Model record); + + int updateByPrimaryKey(Model record); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/SyncTaskLogMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/SyncTaskLogMapper.java new file mode 100644 index 0000000..02cdedd --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/SyncTaskLogMapper.java @@ -0,0 +1,26 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.TaskScoreSummary; +import cn.wepact.dfm.training.dto.entity.SyncTaskLog; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Date; +import java.util.List; + +/** + * TProfessionalFeedbackMapper继承基类 + */ +@Mapper +public interface SyncTaskLogMapper extends MyBatisBaseMapper { + int insert(SyncTaskLog log); + + SyncTaskLog findByTaskId(Long taskId); + + Date getLastSyncTime(); + + void updateLastSyncTime(Date lastSyncTime); + + void update(SyncTaskLog existingLog); + + List getTaskScoreSummary(); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/SyncTaskLogMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/SyncTaskLogMapper.xml new file mode 100644 index 0000000..090fa27 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/SyncTaskLogMapper.xml @@ -0,0 +1,382 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, sync_time, offset, sync_limit, search_start_time, search_end_time, status, task_id, + org_id, project_id, main_project_id, stu_user_id, third_user_id, formal, period_id, result_repeat_flag, + sub_result_id, sub_task_id, repeat_count, sub_task_result_id, order_index, task_status, task_required, + task_schedule, task_manual_completed, task_start_time, task_completed_time, task_duration, is_rated, + task_target_scores, task_passed, task_is_excellent, task_delay, task_sign_status, task_signout_status, + task_sign_time, task_signout_time, task_sign_address, task_signout_address, task_answer, task_get_scores, + task_get_points, task_get_study_hours, stu_deleted, task_result_deleted, task_has_tutor, ojt_teacher_id, + ojt_teacher_fullname, ojt_study_status, ojt_out_time, ojt_in_time, created_at, updated_at, + tr_create_user_id, tr_update_user_id, tr_update_time, task_type, tr_create_time, update_time, db_create_time, db_update_time + + + + + INSERT INTO sync_task_log ( + sync_time, + offset, + sync_limit, + search_start_time, + search_end_time, + status, + task_id, + org_id, + project_id, + main_project_id, + stu_user_id, + third_user_id, + formal, + period_id, + result_repeat_flag, + sub_result_id, + sub_task_id, + repeat_count, + sub_task_result_id, + order_index, + task_status, + task_required, + task_schedule, + task_manual_completed, + task_start_time, + task_completed_time, + task_duration, + is_rated, + task_target_scores, + task_passed, + task_is_excellent, + task_delay, + task_sign_status, + task_signout_status, + task_sign_time, + task_signout_time, + task_sign_address, + task_signout_address, + task_answer, + task_get_scores, + task_get_points, + task_get_study_hours, + stu_deleted, + task_result_deleted, + task_has_tutor, + ojt_teacher_id, + ojt_teacher_fullname, + ojt_study_status, + ojt_out_time, + ojt_in_time, + created_at, + updated_at, + tr_create_user_id, + tr_update_user_id, + tr_update_time, + task_type, + tr_create_time, + update_time, + db_create_time, + db_update_time + ) + VALUES ( + #{syncTime}, + #{offset}, + #{limit}, + #{searchStartTime}, + #{searchEndTime}, + #{status}, + #{taskId}, + #{orgId}, + #{projectId}, + #{mainProjectId}, + #{stuUserId}, + #{thirdUserId}, + #{formal}, + #{periodId}, + #{resultRepeatFlag}, + #{subResultId}, + #{subTaskId}, + #{repeatCount}, + #{subTaskResultId}, + #{orderIndex}, + #{taskStatus}, + #{taskRequired}, + #{taskSchedule}, + #{taskManualCompleted}, + #{taskStartTime}, + #{taskCompletedTime}, + #{taskDuration}, + #{isRated}, + #{taskTargetScores}, + #{taskPassed}, + #{taskIsExcellent}, + #{taskDelay}, + #{taskSignStatus}, + #{taskSignoutStatus}, + #{taskSignTime}, + #{taskSignoutTime}, + #{taskSignAddress}, + #{taskSignoutAddress}, + #{taskAnswer}, + #{taskGetScores}, + #{taskGetPoints}, + #{taskGetStudyHours}, + #{stuDeleted}, + #{taskResultDeleted}, + #{taskHasTutor}, + #{ojtTeacherId}, + #{ojtTeacherFullname}, + #{ojtStudyStatus}, + #{ojtOutTime}, + #{ojtInTime}, + #{createdAt}, + #{updatedAt}, + #{trCreateUserId}, + #{trUpdateUserId}, + #{trUpdateTime}, + #{taskType}, + #{trCreateTime}, + #{updateTime}, + #{dbCreateTime}, + #{dbUpdateTime} + ) + + + + + + + + + + + + UPDATE sync_task_log + SET sync_time = #{syncTime} + + + + UPDATE sync_task_log + SET + sync_time = #{syncTime}, + offset = #{offset}, + sync_limit = #{limit}, + search_start_time = #{searchStartTime}, + search_end_time = #{searchEndTime}, + status = #{status}, + task_id = #{taskId}, + org_id = #{orgId}, + project_id = #{projectId}, + main_project_id = #{mainProjectId}, + stu_user_id = #{stuUserId}, + third_user_id = #{thirdUserId}, + formal = #{formal}, + period_id = #{periodId}, + result_repeat_flag = #{resultRepeatFlag}, + sub_result_id = #{subResultId}, + sub_task_id = #{subTaskId}, + repeat_count = #{repeatCount}, + sub_task_result_id = #{subTaskResultId}, + order_index = #{orderIndex}, + task_status = #{taskStatus}, + task_required = #{taskRequired}, + task_manual_completed = #{taskManualCompleted}, + task_start_time = #{taskStartTime}, + task_completed_time = #{taskCompletedTime}, + task_duration = #{taskDuration}, + is_rated = #{isRated}, + task_target_scores = #{taskTargetScores}, + task_passed = #{taskPassed}, + task_is_excellent = #{taskIsExcellent}, + task_delay = #{taskDelay}, + task_sign_status = #{taskSignStatus}, + task_signout_status = #{taskSignoutStatus}, + task_sign_time = #{taskSignTime}, + task_signout_time = #{taskSignoutTime}, + task_sign_address = #{taskSignAddress}, + task_signout_address = #{taskSignoutAddress}, + task_answer = #{taskAnswer}, + task_get_scores = #{taskGetScores}, + task_get_points = #{taskGetPoints}, + task_get_study_hours = #{taskGetStudyHours}, + stu_deleted = #{stuDeleted}, + task_result_deleted = #{taskResultDeleted}, + task_has_tutor = #{taskHasTutor}, + ojt_teacher_id = #{ojtTeacherId}, + ojt_teacher_fullname = #{ojtTeacherFullname}, + ojt_study_status = #{ojtStudyStatus}, + ojt_out_time = #{ojtOutTime}, + ojt_in_time = #{ojtInTime}, + created_at = #{createdAt}, + updated_at = #{updatedAt}, + tr_create_user_id = #{trCreateUserId}, + tr_update_user_id = #{trUpdateUserId}, + tr_update_time = #{trUpdateTime}, + task_type = #{taskType}, + tr_create_time = #{trCreateTime}, + update_time = #{updateTime}, + db_create_time = #{dbCreateTime}, + db_update_time = #{dbUpdateTime} + WHERE task_id = #{taskId} + + + + + + + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/SyncUserInfoLogMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/SyncUserInfoLogMapper.java new file mode 100644 index 0000000..d6332f0 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/SyncUserInfoLogMapper.java @@ -0,0 +1,25 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.entity.SyncTaskLog; +import cn.wepact.dfm.training.dto.entity.SyncUserInfoLog; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +@Mapper +public interface SyncUserInfoLogMapper extends MyBatisBaseMapper { + + + SyncUserInfoLog getUserInfoByUserId(@Param("userId") String userId); + + + void insertUserInfo(SyncUserInfoLog userInfo); + + + void updateUserInfo(SyncUserInfoLog userInfo); + + Date getLastSyncTime(); + + void updateLastSyncTime(Date date); + SyncUserInfoLog findUserInfoByStuUserId(@Param("stuUserId") String stuUserId); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/SyncUserInfoLogMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/SyncUserInfoLogMapper.xml new file mode 100644 index 0000000..d86ce09 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/SyncUserInfoLogMapper.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + user_id, + username, + fullname, + gender, + id_no, + birthday, + dept_id, + dept_name, + position_id, + position_name, + grade_id, + grade_name, + manager_id, + manager_fullname, + dept_manager_id, + dept_manager_fullname, + mobile, + email, + user_no, + hire_date, + expired_time, + area_code, + user_status, + avatar_url, + admin, + deleted, + third_user_id, + create_time, + update_time, + user_type, + sync_time, + offset, + sync_limit, + search_start_time, + search_end_time, + status + + + INSERT INTO sync_user_info_log () + VALUES (#{id}, #{userId}, #{username}, #{fullname}, #{gender}, #{idNo}, #{birthday}, #{deptId}, #{deptName}, + #{positionId}, #{positionName}, #{gradeId}, #{gradeName}, #{managerId}, #{managerFullname}, #{deptManagerId}, #{deptManagerFullname}, + #{mobile}, #{email}, #{userNo}, #{hireDate}, #{expiredTime}, #{areaCode}, #{userStatus}, #{avatarUrl}, #{admin}, #{deleted}, #{thirdUserId}, + #{createTime}, #{updateTime}, #{userType}, #{syncTime}, #{offset}, #{syncLimit}, #{searchStartTime}, #{searchEndTime}, #{status}) + + + + UPDATE sync_user_info_log + SET + id = #{id}, + user_id = #{userId}, + username = #{username}, + fullname = #{fullname}, + gender = #{gender}, + id_no = #{idNo}, + birthday = #{birthday}, + dept_id = #{deptId}, + dept_name = #{deptName}, + position_id = #{positionId}, + position_name = #{positionName}, + grade_id = #{gradeId}, + grade_name = #{gradeName}, + manager_id = #{managerId}, + manager_fullname = #{managerFullname}, + dept_manager_id = #{deptManagerId}, + dept_manager_fullname = #{deptManagerFullname}, + mobile = #{mobile}, + email = #{email}, + user_no = #{userNo}, + hire_date = #{hireDate}, + expired_time = #{expiredTime}, + area_code = #{areaCode}, + user_status = #{userStatus}, + avatar_url = #{avatarUrl}, + admin = #{admin}, + deleted = #{deleted}, + third_user_id = #{thirdUserId}, + create_time = #{createTime}, + update_time = #{updateTime}, + user_type = #{userType}, + sync_time = #{syncTime}, + offset = #{offset}, + sync_limit = #{syncLimit}, + search_start_time = #{searchStartTime}, + search_end_time = #{searchEndTime}, + status = #{status} + WHERE user_id = #{userId} + + + + + + + + + UPDATE sync_user_info_log + SET sync_time = #{syncTime} + + + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TAppCheckMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/TAppCheckMapper.java new file mode 100644 index 0000000..adf3c89 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TAppCheckMapper.java @@ -0,0 +1,15 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.entity.TAppCheck; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * TAppCheckMapper继承基类 + */ +@Repository +public interface TAppCheckMapper extends MyBatisBaseDao { + List selectByConditions(@Param("param") TAppCheck param); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TAppCheckMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/TAppCheckMapper.xml new file mode 100644 index 0000000..9f04364 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TAppCheckMapper.xml @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + id, org_code, `degree`, `level`, s_year, p_year, jx, updated_at, updated_by, created_at, + created_by, del_flag + + + + + delete from t_app_check + where id = #{id,jdbcType=BIGINT} + + + insert into t_app_check (org_code, `degree`, `level`, + s_year, p_year, jx, updated_at, + updated_by, created_at, created_by, + del_flag) + values (#{orgCode,jdbcType=VARCHAR}, #{degree,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, + #{sYear,jdbcType=INTEGER}, #{pYear,jdbcType=INTEGER}, #{jx,jdbcType=INTEGER}, #{updatedAt,jdbcType=TIMESTAMP}, + #{updatedBy,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, + #{delFlag,jdbcType=VARCHAR}) + + + insert into t_app_check + + + org_code, + + + `degree`, + + + `level`, + + + s_year, + + + p_year, + + + jx, + + + updated_at, + + + updated_by, + + + created_at, + + + created_by, + + + del_flag, + + + + + #{orgCode,jdbcType=VARCHAR}, + + + #{degree,jdbcType=VARCHAR}, + + + #{level,jdbcType=VARCHAR}, + + + #{sYear,jdbcType=INTEGER}, + + + #{pYear,jdbcType=INTEGER}, + + + #{jx,jdbcType=INTEGER}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{updatedBy,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{createdBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=VARCHAR}, + + + + + update t_app_check + + + org_code = #{orgCode,jdbcType=VARCHAR}, + + + `degree` = #{degree,jdbcType=VARCHAR}, + + + `level` = #{level,jdbcType=VARCHAR}, + + + s_year = #{sYear,jdbcType=INTEGER}, + + + p_year = #{pYear,jdbcType=INTEGER}, + + + jx = #{jx,jdbcType=INTEGER}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + updated_by = #{updatedBy,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + created_by = #{createdBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_app_check + set org_code = #{orgCode,jdbcType=VARCHAR}, + `degree` = #{degree,jdbcType=VARCHAR}, + `level` = #{level,jdbcType=VARCHAR}, + s_year = #{sYear,jdbcType=INTEGER}, + p_year = #{pYear,jdbcType=INTEGER}, + jx = #{jx,jdbcType=INTEGER}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + updated_by = #{updatedBy,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + created_by = #{createdBy,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TDictionaryMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/TDictionaryMapper.java new file mode 100644 index 0000000..ea07119 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TDictionaryMapper.java @@ -0,0 +1,15 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.entity.TDictionary; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * TDictionaryMapper继承基类 + */ +@Mapper +public interface TDictionaryMapper extends MyBatisBaseMapper { + List selectByCondition(TDictionary tDictionary); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TDictionaryMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/TDictionaryMapper.xml new file mode 100644 index 0000000..b1fe235 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TDictionaryMapper.xml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + id, org_code, `type`, code, `value`, version, updated_at, updated_by, created_at, + created_by, del_flag + + + + + delete from t_dictionary + where id = #{id,jdbcType=BIGINT} + + + insert into t_dictionary (org_code, `type`, code, + `value`, version, updated_at, + updated_by, created_at, created_by, + del_flag) + values (#{orgCode,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, + #{value,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{updatedAt,jdbcType=TIMESTAMP}, + #{updatedBy,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, + #{delFlag,jdbcType=VARCHAR}) + + + insert into t_dictionary + + + org_code, + + + `type`, + + + code, + + + `value`, + + + version, + + + updated_at, + + + updated_by, + + + created_at, + + + created_by, + + + del_flag, + + + + + #{orgCode,jdbcType=VARCHAR}, + + + #{type,jdbcType=VARCHAR}, + + + #{code,jdbcType=VARCHAR}, + + + #{value,jdbcType=VARCHAR}, + + + #{version,jdbcType=INTEGER}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{updatedBy,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{createdBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=VARCHAR}, + + + + + update t_dictionary + + + org_code = #{orgCode,jdbcType=VARCHAR}, + + + `type` = #{type,jdbcType=VARCHAR}, + + + code = #{code,jdbcType=VARCHAR}, + + + `value` = #{value,jdbcType=VARCHAR}, + + + version = #{version,jdbcType=INTEGER}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + updated_by = #{updatedBy,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + created_by = #{createdBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_dictionary + set org_code = #{orgCode,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + code = #{code,jdbcType=VARCHAR}, + `value` = #{value,jdbcType=VARCHAR}, + version = #{version,jdbcType=INTEGER}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + updated_by = #{updatedBy,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + created_by = #{createdBy,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TEvidenceSubmissionMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/TEvidenceSubmissionMapper.java new file mode 100644 index 0000000..91227a5 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TEvidenceSubmissionMapper.java @@ -0,0 +1,17 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.entity.TEvidenceSubmission; +import cn.wepact.dfm.training.dto.entity.TProfessionalFeedback; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * TEvidenceSubmissionMapper继承基类 + */ +@Mapper +public interface TEvidenceSubmissionMapper extends MyBatisBaseMapper { + + List selectByCondition(TEvidenceSubmission condition); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TEvidenceSubmissionMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/TEvidenceSubmissionMapper.xml new file mode 100644 index 0000000..2891752 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TEvidenceSubmissionMapper.xml @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + id, user_id, org_code, evidence_no, evidence_name, evidence_witness, evidence_attachment, + upload_date, created_at, created_by, updated_at, updated_by, del_flag, evidence_description, remarks + + + + delete from t_evidence_submission + where id = #{id,jdbcType=BIGINT} + + + insert into t_evidence_submission (user_id, org_code, evidence_no, + evidence_name, evidence_witness, evidence_attachment, + upload_date, created_at, created_by, + updated_at, updated_by, del_flag, + evidence_description, remarks) + values (#{userId,jdbcType=BIGINT}, #{orgCode,jdbcType=VARCHAR}, #{evidenceNo,jdbcType=VARCHAR}, + #{evidenceName,jdbcType=VARCHAR}, #{evidenceWitness,jdbcType=VARCHAR}, #{evidenceAttachment,jdbcType=VARCHAR}, + #{uploadDate,jdbcType=TIMESTAMP}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, + #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=VARCHAR}, + #{evidenceDescription,jdbcType=LONGVARCHAR}, #{remarks,jdbcType=LONGVARCHAR}) + + + insert into t_evidence_submission + + + user_id, + + + org_code, + + + evidence_no, + + + evidence_name, + + + evidence_witness, + + + evidence_attachment, + + + upload_date, + + + created_at, + + + created_by, + + + updated_at, + + + updated_by, + + + del_flag, + + + evidence_description, + + + remarks, + + + + + #{userId,jdbcType=BIGINT}, + + + #{orgCode,jdbcType=VARCHAR}, + + + #{evidenceNo,jdbcType=VARCHAR}, + + + #{evidenceName,jdbcType=VARCHAR}, + + + #{evidenceWitness,jdbcType=VARCHAR}, + + + #{evidenceAttachment,jdbcType=VARCHAR}, + + + #{uploadDate,jdbcType=TIMESTAMP}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{createdBy,jdbcType=VARCHAR}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{updatedBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=VARCHAR}, + + + #{evidenceDescription,jdbcType=LONGVARCHAR}, + + + #{remarks,jdbcType=LONGVARCHAR}, + + + + + update t_evidence_submission + + + user_id = #{userId,jdbcType=BIGINT}, + + + org_code = #{orgCode,jdbcType=VARCHAR}, + + + evidence_no = #{evidenceNo,jdbcType=VARCHAR}, + + + evidence_name = #{evidenceName,jdbcType=VARCHAR}, + + + evidence_witness = #{evidenceWitness,jdbcType=VARCHAR}, + + + evidence_attachment = #{evidenceAttachment,jdbcType=VARCHAR}, + + + upload_date = #{uploadDate,jdbcType=TIMESTAMP}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + created_by = #{createdBy,jdbcType=VARCHAR}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + updated_by = #{updatedBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=VARCHAR}, + + + evidence_description = #{evidenceDescription,jdbcType=LONGVARCHAR}, + + + remarks = #{remarks,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + + + + + + + + + + + + + + + + + + + update t_evidence_submission + set user_id = #{userId,jdbcType=BIGINT}, + org_code = #{orgCode,jdbcType=VARCHAR}, + evidence_no = #{evidenceNo,jdbcType=VARCHAR}, + evidence_name = #{evidenceName,jdbcType=VARCHAR}, + evidence_witness = #{evidenceWitness,jdbcType=VARCHAR}, + evidence_attachment = #{evidenceAttachment,jdbcType=VARCHAR}, + upload_date = #{uploadDate,jdbcType=TIMESTAMP}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + created_by = #{createdBy,jdbcType=VARCHAR}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + updated_by = #{updatedBy,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TOrgMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/TOrgMapper.java new file mode 100644 index 0000000..d256300 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TOrgMapper.java @@ -0,0 +1,17 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.entity.TOrg; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * TOrgMapper继承基类 + */ +@Mapper +public interface TOrgMapper extends MyBatisBaseMapper { + TOrg selectByCode(@Param("code") String code); + + List selectAll(); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TOrgMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/TOrgMapper.xml new file mode 100644 index 0000000..4fd5703 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TOrgMapper.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + id, `name`, code, short_name, updated_at, updated_by, created_at, created_by, del_flag + + + + + + delete from t_org + where id = #{id,jdbcType=BIGINT} + + + insert into t_org (`name`, code, short_name, updated_at, + updated_by, created_at, created_by, del_flag) + values (#{name,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{shortName,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, + #{updatedBy,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=VARCHAR}) + + + insert into t_org + + + `name`, + + + code, + + + short_name, + + + updated_at, + + + updated_by, + + + created_at, + + + created_by, + + + del_flag, + + + + + #{name,jdbcType=VARCHAR}, + + + #{code,jdbcType=VARCHAR}, + + + #{shortName,jdbcType=VARCHAR}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{updatedBy,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{createdBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=VARCHAR}, + + + + + update t_org + + + `name` = #{name,jdbcType=VARCHAR}, + + + code = #{code,jdbcType=VARCHAR}, + + + short_name = #{shortName,jdbcType=VARCHAR}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + updated_by = #{updatedBy,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + created_by = #{createdBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_org + set `name` = #{name,jdbcType=VARCHAR}, + code = #{code,jdbcType=VARCHAR}, + short_name = #{shortName,jdbcType=VARCHAR}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + updated_by = #{updatedBy,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + created_by = #{createdBy,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TPerformanceRuleMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/TPerformanceRuleMapper.java new file mode 100644 index 0000000..f85b8c4 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TPerformanceRuleMapper.java @@ -0,0 +1,15 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.entity.TPerformanceRule; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * TPerformanceRuleMapper继承基类 + */ +@Repository +public interface TPerformanceRuleMapper extends MyBatisBaseDao { + List selectByConditions(@Param("param") TPerformanceRule param); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TPerformanceRuleMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/TPerformanceRuleMapper.xml new file mode 100644 index 0000000..5717225 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TPerformanceRuleMapper.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + id, org_code, jx_name, score, updated_at, updated_by, created_at, created_by, del_flag + + + + + delete from t_performance_rule + where id = #{id,jdbcType=BIGINT} + + + insert into t_performance_rule (org_code, jx_name, score, + updated_at, updated_by, created_at, + created_by, del_flag) + values (#{orgCode,jdbcType=VARCHAR}, #{jxName,jdbcType=VARCHAR}, #{score,jdbcType=INTEGER}, + #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, + #{createdBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=VARCHAR}) + + + insert into t_performance_rule + + + org_code, + + + jx_name, + + + score, + + + updated_at, + + + updated_by, + + + created_at, + + + created_by, + + + del_flag, + + + + + #{orgCode,jdbcType=VARCHAR}, + + + #{jxName,jdbcType=VARCHAR}, + + + #{score,jdbcType=INTEGER}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{updatedBy,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{createdBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=VARCHAR}, + + + + + update t_performance_rule + + + org_code = #{orgCode,jdbcType=VARCHAR}, + + + jx_name = #{jxName,jdbcType=VARCHAR}, + + + score = #{score,jdbcType=INTEGER}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + updated_by = #{updatedBy,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + created_by = #{createdBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_performance_rule + set org_code = #{orgCode,jdbcType=VARCHAR}, + jx_name = #{jxName,jdbcType=VARCHAR}, + score = #{score,jdbcType=INTEGER}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + updated_by = #{updatedBy,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + created_by = #{createdBy,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalFeedbackMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalFeedbackMapper.java new file mode 100644 index 0000000..34484a7 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalFeedbackMapper.java @@ -0,0 +1,16 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.entity.TProfessionalFeedback; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * TProfessionalFeedbackMapper继承基类 + */ +@Mapper +public interface TProfessionalFeedbackMapper extends MyBatisBaseMapper { + List selectByCondition(TProfessionalFeedback tProfessionalFeedback); + + List selectWithUserInfoByCondition(TProfessionalFeedback condition); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalFeedbackMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalFeedbackMapper.xml new file mode 100644 index 0000000..5f7597f --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalFeedbackMapper.xml @@ -0,0 +1,457 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, user_id, org_code, category_code, define_code, specific_task, start_time, end_time, `number`, + unit_code, initiating_department, role_code, level_code, proof_material, audit_status, + auditor, audit_date, created_at, created_by, updated_at, updated_by, del_flag,remarks,score + + + + + + delete from t_professional_feedback + where id = #{id,jdbcType=BIGINT} + + + insert into t_professional_feedback (user_id, org_code, category_code, define_code, + specific_task, start_time, end_time, + `number`, unit_code, initiating_department, + role_code, level_code, proof_material, + audit_status, auditor, audit_date, + created_at, created_by, updated_at, + updated_by, del_flag, remarks,score + ) + values (#{userId,jdbcType=BIGINT}, #{orgCode,jdbcType=VARCHAR}, #{categoryCode,jdbcType=VARCHAR}, #{defineCode, jdbcType=VARCHAR}, + #{specificTask,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, + #{number,jdbcType=INTEGER}, #{unitCode,jdbcType=VARCHAR}, #{initiatingDepartment,jdbcType=VARCHAR}, + #{roleCode,jdbcType=VARCHAR}, #{levelCode,jdbcType=VARCHAR}, #{proofMaterial,jdbcType=VARCHAR}, + #{auditStatus,jdbcType=VARCHAR}, #{auditor,jdbcType=VARCHAR}, #{auditDate,jdbcType=TIMESTAMP}, + #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, + #{updatedBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=VARCHAR}, #{remarks,jdbcType=LONGVARCHAR},#{score, jdbcType=REAL} + ) + + + insert into t_professional_feedback + + + user_id, + + + org_code, + + + category_code, + + + define_code, + + + score, + + + specific_task, + + + start_time, + + + end_time, + + + `number`, + + + unit_code, + + + initiating_department, + + + role_code, + + + level_code, + + + proof_material, + + + audit_status, + + + auditor, + + + audit_date, + + + created_at, + + + created_by, + + + updated_at, + + + updated_by, + + + del_flag, + + + remarks, + + + + + #{userId,jdbcType=BIGINT}, + + + #{orgCode,jdbcType=VARCHAR}, + + + #{categoryCode,jdbcType=VARCHAR}, + + + #{defineCode,jdbcType=VARCHAR}, + + + #{score,jdbcType=REAL}, + + + #{specificTask,jdbcType=VARCHAR}, + + + #{startTime,jdbcType=TIMESTAMP}, + + + #{endTime,jdbcType=TIMESTAMP}, + + + #{number,jdbcType=INTEGER}, + + + #{unitCode,jdbcType=VARCHAR}, + + + #{initiatingDepartment,jdbcType=VARCHAR}, + + + #{roleCode,jdbcType=VARCHAR}, + + + #{levelCode,jdbcType=VARCHAR}, + + + #{proofMaterial,jdbcType=VARCHAR}, + + + #{auditStatus,jdbcType=VARCHAR}, + + + #{auditor,jdbcType=VARCHAR}, + + + #{auditDate,jdbcType=TIMESTAMP}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{createdBy,jdbcType=VARCHAR}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{updatedBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=VARCHAR}, + + + #{remarks,jdbcType=LONGVARCHAR}, + + + + + update t_professional_feedback + + + user_id = #{userId,jdbcType=BIGINT}, + + + org_code = #{orgCode,jdbcType=VARCHAR}, + + + category_code = #{categoryCode,jdbcType=VARCHAR}, + + + define_code = #{defineCode,jdbcType=VARCHAR}, + + + score = #{score,jdbcType=REAL}, + + + specific_task = #{specificTask,jdbcType=VARCHAR}, + + + start_time = #{startTime,jdbcType=TIMESTAMP}, + + + end_time = #{endTime,jdbcType=TIMESTAMP}, + + + `number` = #{number,jdbcType=INTEGER}, + + + unit_code = #{unitCode,jdbcType=VARCHAR}, + + + initiating_department = #{initiatingDepartment,jdbcType=VARCHAR}, + + + role_code = #{roleCode,jdbcType=VARCHAR}, + + + level_code = #{levelCode,jdbcType=VARCHAR}, + + + proof_material = #{proofMaterial,jdbcType=VARCHAR}, + + + audit_status = #{auditStatus,jdbcType=VARCHAR}, + + + auditor = #{auditor,jdbcType=VARCHAR}, + + + audit_date = #{auditDate,jdbcType=TIMESTAMP}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + created_by = #{createdBy,jdbcType=VARCHAR}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + updated_by = #{updatedBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=VARCHAR}, + + + remarks = #{remarks,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + + + + + + + + + + + + + + + + + + + + + + + + + + update t_professional_feedback + set user_id = #{userId,jdbcType=BIGINT}, + org_code = #{orgCode,jdbcType=VARCHAR}, + category_code = #{categoryCode,jdbcType=VARCHAR}, + define_code = #{defineCode,jdbcType=VARCHAR}, + score = #{score,jdbcType=REAL}, + specific_task = #{specificTask,jdbcType=VARCHAR}, + start_time = #{startTime,jdbcType=TIMESTAMP}, + end_time = #{endTime,jdbcType=TIMESTAMP}, + `number` = #{number,jdbcType=INTEGER}, + unit_code = #{unitCode,jdbcType=VARCHAR}, + initiating_department = #{initiatingDepartment,jdbcType=VARCHAR}, + role_code = #{roleCode,jdbcType=VARCHAR}, + level_code = #{levelCode,jdbcType=VARCHAR}, + proof_material = #{proofMaterial,jdbcType=VARCHAR}, + audit_status = #{auditStatus,jdbcType=VARCHAR}, + auditor = #{auditor,jdbcType=VARCHAR}, + audit_date = #{auditDate,jdbcType=TIMESTAMP}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + created_by = #{createdBy,jdbcType=VARCHAR}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + updated_by = #{updatedBy,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalStdRuleMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalStdRuleMapper.java new file mode 100644 index 0000000..0d242aa --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalStdRuleMapper.java @@ -0,0 +1,16 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.entity.TProfessionalStdRule; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * TProfessionalStdRuleMapper继承基类 + */ +@Repository +public interface TProfessionalStdRuleMapper extends MyBatisBaseDao { + + List selectByCondition(TProfessionalStdRule tProfessionalStdRule); + +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalStdRuleMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalStdRuleMapper.xml new file mode 100644 index 0000000..e8f902c --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TProfessionalStdRuleMapper.xml @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + + + + + + + + + + id, org_code, qualification_level, category_code, define_code, role_code, level_code, score, required_qlevel, + parent_id, `type`, created_at, created_by, updated_at, updated_by, del_flag + + + + + delete from t_professional_std_rule + where id = #{id,jdbcType=BIGINT} + + + insert into t_professional_std_rule (org_code,qualification_level, category_code, define_code, + role_code, level_code, score, + required_qlevel, parent_id, `type`, + created_at, created_by, updated_at, + updated_by, del_flag) + values (#{orgCode,jdbcType=VARCHAR},#{qualificationLevel, jdbcType=VARCHAR}, #{categoryCode,jdbcType=VARCHAR}, #{defineCode,jdbcType=VARCHAR}, + #{roleCode,jdbcType=VARCHAR}, #{levelCode,jdbcType=VARCHAR}, #{score,jdbcType=REAL}, + #{requiredQlevel,jdbcType=VARCHAR}, #{parentId,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, + #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, + #{updatedBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=VARCHAR}) + + + insert into t_professional_std_rule + + + org_code, + + + qualification_level, + + + category_code, + + + define_code, + + + role_code, + + + level_code, + + + score, + + + required_qlevel, + + + parent_id, + + + `type`, + + + created_at, + + + created_by, + + + updated_at, + + + updated_by, + + + del_flag, + + + + + #{orgCode,jdbcType=VARCHAR}, + + + #{qualificationLevel, jdbcType=VARCHAR}, + + + #{categoryCode,jdbcType=VARCHAR}, + + + #{defineCode,jdbcType=VARCHAR}, + + + #{roleCode,jdbcType=VARCHAR}, + + + #{levelCode,jdbcType=VARCHAR}, + + + #{score,jdbcType=REAL}, + + + #{requiredQlevel,jdbcType=VARCHAR}, + + + #{parentId,jdbcType=BIGINT}, + + + #{type,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{createdBy,jdbcType=VARCHAR}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{updatedBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=VARCHAR}, + + + + + update t_professional_std_rule + + + org_code = #{orgCode,jdbcType=VARCHAR}, + + + qualification_level = #{qualificationLevel, jdbcType=VARCHAR}, + + + category_code = #{categoryCode,jdbcType=VARCHAR}, + + + define_code = #{defineCode,jdbcType=VARCHAR}, + + + role_code = #{roleCode,jdbcType=VARCHAR}, + + + level_code = #{levelCode,jdbcType=VARCHAR}, + + + score = #{score,jdbcType=REAL}, + + + required_qlevel = #{requiredQlevel,jdbcType=VARCHAR}, + + + parent_id = #{parentId,jdbcType=BIGINT}, + + + `type` = #{type,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + created_by = #{createdBy,jdbcType=VARCHAR}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + updated_by = #{updatedBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_professional_std_rule + set org_code = #{orgCode,jdbcType=VARCHAR}, + qualification_level = #{qualificationLevel, jdbcType=VARCHAR}, + category_code = #{categoryCode,jdbcType=VARCHAR}, + define_code = #{defineCode,jdbcType=VARCHAR}, + role_code = #{roleCode,jdbcType=VARCHAR}, + level_code = #{levelCode,jdbcType=VARCHAR}, + score = #{score,jdbcType=REAL}, + required_qlevel = #{requiredQlevel,jdbcType=VARCHAR}, + parent_id = #{parentId,jdbcType=BIGINT}, + `type` = #{type,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + created_by = #{createdBy,jdbcType=VARCHAR}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + updated_by = #{updatedBy,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TQualificationReviewMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/TQualificationReviewMapper.java new file mode 100644 index 0000000..8f5d969 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TQualificationReviewMapper.java @@ -0,0 +1,34 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.AppliedParam; +import cn.wepact.dfm.training.dto.entity.TQualificationReview; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * TQualificationReviewMapper继承基类 + */ +@Mapper +public interface TQualificationReviewMapper extends MyBatisBaseMapper { + List selectByCondition(AppliedParam appliedParam); + + List selectWithUserInfoByCondition(AppliedParam condition); + /** + * 根据 user_id 和 project_id 查找唯一记录 + * @param userId 用户 ID + * @param projectId 项目 ID + * @return 任职资格审核记录 + */ + TQualificationReview findByUserIdAndProjectId(@Param("userId") Long userId, @Param("projectId") Long projectId); + + /** + * 插入新的资格审核记录 + * @param qualificationReview 资格审核记录 + * @return 插入结果 + */ + int insertQualificationReview(TQualificationReview qualificationReview); + + int updateQualificationReview(TQualificationReview existingReview); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TQualificationReviewMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/TQualificationReviewMapper.xml new file mode 100644 index 0000000..3dea1a9 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TQualificationReviewMapper.xml @@ -0,0 +1,414 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id, user_id, current_department, qualification_standards_id, `status`, review_time,professional_score,professional_tip, elective_course_score, + compulsory_course_score, offline_score, org_code, created_at, created_by, updated_at, updated_by, + del_flag,project_id + + + + + + delete from t_qualification_review + where id = #{id,jdbcType=BIGINT} + + + insert into t_qualification_review (user_id, current_department, qualification_standards_id, + `status`,review_time, professional_score,professional_tip, elective_course_score, compulsory_course_score, + offline_score, org_code, created_at, created_by, + updated_at, updated_by, del_flag,project_id + ) + values (#{userId,jdbcType=BIGINT}, #{currentDepartment,jdbcType=VARCHAR}, #{qualificationStandardsId,jdbcType=BIGINT}, + #{status,jdbcType=VARCHAR}, #{reviewTime,jdbcType=TIMESTAMP}, #{professionalScore, jdbcType=DECIMAL},#{professionalTip, jdbcType=VARCHAR}, #{electiveCourseScore,jdbcType=DECIMAL}, #{compulsoryCourseScore,jdbcType=DECIMAL}, + #{offlineScore,jdbcType=DECIMAL}, #{orgCode,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, + #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=VARCHAR}, #{projectId,jdbcType=BIGINT}) + ) + + + insert into t_qualification_review + + + user_id, + + + current_department, + + + qualification_standards_id, + + + `status`, + + + `review_time`, + + + professional_score, + + + professional_tip, + + + elective_course_score, + + + compulsory_course_score, + + + offline_score, + + + org_code, + + + created_at, + + + created_by, + + + updated_at, + + + updated_by, + + + del_flag, + + + project_id, + + + + + #{userId,jdbcType=BIGINT}, + + + #{currentDepartment,jdbcType=VARCHAR}, + + + #{qualificationStandardsId,jdbcType=BIGINT}, + + + #{status,jdbcType=VARCHAR}, + + + #{reviewTime,jdbcType=TIMESTAMP}, + + + #{professionalScore, jdbcType=DECIMAL}, + + + #{professionalTip, jdbcType=VARCHAR}, + + + #{electiveCourseScore,jdbcType=DECIMAL}, + + + #{compulsoryCourseScore,jdbcType=DECIMAL}, + + + #{offlineScore,jdbcType=DECIMAL}, + + + #{orgCode,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{createdBy,jdbcType=VARCHAR}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{updatedBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=VARCHAR}, + + + #{projectId,jdbcType=VARCHAR}, + + + + + update t_qualification_review + + + user_id = #{userId,jdbcType=BIGINT}, + + + current_department = #{currentDepartment,jdbcType=VARCHAR}, + + + qualification_standards_id = #{qualificationStandardsId,jdbcType=BIGINT}, + + + `status` = #{status,jdbcType=VARCHAR}, + + + review_time = #{reviewTime,jdbcType=TIMESTAMP}, + + + professional_score = #{professionalScore, jdbcType=DECIMAL}, + + + professional_tip = #{professionalTip, jdbcType=VARCHAR}, + + + professional_score = #{professionalScore, jdbcType=DECIMAL}, + + + professional_tip = #{professionalTip, jdbcType=VARCHAR}, + + + elective_course_score = #{electiveCourseScore,jdbcType=DECIMAL}, + + + compulsory_course_score = #{compulsoryCourseScore,jdbcType=DECIMAL}, + + + offline_score = #{offlineScore,jdbcType=DECIMAL}, + + + org_code = #{orgCode,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + created_by = #{createdBy,jdbcType=VARCHAR}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + updated_by = #{updatedBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_qualification_review + set user_id = #{userId,jdbcType=BIGINT}, + current_department = #{currentDepartment,jdbcType=VARCHAR}, + qualification_standards_id = #{qualificationStandardsId,jdbcType=BIGINT}, + `status` = #{status,jdbcType=VARCHAR}, + review_time = #{reviewTime,jdbcType=TIMESTAMP}, + professional_score = #{professionalScore, jdbcType=DECIMAL}, + professional_tip = #{professionalTip, jdbcType=VARCHAR}, + elective_course_score = #{electiveCourseScore,jdbcType=DECIMAL}, + compulsory_course_score = #{compulsoryCourseScore,jdbcType=DECIMAL}, + offline_score = #{offlineScore, jdbcType=DECIMAL}, + org_code = #{orgCode,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + created_by = #{createdBy,jdbcType=VARCHAR}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + updated_by = #{updatedBy,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=VARCHAR}, + project_id = #{projectId,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} + + + + + + + INSERT INTO t_qualification_review ( + user_id, + current_department, + qualification_standards_id, + status, + review_time, + professional_score, + professional_tip, + elective_course_score, + compulsory_course_score, + offline_score, + org_code, + project_id + ) VALUES ( + #{userId}, + #{currentDepartment}, + #{qualificationStandardsId}, + #{status}, + #{reviewTime}, + #{professionalScore}, + #{professionalTip}, + #{electiveCourseScore}, + #{compulsoryCourseScore}, + #{offlineScore}, + #{orgCode}, + #{projectId} + ) + + + + + + UPDATE t_qualification_review + SET + professional_score = #{professionalScore}, + professional_tip = #{professionalTip}, + elective_course_score = #{electiveCourseScore}, + compulsory_course_score = #{compulsoryCourseScore}, + offline_score = #{offlineScore}, + status = #{status}, + updated_at = CURRENT_TIMESTAMP + WHERE user_id = #{userId} + AND project_id = #{projectId} + AND del_flag = '0' + AND status IN ('0', '1', '2') + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TQualificationStandardsMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/TQualificationStandardsMapper.java new file mode 100644 index 0000000..e5c1cf8 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TQualificationStandardsMapper.java @@ -0,0 +1,36 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.InternalInfoParam; +import cn.wepact.dfm.training.dto.entity.TQualificationStandards; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * TQualificationStandardsMapper继承基类 + */ +@Mapper +public interface TQualificationStandardsMapper extends MyBatisBaseMapper { + List selectAllByOrgCode(@Param("orgCode") String orgCode); + + + List selectByCondition(InternalInfoParam internalInfoParam); + + /** + * 根据ID查找对应的记录 + * + * @param id 记录唯一标识符 + * @return TQualificationStandards 对象 + */ + TQualificationStandards findById(Long id); + /** + * 根据ID和单位编码查找对应的记录 + * + * @param qualificationStandardsId 记录唯一标识符 + * @param orgCode 单位编码 + * @return TQualificationStandards 对象 + */ + + TQualificationStandards findByIdAndOrgCode(@Param("qualificationStandardsId") Long qualificationStandardsId, @Param("orgCode") String orgCode); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TQualificationStandardsMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/TQualificationStandardsMapper.xml new file mode 100644 index 0000000..17fc14e --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TQualificationStandardsMapper.xml @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + id, position_name, qualification_level, org_code, created_at, + created_by, updated_at, updated_by, del_flag,qualification_criteria + + + + + + + delete from t_qualification_standards + where id = #{id,jdbcType=BIGINT} + + + insert into t_qualification_standards (position_name, qualification_level, + org_code, created_at, + created_by, updated_at, updated_by, + del_flag, qualification_criteria) + values (#{positionName,jdbcType=VARCHAR}, #{qualificationLevel,jdbcType=VARCHAR}, + #{orgCode,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, + #{createdBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, + #{delFlag,jdbcType=VARCHAR}, #{qualificationCriteria,jdbcType=LONGVARCHAR}) + + + insert into t_qualification_standards + + + position_name, + + + qualification_level, + + + org_code, + + + created_at, + + + created_by, + + + updated_at, + + + updated_by, + + + del_flag, + + + qualification_criteria, + + + + + #{positionName,jdbcType=VARCHAR}, + + + #{qualificationLevel,jdbcType=VARCHAR}, + + + #{orgCode,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{createdBy,jdbcType=VARCHAR}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{updatedBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=VARCHAR}, + + + #{qualificationCriteria,jdbcType=LONGVARCHAR}, + + + + + update t_qualification_standards + + + position_name = #{positionName,jdbcType=VARCHAR}, + + + qualification_level = #{qualificationLevel,jdbcType=VARCHAR}, + + + org_code = #{orgCode,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + created_by = #{createdBy,jdbcType=VARCHAR}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + updated_by = #{updatedBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=VARCHAR}, + + + qualification_criteria = #{qualificationCriteria,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + + + + + + + + + + + + + + update t_qualification_standards + set position_name = #{positionName,jdbcType=VARCHAR}, + qualification_level = #{qualificationLevel,jdbcType=VARCHAR}, + org_code = #{orgCode,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + created_by = #{createdBy,jdbcType=VARCHAR}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + updated_by = #{updatedBy,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + + + + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TUserMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/TUserMapper.java new file mode 100644 index 0000000..437da6a --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TUserMapper.java @@ -0,0 +1,25 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.entity.TUser; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * TUserMapper继承基类 + */ +@Mapper +public interface TUserMapper extends MyBatisBaseMapper { + // 根据用户名查询用户信息 + List selectByConditions(TUser tUser); + TUser selectByUserNo(String userNo); + + /** + * 根据 username 查询用户的 id + * @param username 用户名 + * @return 用户 ID + */ + + Long findUserIdByUsername(@Param("username") String username); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TUserMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/TUserMapper.xml new file mode 100644 index 0000000..eaa3379 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TUserMapper.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + id, username, `password`, user_avatar, user_no, show_tip, updated_at, updated_by, created_at, + created_by, del_flag, email + + + + delete from t_user + where id = #{id,jdbcType=BIGINT} + + + insert into t_user (username, `password`, user_avatar, + user_no, updated_at, updated_by, + created_at, created_by, del_flag + ) + values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{userAvatar,jdbcType=VARCHAR}, + #{userNo,jdbcType=INTEGER}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, + #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=VARCHAR} + ) + + + insert into t_user + + + username, + + + `password`, + + + user_avatar, + + + user_no, + + + email, + + + updated_at, + + + updated_by, + + + created_at, + + + created_by, + + + del_flag, + + + + + #{username,jdbcType=VARCHAR}, + + + #{password,jdbcType=VARCHAR}, + + + #{userAvatar,jdbcType=VARCHAR}, + + + #{userNo,jdbcType=INTEGER}, + + + #{email,jdbcType=VARCHAR}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{updatedBy,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{createdBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=VARCHAR}, + + + + + update t_user + + + username = #{username,jdbcType=VARCHAR}, + + + `password` = #{password,jdbcType=VARCHAR}, + + + user_avatar = #{userAvatar,jdbcType=VARCHAR}, + + + email = #{email,jdbcType=VARCHAR}, + + + user_no = #{userNo,jdbcType=INTEGER}, + + + show_tip = #{showTip,jdbcType=VARCHAR}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + updated_by = #{updatedBy,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + created_by = #{createdBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_user + set username = #{username,jdbcType=VARCHAR}, + `password` = #{password,jdbcType=VARCHAR}, + user_avatar = #{userAvatar,jdbcType=VARCHAR}, + user_no = #{userNo,jdbcType=INTEGER}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + updated_by = #{updatedBy,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + created_by = #{createdBy,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + + + + + + + diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TUserPermissionMapper.java b/src/main/java/cn/wepact/dfm/training/mapper/TUserPermissionMapper.java new file mode 100644 index 0000000..01a607c --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TUserPermissionMapper.java @@ -0,0 +1,15 @@ +package cn.wepact.dfm.training.mapper; + +import cn.wepact.dfm.training.dto.entity.TUserPermission; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * TUserPermissionMapper继承基类 + */ +@Mapper +public interface TUserPermissionMapper extends MyBatisBaseMapper { + List selectByUserId(@Param("userId") Long userId); +} diff --git a/src/main/java/cn/wepact/dfm/training/mapper/TUserPermissionMapper.xml b/src/main/java/cn/wepact/dfm/training/mapper/TUserPermissionMapper.xml new file mode 100644 index 0000000..78db841 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/mapper/TUserPermissionMapper.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + id, user_id, user_type, org_code, pre_type, updated_at, updated_by, created_at, + created_by, del_flag + + + + + delete from t_user_permission + where id = #{id,jdbcType=BIGINT} + + + insert into t_user_permission (user_id, user_type, org_code, + pre_type, updated_at, updated_by, + created_at, created_by, del_flag + ) + values (#{userId,jdbcType=BIGINT}, #{userType,jdbcType=VARCHAR}, #{orgCode,jdbcType=BIGINT}, + #{preType,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, + #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=VARCHAR} + ) + + + insert into t_user_permission + + + user_id, + + + user_type, + + + org_code, + + + pre_type, + + + updated_at, + + + updated_by, + + + created_at, + + + created_by, + + + del_flag, + + + + + #{userId,jdbcType=BIGINT}, + + + #{userType,jdbcType=VARCHAR}, + + + #{orgCode,jdbcType=BIGINT}, + + + #{preType,jdbcType=VARCHAR}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{updatedBy,jdbcType=VARCHAR}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{createdBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=VARCHAR}, + + + + + update t_user_permission + + + user_id = #{userId,jdbcType=BIGINT}, + + + user_type = #{userType,jdbcType=VARCHAR}, + + + org_code = #{orgCode,jdbcType=VARCHAR}, + + + pre_type = #{preType,jdbcType=VARCHAR}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + updated_by = #{updatedBy,jdbcType=VARCHAR}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + created_by = #{createdBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_user_permission + set user_id = #{userId,jdbcType=BIGINT}, + user_type = #{userType,jdbcType=VARCHAR}, + org_code = #{orgCode,jdbcType=VARCHAR}, + pre_type = #{preType,jdbcType=VARCHAR}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + updated_by = #{updatedBy,jdbcType=VARCHAR}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + created_by = #{createdBy,jdbcType=VARCHAR}, + del_flag = #{delFlag,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + diff --git a/src/main/java/cn/wepact/dfm/training/service/BehaviorEvidenceService.java b/src/main/java/cn/wepact/dfm/training/service/BehaviorEvidenceService.java new file mode 100644 index 0000000..94ba631 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/service/BehaviorEvidenceService.java @@ -0,0 +1,47 @@ +package cn.wepact.dfm.training.service; + + +import cn.wepact.dfm.training.dto.PageParam; +import cn.wepact.dfm.training.dto.entity.TEvidenceSubmission; +import cn.wepact.dfm.training.dto.entity.TUser; +import cn.wepact.dfm.training.mapper.TEvidenceSubmissionMapper; +import cn.wepact.dfm.training.utils.FileUtil; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +@Service +@Slf4j +public class BehaviorEvidenceService { + @Value("${upload.basePath}") + private String fileBasePath; + @Resource + private TEvidenceSubmissionMapper tEvidenceSubmissionMapper; + + //获取个人行为举证列表 + public PageInfo getPersonalBehaviorEvidenceList(PageParam param){ + PageHelper.startPage(param.getPageNo(),param.getPageSize()); + List tProfessionalFeedbacks = tEvidenceSubmissionMapper.selectByCondition(param.getCondition()); + PageInfo pageInfo = new PageInfo<>(tProfessionalFeedbacks); + return pageInfo; + } + //新增个人行为举证 + public Boolean addPersonalBehaviorEvidence(TEvidenceSubmission evidence){ + return tEvidenceSubmissionMapper.insertSelective(evidence) >0; + } + //上传个人行为举证附件材料 + public String uploadPersonalBehaviorEvidenceAttachment(TUser userInfo, MultipartFile filePath){ + //本地存储文件 + String filePathStr = fileBasePath + userInfo.getUserNo() + "\\behaviorEvidence\\" + new Date().getTime() + "_" + filePath.getOriginalFilename(); + return FileUtil.saveFile(filePath, filePathStr); + } + + +} diff --git a/src/main/java/cn/wepact/dfm/training/service/DictionaryService.java b/src/main/java/cn/wepact/dfm/training/service/DictionaryService.java new file mode 100644 index 0000000..cef13ff --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/service/DictionaryService.java @@ -0,0 +1,27 @@ +package cn.wepact.dfm.training.service; + + +import cn.wepact.dfm.training.dto.entity.TDictionary; +import cn.wepact.dfm.training.mapper.TDictionaryMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +@Slf4j +public class DictionaryService { + @Resource + private TDictionaryMapper tDictionaryMapper; + + // 获取字典列表 + public List getDictionaryList(TDictionary tDictionary) { + return tDictionaryMapper.selectByCondition(tDictionary); + } + + // 新增字典 + public Integer addDictionary(TDictionary tDictionary) { + return tDictionaryMapper.insertSelective(tDictionary); + } +} diff --git a/src/main/java/cn/wepact/dfm/training/service/InternalInformationService.java b/src/main/java/cn/wepact/dfm/training/service/InternalInformationService.java new file mode 100644 index 0000000..0b2f81e --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/service/InternalInformationService.java @@ -0,0 +1,108 @@ +package cn.wepact.dfm.training.service; + +import cn.wepact.dfm.training.dto.InternalInfoParam; +import cn.wepact.dfm.training.dto.PageParam; +import cn.wepact.dfm.training.dto.entity.TDictionary; +import cn.wepact.dfm.training.dto.entity.TQualificationStandards; +import cn.wepact.dfm.training.dto.entity.TUser; +import cn.wepact.dfm.training.mapper.TQualificationStandardsMapper; +import cn.wepact.dfm.training.utils.FileUtil; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +@Service +@Slf4j +public class InternalInformationService { + @Resource + private DictionaryService dictionaryService; + @Resource + private TQualificationStandardsMapper tQualificationStandardsMapper; + + @Value("${upload.basePath}") + private String fileBasePath; + + //获取信息内置列表 + public PageInfo getInternalInformationList(PageParam internalInfoParam){ + PageHelper.startPage(internalInfoParam.getPageNo(),internalInfoParam.getPageSize()); + List tQualificationStandards = tQualificationStandardsMapper.selectByCondition(internalInfoParam.getCondition()); + PageInfo pageInfo = new PageInfo<>(tQualificationStandards); + return pageInfo; + } + //获取信息内置情况(废弃) +// public void getInternalInformationSituation(){ +// return; +// } + //岗位序列等级新增 + public Boolean addPositionSequenceLevel(TQualificationStandards tQualificationStandards, TUser userInfo){ + tQualificationStandards.setCreatedBy(userInfo.getUserNo()); + tQualificationStandards.setCreatedAt(new Date()); + tQualificationStandards.setUpdatedBy(userInfo.getUserNo()); + tQualificationStandards.setUpdatedAt(new Date()); + tQualificationStandards.setDelFlag("0"); + return tQualificationStandardsMapper.insertSelective(tQualificationStandards) >0 ; + } + //岗位序列等级修改 + public Boolean modifyPositionSequenceLevel(TQualificationStandards tQualificationStandards, TUser userInfo){ + tQualificationStandards.setUpdatedBy(userInfo.getUserNo()); + tQualificationStandards.setUpdatedAt(new Date()); + return tQualificationStandardsMapper.updateByPrimaryKeySelective(tQualificationStandards) >0; + } + //岗位序列等级删除 + public Boolean deletePositionSequenceLevel(TQualificationStandards tQualificationStandards, TUser userInfo){ + TQualificationStandards data = new TQualificationStandards(); + data.setUpdatedBy(userInfo.getUserNo()); + data.setUpdatedAt(new Date()); + data.setDelFlag("1"); + data.setId(tQualificationStandards.getId()); + return tQualificationStandardsMapper.updateByPrimaryKeySelective(data) >0; + } + //上传任职资格管理办法 + @Transactional(rollbackFor = Exception.class) + public Boolean uploadQualificationManagementMeasures(TUser userInfo, MultipartFile filePath){ + //本地存储文件 + String filePathStr = fileBasePath + "\\internal\\" + new Date().getTime() + "_" + filePath.getOriginalFilename(); + String uploadUrl = FileUtil.saveFile(filePath, filePathStr); + TDictionary tDictionary = TDictionary.builder().orgCode(userInfo.getOrgCode()) + .type("qualificationManagementMeasures").code("url").build(); + List tDictionaries = dictionaryService.getDictionaryList(tDictionary); + Integer version = 1; + if(!CollectionUtils.isEmpty(tDictionaries)){ + Integer versionMax = tDictionaries.stream().max((o1, o2) -> o1.getVersion() - o2.getVersion()).get().getVersion(); + version = versionMax + 1; + } + TDictionary newDictionary =TDictionary.builder().orgCode(userInfo.getOrgCode()).type("qualificationManagementMeasures") + .code("url").version(version).value(uploadUrl).createdBy(userInfo.getUserNo()).createdAt(new Date()) + .updatedBy(userInfo.getUserNo()).updatedAt(new Date()).delFlag("0").build(); + return dictionaryService.addDictionary(newDictionary) >0; + } + + //上传任职资格管理办法 + public String uploadQualificationStandard(TUser userInfo, MultipartFile filePath, String path){ + //本地存储文件 + String filePathStr = fileBasePath + "\\standard\\"+ path +"\\"+ new Date().getTime() + "_" + filePath.getOriginalFilename(); + return FileUtil.saveFile(filePath, filePathStr); + } + + + //获取任职资格管理办法 + public TDictionary getQualificationManagementMeasures(TUser userInfo) { + TDictionary param = TDictionary.builder().orgCode(userInfo.getOrgCode()).type("qualificationManagementMeasures").code("url").build(); + List tDictionaries = dictionaryService.getDictionaryList(param); + if(!CollectionUtils.isEmpty(tDictionaries)){ + return tDictionaries.stream().max((o1, o2) -> o1.getVersion() - o2.getVersion()).get(); + } + return null; + + } + +} diff --git a/src/main/java/cn/wepact/dfm/training/service/JobApplicationService.java b/src/main/java/cn/wepact/dfm/training/service/JobApplicationService.java new file mode 100644 index 0000000..6054ed1 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/service/JobApplicationService.java @@ -0,0 +1,391 @@ +package cn.wepact.dfm.training.service; + +import cn.hutool.core.collection.CollectionUtil; +import cn.wepact.dfm.common.util.StringUtils; +import cn.wepact.dfm.training.dto.*; +import cn.wepact.dfm.training.dto.entity.*; +import cn.wepact.dfm.training.mapper.*; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.Instant; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; + +@Service +@Slf4j +public class JobApplicationService { + @Resource + private TDictionaryMapper tDictionaryMapper; + @Resource + private TQualificationStandardsMapper tQualificationStandardsMapper; + @Resource + private TQualificationReviewMapper tQualificationReviewMapper; + @Resource + private TPerformanceRuleMapper tPerformanceRuleMapper; + @Resource + private TAppCheckMapper tAppCheckMapper; + @Resource + private TProfessionalFeedbackMapper tProfessionalFeedbackMapper; + + @Resource + private TProfessionalStdRuleMapper tProfessionalStdRuleMapper; + + @Resource + private UserService userService; + + @Resource + private ProfessionalFeedbackService professionalFeedbackService; + + @Autowired + private ProjectJoinService projectJoinService; + @Autowired + private TOrgMapper tOrgMapper; + // 获取任职资格等级列表(废弃) +// public List getQualificationLevelList() { +// return tDictionaryMapper.selectAllByType("qualification_level"); +// } + + //任职申请基本信息查询 + public void queryBasicInformation(){ + return; + } + //任职资格序列列表 + public List getQualificationSequenceList(String orgCode){ + return tQualificationStandardsMapper.selectAllByOrgCode(orgCode); + } + //任职资格等级列表(废弃) +// public void getQualificationLevelList(){ +// return; +// } + // //任职资格课程清单列表 + // public void getQualificationCourseList(){ + // return; + // } + //申请规则校验情况查询 废弃 +// public void queryRuleValidationStatus(){ +// //UserBaseInfo +// +// return; +// } + //提交任职申请 + public String submitQualificationApplication(QualificationApplicationParam param, TUser user){ + TQualificationReview hasExit = tQualificationReviewMapper.findByUserIdAndProjectId(user.getId(), param.getProjectId()); + if(hasExit != null){ + return "存在未完成的相同等级的任职申请"; + } + Long projectId = param.getProjectId(); + ProjectJoinRequest request = new ProjectJoinRequest(); + request.setProjectId(String.valueOf(projectId)); // 将 Long 转换为 String + request.setUserInfo(param.getUserNo()); // 使用 setUserInfo 而不是 setStudentInfo + // 获取当前年份的1月1号 + LocalDate firstDayOfYear = LocalDate.now().withMonth(1).withDayOfMonth(1); + // 往前推2年 + LocalDate twoYearsAgo = firstDayOfYear.minus(2, ChronoUnit.YEARS); + // 转换为Date类型 + Date from = Date.from(twoYearsAgo.atStartOfDay(ZoneId.systemDefault()).toInstant()); + // 将Date类型转换为字符串格式 + java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd"); + request.setDateStr(sdf.format(from)); + // java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd"); + // request.setDateStr(sdf.format(new Date())); +// 由于变量projectJoinResponse已在前面定义,这里直接使用赋值语句 + ProjectJoinResponse projectJoinResponse = projectJoinService.joinProject(request); + // 判断接口返回状态,只有当 code=10000 时才进行插入操作 + if (!"10000".equals(projectJoinResponse.getCode())) { + return "调用v学苑接口失败"; + } + //获得专业回馈的必须项提示和积分(两年内) + TQualificationStandards tQualificationStandards = tQualificationStandardsMapper.selectByPrimaryKey(param.getQualificationStandardsId()); + String appLevel = tQualificationStandards.getQualificationLevel(); + TQualificationReview totalScore = this.doProfessionalScore(param.getOrgCode(), appLevel, user.getId(), new Date()); + + TQualificationReview tQualificationReview = new TQualificationReview(); + TUser byUserNo = userService.findByUserNo(param.getUserNo()); + tQualificationReview.setUserId(byUserNo.getId()); + tQualificationReview.setOrgCode(param.getOrgCode()); + tQualificationReview.setQualificationStandardsId(param.getQualificationStandardsId()); + tQualificationReview.setCurrentDepartment(param.getCurrentDepartment()); + tQualificationReview.setProfessionalScore(totalScore.getProfessionalScore()); + tQualificationReview.setProfessionalTip(totalScore.getProfessionalTip()); + tQualificationReview.setStatus("0"); + tQualificationReview.setReviewTime(new Date()); + tQualificationReview.setCreatedBy(user.getUserNo()); + tQualificationReview.setUpdatedBy(user.getUserNo()); + tQualificationReview.setProjectId(projectId); + if(tQualificationReviewMapper.insertSelective(tQualificationReview) > 0){ + return "申请成功"; + }else{ + return "申请失败"; + } + } + + /** + * 获得专业回馈的必须项提示和积分(两年内) + */ + public TQualificationReview doProfessionalScore(String orgCode, String appLevel, Long userId, Date date){ + if(date == null){ + date = new Date(); + } + Instant instant = date.toInstant(); + ZoneId zone = ZoneId.systemDefault(); + LocalDate reviewTime = instant.atZone(zone).toLocalDate(); + // 获取当前年份的1月1号 + LocalDate firstDayOfYear = reviewTime.withMonth(1).withDayOfMonth(1); + // 往前推2年 + LocalDate twoYearsAgo = firstDayOfYear.minus(2, ChronoUnit.YEARS); + // 转换为Date类型 + Date from = Date.from(twoYearsAgo.atStartOfDay(ZoneId.systemDefault()).toInstant()); + + TProfessionalStdRule tProfessionalStdRule = new TProfessionalStdRule(); + tProfessionalStdRule.setOrgCode(orgCode); + tProfessionalStdRule.setType("1"); + TUser user = new TUser(); + user.setId(userId); + user.setOrgCode(orgCode); + List tProfessionalStdRules = tProfessionalStdRuleMapper.selectByCondition(tProfessionalStdRule); + List professionalFeedbackCategoryList = professionalFeedbackService.getProfessionalFeedbackCategoryStruct(user); + Map professionalFeedbackCategoryMap = new HashMap<>(); + for(TProfessionalStdRule item:professionalFeedbackCategoryList){ + professionalFeedbackCategoryMap.put(item.getCategoryCode(), item.getCategoryName()); + professionalFeedbackCategoryMap.put(item.getCategoryCode()+"-"+item.getDefineCode(), item.getCategoryName()+"-"+item.getDefineName()); + } + String tip=""; + TProfessionalFeedback tProfessionalFeedback = new TProfessionalFeedback(); + tProfessionalFeedback.setOrgCode(orgCode); + tProfessionalFeedback.setUserId(userId); + tProfessionalFeedback.setSelectStartTime(from); + tProfessionalFeedback.setSelectEndTime(new Date()); + tProfessionalFeedback.setAuditStatus("1"); + List scores = tProfessionalFeedbackMapper.selectByCondition(tProfessionalFeedback); + Float totalScore = 0f; + Map scoreMap = new HashMap<>(); + for(TProfessionalFeedback item:scores){ + totalScore += item.getScore() == null ? 0 : item.getScore(); + scoreMap.put(item.getCategoryCode(), item.getScore()); + scoreMap.put(item.getCategoryCode()+"-"+item.getDefineCode(), item.getScore()); + } + for(TProfessionalStdRule item:tProfessionalStdRules){ + if(StringUtils.isNotEmpty(item.getRequiredQlevel())){ + JSONObject jsonObject = JSON.parseObject(item.getRequiredQlevel()); + String flag = jsonObject.getString("flag"); + String levels = jsonObject.getString("levels"); + if(flag.equals("1")){ + if(levels.contains(appLevel) && + !scoreMap.containsKey(item.getCategoryCode()) && + !tip.contains(professionalFeedbackCategoryMap.get(item.getCategoryCode()))){ + tip += professionalFeedbackCategoryMap.get(item.getCategoryCode())+";"; + } + } + if(flag.equals("2")){ + if(levels.contains(appLevel) && + !scoreMap.containsKey(item.getCategoryCode()+"-"+item.getDefineCode()) && + !tip.contains(professionalFeedbackCategoryMap.get(item.getCategoryCode()+"-"+item.getDefineCode()))){ + tip += professionalFeedbackCategoryMap.get(item.getCategoryCode()+"-"+item.getDefineCode())+";"; + } + } + } + } + TQualificationReview tQualificationReview = new TQualificationReview(); + tQualificationReview.setProfessionalScore(new BigDecimal(totalScore)); + tQualificationReview.setProfessionalTip(tip); + return tQualificationReview; + } + + public TQualificationReview dealProfessionalFeedbackScore(TQualificationReview tQualificationReview){ + //先去处理下当前专业回馈积分 + TQualificationStandards tQualificationStandards = tQualificationStandardsMapper.selectByPrimaryKey(tQualificationReview.getQualificationStandardsId()); + String appLevel = tQualificationStandards.getQualificationLevel(); + TQualificationReview totalScore = this.doProfessionalScore(tQualificationReview.getOrgCode(), + appLevel, tQualificationReview.getUserId(), tQualificationReview.getCreatedAt()); + tQualificationReview.setProfessionalScore(totalScore.getProfessionalScore()); + tQualificationReview.setProfessionalTip(totalScore.getProfessionalTip()); + + TProfessionalStdRule tProfessionalStdRule = new TProfessionalStdRule(); + tProfessionalStdRule.setOrgCode(tQualificationReview.getOrgCode()); + tProfessionalStdRule.setType("0"); + List tProfessionalStdRules = tProfessionalStdRuleMapper.selectByCondition(tProfessionalStdRule); + for(TProfessionalStdRule item: tProfessionalStdRules){ + if(tQualificationReview.getProfessionalScore() == null){ + tQualificationReview.setProfessionalScore(new BigDecimal(0)); + } + if(item.getQualificationLevel().equals(appLevel) && + tQualificationReview.getProfessionalScore().compareTo(BigDecimal.valueOf(item.getScore())) >= 0 && + org.springframework.util.StringUtils.isEmpty(tQualificationReview.getProfessionalTip())){ + if(tQualificationReview.getStatus().equals("1")){ + tQualificationReview.setStatus("2"); + } + return tQualificationReview; + } + } + return tQualificationReview; + } + + //获取是否有学习考试进行中 + public Map isLearningExamInProgress(TUser userInfo){ + AppliedParam param = new AppliedParam(); + param.setUserId(userInfo.getId()); + List statusList = new ArrayList<>(); + statusList.add("0"); + statusList.add("1"); + statusList.add("2"); + param.setStatusList(statusList); + param.setOrgCode(userInfo.getOrgCode()); + + // 获取单位简称 + TOrg tOrg = this.getOrgByCode(userInfo.getOrgCode()); + String shortName = tOrg != null ? tOrg.getShortName() : ""; + + List tQualificationReviews = tQualificationReviewMapper.selectByCondition(param); + if(CollectionUtil.isEmpty(tQualificationReviews)){ + return null; + } + Map result = new HashMap<>(); + for(TQualificationReview item:tQualificationReviews){ + CourseListRequest request = new CourseListRequest(); + // 拼接项目名称:职位名称-资格等级-单位简称 + request.setProjectName(shortName+"-"+item.getPositionName()+"-"+item.getQualificationLevel()); + CourseListResponse response = projectJoinService.getCourseList(request); + if(response != null && response.getCode().equals("10000")){ + result.put(item.getPositionName()+"-"+item.getQualificationLevel(), response); + }else{ + result.put(item.getPositionName()+"-"+item.getQualificationLevel(), null); + } + } + return result; + } + + //获取已申报任职资格列表 + public PageInfo getDeclaredQualificationList(PageParam appliedParam){ + PageHelper.startPage(appliedParam.getPageNo(), appliedParam.getPageSize()); + List tQualificationReviews = tQualificationReviewMapper.selectByCondition(appliedParam.getCondition()); + PageInfo pageInfo = new PageInfo<>(tQualificationReviews); + return pageInfo; + } + + //获取两年内的通过的任职资格列表 + public List getPassedQualificationList(AppliedParam param){ + LocalDate today = LocalDate.now(); +// // 获取两年前的日期 +// LocalDate twoYearsAgo = today.minus(2, ChronoUnit.YEARS); +// Date from = Date.from(twoYearsAgo.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); +// param.setStartTime(from); + List statusList = new ArrayList<>(); + statusList.add("5"); + statusList.add("7"); + param.setStatusList(statusList); + List data = tQualificationReviewMapper.selectByCondition(param); + AtomicReference flag = new AtomicReference<>(false); + data.forEach(item->{ + if(item.getStatus().equals("5")) { + Instant instant = item.getReviewTime().toInstant(); + ZoneId zone = ZoneId.systemDefault(); + LocalDate reviewTime = instant.atZone(zone).toLocalDate(); + LocalDate twoYearsAfter = reviewTime.plus(2, ChronoUnit.YEARS); + Date after = Date.from(twoYearsAfter.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); + item.setReviewEndTime(after); + Long epochDay = today.toEpochDay() - reviewTime.toEpochDay(); + item.setValidTime((float) (epochDay.intValue()/365.0)); + flag.set(true); + }else { + item.setReviewTime(new Date(0)); + item.setReviewEndTime(new Date(0)); + } + }); + if(flag.get()){ + data.removeIf(item->item.getStatus().equals("7")); + } + return data; + } + + + //获取资格审核列表 + public PageInfo getQualificationAuditList(PageParam appliedParam, TUser tUser){ + PageHelper.startPage(appliedParam.getPageNo(), appliedParam.getPageSize()); + List roles = tUser.getRoles(); + if(!CollectionUtils.isEmpty(roles)){ + for (TUserPermission role : roles) { + if(role.getUserType().equals("3")){ + if(appliedParam.getCondition() == null){ + appliedParam.setCondition(new AppliedParam()); + } + if(CollectionUtils.isEmpty(appliedParam.getCondition().getPositionNameList())){ + appliedParam.getCondition().setPositionNameList(new ArrayList<>()); + } + if(!org.springframework.util.StringUtils.isEmpty(role.getPreType()) && role.getPreType().contains(",")){ + String[] split = role.getPreType().split(","); + for (String item : split) { + appliedParam.getCondition().getPositionNameList().add(item); + } + }else { + appliedParam.getCondition().getPositionNameList().add(role.getPreType()); + } + } + } + if(appliedParam.getCondition() !=null && + !CollectionUtils.isEmpty(appliedParam.getCondition().getPositionNameList()) && + appliedParam.getCondition().getPositionNameList().contains("0")){ + appliedParam.getCondition().setPositionNameList(null); + } + } + List tQualificationReviews = tQualificationReviewMapper.selectWithUserInfoByCondition(appliedParam.getCondition()); + PageInfo pageInfo = new PageInfo<>(tQualificationReviews); + return pageInfo; + } + //获取资格审核详情信息(废弃) +// public void getQualificationAuditDetailInfo(){ +// return; +// } + + //资格审核通过、不通过 + public Boolean qualificationAuditStatus(TQualificationReview tQualificationReview){ + if(tQualificationReview.getOfflineScore() != null){ + if(tQualificationReview.getOfflineScore().floatValue()<65){ + tQualificationReview.setStatus("6"); + }else{ + tQualificationReview.setStatus("5"); + } + } + return tQualificationReviewMapper.updateByPrimaryKeySelective(tQualificationReview) >0; + } + + //手动同步学习积分 + public void manualSyncLearningPoints(){ + return; + } + + public List getPerformanceRuleList(String orgCode) { + TPerformanceRule param = new TPerformanceRule(); + param.setOrgCode(orgCode); + return tPerformanceRuleMapper.selectByConditions(param); + } + + public TAppCheck getAppCheck(TAppCheck param) { + List tAppChecks = tAppCheckMapper.selectByConditions(param); + if (CollectionUtil.isNotEmpty(tAppChecks)) { + return tAppChecks.get(0); + } + return null; + } + + + + public TOrg getOrgByCode(String orgCode) { + if (StringUtils.isEmpty(orgCode)) { + return null; + } + return tOrgMapper.selectByCode(orgCode); + } +} diff --git a/src/main/java/cn/wepact/dfm/training/service/ProfessionalFeedbackService.java b/src/main/java/cn/wepact/dfm/training/service/ProfessionalFeedbackService.java new file mode 100644 index 0000000..52b0dca --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/service/ProfessionalFeedbackService.java @@ -0,0 +1,231 @@ +package cn.wepact.dfm.training.service; + + +import cn.wepact.dfm.training.dto.AppliedParam; +import cn.wepact.dfm.training.dto.PageParam; +import cn.wepact.dfm.training.dto.entity.*; +import cn.wepact.dfm.training.mapper.TProfessionalFeedbackMapper; +import cn.wepact.dfm.training.mapper.TProfessionalStdRuleMapper; +import cn.wepact.dfm.training.mapper.TQualificationReviewMapper; +import cn.wepact.dfm.training.mapper.TQualificationStandardsMapper; +import cn.wepact.dfm.training.utils.FileUtil; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class ProfessionalFeedbackService { + @Resource + private TProfessionalFeedbackMapper tProfessionalFeedbackMapper; + + @Resource + private DictionaryService dictionaryService; + + @Resource + private TProfessionalStdRuleMapper tProfessionalStdRuleMapper; + + @Resource + private JobApplicationService jobApplicationService; + @Resource + private TQualificationReviewMapper tQualificationReviewMapper; + + @Resource + private TQualificationStandardsMapper tQualificationStandardsMapper; + + + @Value("${upload.basePath}") + private String fileBasePath; + + //获取专业回馈列表 + public PageInfo getProfessionalFeedbackList(PageParam tProfessionalFeedback){ + PageHelper.startPage(tProfessionalFeedback.getPageNo(),tProfessionalFeedback.getPageSize()); + List tProfessionalFeedbacks = tProfessionalFeedbackMapper.selectByCondition(tProfessionalFeedback.getCondition()); + PageInfo pageInfo = new PageInfo<>(tProfessionalFeedbacks); + return pageInfo; + } + public PageInfo getProfessionalFeedbackByRoleList(PageParam tProfessionalFeedback, TUser tUser){ + PageHelper.startPage(tProfessionalFeedback.getPageNo(),tProfessionalFeedback.getPageSize()); + List roles = tUser.getRoles(); + if(!CollectionUtils.isEmpty(roles)){ + for (TUserPermission role : roles) { + if(role.getUserType().equals("2")){ + if(tProfessionalFeedback.getCondition() == null){ + tProfessionalFeedback.setCondition(new TProfessionalFeedback()); + } + if(CollectionUtils.isEmpty(tProfessionalFeedback.getCondition().getDefineCodeList())){ + tProfessionalFeedback.getCondition().setDefineCodeList(new ArrayList<>()); + } + if(!StringUtils.isEmpty(role.getPreType()) && role.getPreType().contains(",")){ + String[] split = role.getPreType().split(","); + for (String item : split) { + tProfessionalFeedback.getCondition().getDefineCodeList().add(item); + } + }else { + tProfessionalFeedback.getCondition().getDefineCodeList().add(role.getPreType()); + } + } + } + if(tProfessionalFeedback.getCondition() !=null && + !CollectionUtils.isEmpty(tProfessionalFeedback.getCondition().getDefineCodeList()) && + tProfessionalFeedback.getCondition().getDefineCodeList().contains("0")){ + tProfessionalFeedback.getCondition().setDefineCodeList(null); + } + } + List tProfessionalFeedbacks = tProfessionalFeedbackMapper.selectWithUserInfoByCondition(tProfessionalFeedback.getCondition()); + PageInfo pageInfo = new PageInfo<>(tProfessionalFeedbacks); + return pageInfo; + } + //新增专业回馈信息 + public Boolean addProfessionalFeedbackInfo(TProfessionalFeedback tProfessionalFeedback){ + //专业回馈积分计算 + TProfessionalStdRule parentParam = TProfessionalStdRule.builder() + .orgCode(tProfessionalFeedback.getOrgCode()) + .categoryCode(tProfessionalFeedback.getCategoryCode()) + .defineCode(tProfessionalFeedback.getDefineCode()) + .type("1").build(); + TProfessionalStdRule parent = tProfessionalStdRuleMapper.selectByCondition(parentParam).get(0); + TProfessionalStdRule roleParam = TProfessionalStdRule.builder() + .orgCode(tProfessionalFeedback.getOrgCode()) + .parentId(parent.getId()) + .roleCode(tProfessionalFeedback.getRoleCode()) + .type("3").build(); + TProfessionalStdRule role = tProfessionalStdRuleMapper.selectByCondition(roleParam).get(0); + TProfessionalStdRule levelParam = TProfessionalStdRule.builder() + .orgCode(tProfessionalFeedback.getOrgCode()) + .parentId(parent.getId()) + .levelCode(tProfessionalFeedback.getLevelCode()) + .type("2").build(); + TProfessionalStdRule level = tProfessionalStdRuleMapper.selectByCondition(levelParam).get(0); + tProfessionalFeedback.setScore(tProfessionalFeedback.getNumber() * role.getScore()*level.getScore()); + + return tProfessionalFeedbackMapper.insertSelective(tProfessionalFeedback) >0; + } + //上传专业回馈附件材料 + public String uploadProfessionalFeedbackAttachment(TUser userInfo, MultipartFile filePath){ + //本地存储文件 + String filePathStr = fileBasePath + userInfo.getUserNo() + "\\professionalFeedback\\" + new Date().getTime() + "_" + filePath.getOriginalFilename(); + return FileUtil.saveFile(filePath, filePathStr); + } + //获取专业回馈类别列表 + public List getProfessionalFeedbackCategoryList(TUser userInfo){ + TDictionary tDictionary = TDictionary.builder().type("professional_type") + .orgCode(userInfo.getOrgCode()).build(); + return dictionaryService.getDictionaryList(tDictionary); + } + public List getProfessionalFeedbackCategoryStruct(TUser userInfo){ + TDictionary tDictionary = TDictionary.builder().orgCode(userInfo.getOrgCode()).build(); + List dicts = dictionaryService.getDictionaryList(tDictionary); + Map typeDictMap = new HashMap<>(); + Map defineDictMap = new HashMap<>(); + Map roleDictMap = new HashMap<>(); + Map levelDictMap = new HashMap<>(); + + for (TDictionary dictionary : dicts) { + if(dictionary.getType().equals("professional_type")){ + typeDictMap.put(dictionary.getCode(), dictionary); + } + if(dictionary.getType().equals("professional_define")){ + defineDictMap.put(dictionary.getCode(), dictionary); + } + if(dictionary.getType().equals("professional_role")){ + roleDictMap.put(dictionary.getCode(), dictionary); + } + if(dictionary.getType().equals("professional_level")){ + levelDictMap.put(dictionary.getCode(), dictionary); + } + } + + TProfessionalStdRule param = TProfessionalStdRule.builder() + .orgCode(userInfo.getOrgCode()).build(); + List tProfessionalStdRules = tProfessionalStdRuleMapper.selectByCondition(param); + Map data = new HashMap<>(); + for (TProfessionalStdRule item : tProfessionalStdRules) { + if(item.getType().equals("1")){ + item.setCategoryName(typeDictMap.get(item.getCategoryCode()).getValue()); + item.setDefineName(defineDictMap.get(item.getDefineCode()).getValue()); + data.put(item.getId(), item); + }else if(item.getType().equals("2")){ + item.setLevelName(levelDictMap.get(item.getLevelCode()).getValue()); + data.get(item.getParentId()).getLevelList().add(item); + }else if(item.getType().equals("3")){ + item.setRoleName(roleDictMap.get(item.getRoleCode()).getValue()); + data.get(item.getParentId()).getRoleList().add(item); + } + } + return new ArrayList<>(data.values()); + + } + //获取专业回馈单位列表 + public List getProfessionalFeedbackUnitList(TUser userInfo){ + TDictionary tDictionary = TDictionary.builder().type("professional_unit") + .orgCode(userInfo.getOrgCode()).build(); + return dictionaryService.getDictionaryList(tDictionary); + } + //获取专业回馈角色列表 + public List getProfessionalFeedbackRoleList(TUser userInfo){ + TDictionary tDictionary = TDictionary.builder().type("professional_role") + .orgCode(userInfo.getOrgCode()).build(); + return dictionaryService.getDictionaryList(tDictionary); + } + //获取专业回馈层级列表 + public List getProfessionalFeedbackHierarchyList(TUser userInfo){ + TDictionary tDictionary = TDictionary.builder().type("professional_level") + .orgCode(userInfo.getOrgCode()).build(); + return dictionaryService.getDictionaryList(tDictionary); + } + + //专业回馈附件查看 + public void viewProfessionalFeedbackAttachment(){ + return; + } + //专业回馈审核通过 + @Transactional(rollbackFor = Exception.class) + public Boolean professionalFeedbackAuditApproval(TProfessionalFeedback tProfessionalFeedback){ + tProfessionalFeedback.setAuditStatus("1"); + tProfessionalFeedback.setAuditDate(new Date()); + if(tProfessionalFeedbackMapper.updateByPrimaryKeySelective(tProfessionalFeedback) >0){ + //处理此用户的所有任职资格申请 + TProfessionalFeedback userInfo = tProfessionalFeedbackMapper.selectByPrimaryKey(tProfessionalFeedback.getId()); + AppliedParam appliedParam = new AppliedParam(); + appliedParam.setUserId(userInfo.getUserId()); + appliedParam.setOrgCode(userInfo.getOrgCode()); + List tQualificationReviews = tQualificationReviewMapper.selectByCondition(appliedParam); + for(TQualificationReview tQualificationReview : tQualificationReviews){ + tQualificationReview = jobApplicationService.dealProfessionalFeedbackScore(tQualificationReview); + tQualificationReviewMapper.updateByPrimaryKeySelective(tQualificationReview); + } + } + return true; + } + + + //专业回馈审核驳回 + public Boolean professionalFeedbackAuditRejection(TProfessionalFeedback tProfessionalFeedback){ + tProfessionalFeedback.setAuditStatus("2"); + tProfessionalFeedback.setAuditDate(new Date()); + return tProfessionalFeedbackMapper.updateByPrimaryKeySelective(tProfessionalFeedback) >0; + } + + public List getProfessionalFeedbackDefineList(TUser userInfo){ + TDictionary tDictionary = TDictionary.builder().type("professional_define") + .orgCode(userInfo.getOrgCode()).build(); + return dictionaryService.getDictionaryList(tDictionary); + } + + //查看专业回馈信息(废弃) +// public void viewProfessionalFeedbackInfo(){ +// return; +// } +} diff --git a/src/main/java/cn/wepact/dfm/training/service/ProjectJoinService.java b/src/main/java/cn/wepact/dfm/training/service/ProjectJoinService.java new file mode 100644 index 0000000..f2ffbd8 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/service/ProjectJoinService.java @@ -0,0 +1,148 @@ +package cn.wepact.dfm.training.service; + +import cn.wepact.dfm.training.dto.CourseListRequest; +import cn.wepact.dfm.training.dto.CourseListResponse; +import cn.wepact.dfm.training.dto.ProjectJoinRequest; +import cn.wepact.dfm.training.dto.ProjectJoinResponse; +import cn.wepact.dfm.training.util.HttpClientUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +@Slf4j +@Service +public class ProjectJoinService { + @Value("${api.dongfeng_project_url}") + private String dongfengProjectUrl; + + @Value("${api.project_add_member_url}") + private String projectAddMemberUrl; + + @Value("${api.getAPITokenUrl}") + private String getApiTokenUrl; + public ProjectJoinResponse joinProject(ProjectJoinRequest request) { + Map dataMap = new HashMap<>(); + dataMap.put("dateStr", request.getDateStr()); + dataMap.put("userInfo", request.getUserInfo()); + dataMap.put("projectId", request.getProjectId()); + String responseStr = callApi(projectAddMemberUrl, dataMap); + + if (responseStr != null) { + return handleJoinResponse(responseStr); + } else { + return new ProjectJoinResponse("500", "第三方接口调用失败", "500", "接口调用异常"); + } + + } + + private ProjectJoinResponse handleJoinResponse(String responseStr) { + JSONObject json = JSONObject.parseObject(responseStr); + String code = json.getString("code"); + String msg = json.getString("msg"); + String subCode = json.getString("subCode"); + String subMsg = json.getString("subMsg"); + + return new ProjectJoinResponse(code, msg, subCode, subMsg); + } + public CourseListResponse getCourseList(CourseListRequest request) { + Map params = new HashMap<>(); + params.put("projectName", request.getProjectName()); + String responseStr = callGetApi(dongfengProjectUrl, params); + if (responseStr != null) { + // 根据第三方接口的响应,解析并返回结果 + return handleCourseListResponse(responseStr); + } else { + return null; // 返回null或者一些默认响应,具体视业务逻辑而定 + } + } + private CourseListResponse handleCourseListResponse(String responseStr) { + JSONObject json = JSONObject.parseObject(responseStr); + CourseListResponse response = new CourseListResponse(); + + response.setSubCode(json.getString("subCode")); + response.setSubMsg(json.getString("subMsg")); + response.setCode(json.getString("code")); + response.setMsg(json.getString("msg")); + response.setRequestId(json.getString("requestId")); + + // 处理 data 对象 + JSONObject data = json.getJSONObject("data"); + if (data != null) { + response.setProjectId(data.getString("projectId")); + response.setProjectName(data.getString("projectName")); + response.setProjectStatusName(data.getString("projectStatusName")); + + // 处理 tasks 数组 + response.setTasks(data.getJSONArray("tasks").toJavaList(CourseListResponse.Task.class)); + } + + return response; + } + private String callApi(String apiUrl, Map params) { + // 假设 accessToken 是从某个地方获取的,比如从配置文件、Session 或者前端传递 + String accessToken = getAccessToken(); // 你可以根据自己的需求获取 token + + // 调用 HttpClientUtil 的 doPost 方法 + String response = HttpClientUtil.doPost(apiUrl, params, accessToken); + + // 如果需要,你可以进一步处理响应结果 + if (response != null && !response.isEmpty()) { + // 处理响应数据,比如解析 JSON 或者记录日志 + return response; + } else { + // 错误处理 + System.out.println("API 请求失败,未收到响应"); + return null; + } + } + private String callGetApi(String apiUrl, Map params) { + // 假设 accessToken 是从某个地方获取的,比如从配置文件、Session 或者前端传递 + String accessToken = getAccessToken(); // 你可以根据自己的需求获取 token + + // 调用 HttpClientUtil 的 doPost 方法 + String response = HttpClientUtil.doGet(apiUrl, params, accessToken); + + // 如果需要,你可以进一步处理响应结果 + if (response != null && !response.isEmpty()) { + // 处理响应数据,比如解析 JSON 或者记录日志 + return response; + } else { + // 错误处理 + System.out.println("API 请求失败,未收到响应"); + return null; + } + } + // 假设这是获取 accessToken 的方法,根据需要修改 + private String getAccessToken() { + String apiUrl = getApiTokenUrl; + String accessToken = null; + + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet getRequest = new HttpGet(apiUrl); + + // 执行请求 + HttpResponse response = client.execute(getRequest); + + // 获取响应内容 + String responseString = EntityUtils.toString(response.getEntity()); + + // 解析响应 JSON + com.alibaba.fastjson.JSONObject responseObject = com.alibaba.fastjson.JSON.parseObject(responseString); + accessToken = responseObject.getString("accessToken"); // 假设返回的是 {"accessToken": "your-token"} + } catch (Exception e) { + System.out.println("获取 accessToken 失败: " + e.getMessage()); + } + + return accessToken; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/service/SyncTaskService.java b/src/main/java/cn/wepact/dfm/training/service/SyncTaskService.java new file mode 100644 index 0000000..c99f389 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/service/SyncTaskService.java @@ -0,0 +1,635 @@ +package cn.wepact.dfm.training.service; + +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONException; +import cn.hutool.json.JSONObject; +import cn.wepact.dfm.training.dto.SyncRequest; +import cn.wepact.dfm.training.dto.TaskScoreSummary; +import cn.wepact.dfm.training.dto.entity.*; +import cn.wepact.dfm.training.mapper.*; +import cn.wepact.dfm.training.util.HttpClientUtil; +import com.alibaba.fastjson.JSON; +import com.itextpdf.text.log.Logger; +import com.itextpdf.text.log.LoggerFactory; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.dao.DataAccessException; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.transaction.Transactional; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.format.DateTimeFormatter; +import java.util.*; + +@Service +public class SyncTaskService { + private static final Logger logger = LoggerFactory.getLogger(SyncTaskService.class); + // 其他方法省略... +// private static final String All_API_URL = "https://openapi.yunxuetang.cn/v1/rpt2open/public/o2o/task/student/sync/all"; +// private static final String Incr_API_URL = "https://openapi.yunxuetang.cn/v1/rpt2open/public/o2o/task/student/sync/incr"; + @Value("${api.All_API_URL}") + private String All_API_URL; + @Value("${api.Incr_API_URL}") + private String Incr_API_URL; + @Value("${api.getAPITokenUrl}") + private String getAPITokenUrl; + @Autowired + private SyncTaskLogMapper syncTaskLogMapper; + + @Autowired + private SyncUserInfoLogMapper syncUserInfoLogMapper; + @Autowired + private TUserMapper userMapper; + @Autowired + private TQualificationReviewMapper tQualificationReviewMapper; + @Autowired + private TQualificationStandardsMapper tQualificationStandardsMapper; + + @Resource + private JobApplicationService jobApplicationService; + + @Autowired + private LevelScoresMapper levelScoresMapper; + @Transactional(rollbackOn = Exception.class) + public ResponseEntity syncTasks(SyncRequest syncRequest) { + try { + int offset =syncRequest.getOffset(); + int limit = syncRequest.getLimit(); + String searchStartTime = syncRequest.getSearchStartTime(); + String searchEndTime = syncRequest.getSearchEndTime(); + String syncType = syncRequest.getSyncType(); + int duration = syncRequest.getDuration(); + + if ("full".equalsIgnoreCase(syncType)) { + // 全量同步,使用请求中传入的时间区间 + fullSync(offset, limit, searchStartTime, searchEndTime); + } else if ("incremental".equalsIgnoreCase(syncType)) { + // 增量同步,通常使用最后一次同步的时间戳 + incrementalSync(offset, limit,duration); + } else { + throw new IllegalArgumentException("Invalid syncType: " + syncType); + } + return ResponseEntity.ok("同步任务成功"); + } catch (Exception e) { + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("同步任务失败: " + e.getMessage()); + } + } + private void fullSync(int offset, int limit, String searchStartTime, String searchEndTime) { + while (true) { + // 请求数据 + Map requestParams = new HashMap<>(); + requestParams.put("offset", offset); + requestParams.put("limit", limit); + requestParams.put("searchStartTime", searchStartTime); + requestParams.put("searchEndTime", searchEndTime); + + // 调用API获取数据 + String response = callApi(All_API_URL, requestParams); + + // 如果返回数据为空,则结束同步 + if (response == null || response.isEmpty()) { + break; + } + + try { + // 将返回的数据解析为 JSONObject + JSONObject responseJson = new JSONObject(response); + + // 检查返回的 "data" 是否为空 + if (responseJson.containsKey("data") && responseJson.getJSONArray("data").size() == 0) { + System.out.println("Data is empty, exiting the loop."); + break; // 如果 "data" 为空,跳出循环 + } + + // 在这里处理 "data" 非空的情况 + // 你可以继续进行数据处理 + // ... + + } catch (JSONException e) { + // 如果 JSON 解析出错,打印异常并跳出循环 + System.err.println("Error parsing JSON response: " + e.getMessage()); + break; + } + // 解析返回数据并保存到数据库 + saveSyncData(offset, limit, requestParams, response); + + // 更新offset值,进行下一次同步 + offset += limit; + } + } + private void incrementalSync(int offset, int limit, int duration) { + // 获取上次同步的时间点 + String lastSyncTime = getLastSyncTimeFromDatabase(); + String searchStartTime; + String searchEndTime = getCurrentTime(); + + if ("No sync time recorded.".equals(lastSyncTime) || "Error retrieving last sync time.".equals(lastSyncTime)) { + // 如果没有同步记录,默认同步最近24小时的数据 + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.HOUR, -24); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + searchStartTime = dateFormat.format(calendar.getTime()); + } else { + searchStartTime = lastSyncTime; + } + + // 请求数据 + while (true) { + Map requestParams = new HashMap<>(); + requestParams.put("offset", offset); + requestParams.put("limit", limit); + requestParams.put("searchStartTime", searchStartTime); + requestParams.put("searchEndTime", searchEndTime); + requestParams.put("duration", duration); + // 调用API获取数据 + String response = callApi(Incr_API_URL, requestParams); + + // 如果返回数据为空,则结束同步 + if (response == null || response.isEmpty()) { + break; + } + + try { + // 将返回的数据解析为 JSONObject + JSONObject responseJson = new JSONObject(response); + + // 检查返回的 "data" 是否为空 + if (responseJson.containsKey("data") && responseJson.getJSONArray("data").size() == 0) { + System.out.println("Data is empty, exiting the loop."); + break; // 如果 "data" 为空,跳出循环 + } + + // 在这里处理 "data" 非空的情况 + // 你可以继续进行数据处理 + // ... + + } catch (JSONException e) { + // 如果 JSON 解析出错,打印异常并跳出循环 + System.err.println("Error parsing JSON response: " + e.getMessage()); + break; + } + // 解析返回数据并保存到数据库 + saveSyncData(offset, limit, requestParams, response); + + // 更新offset值,进行下一次同步 + offset += limit; + } + + // 增量同步后,更新最后同步时间 + updateLastSyncTimeToDatabase(getCurrentTime()); + } + /** + * 获取每个学生每个项目下必修和选修的任务汇总分数 + * @return 汇总的任务分数集合 + */ + public List getTaskScoreSummary() { + return syncTaskLogMapper.getTaskScoreSummary(); + } + public String getLastSyncTimeFromDatabase() { + String formattedLastSyncTime = null; + try { + // 调用Mapper方法获取时间 + Date lastSyncTime = syncTaskLogMapper.getLastSyncTime(); + // Check if lastSyncTime is not null + if (lastSyncTime != null) { + // Format the date to a readable string (e.g., "yyyy-MM-dd HH:mm:ss") + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + formattedLastSyncTime = dateFormat.format(lastSyncTime); + } else { + formattedLastSyncTime = "No sync time recorded."; + } + } catch (Exception e) { + e.printStackTrace(); + formattedLastSyncTime = "Error retrieving last sync time."; + } + return formattedLastSyncTime; + } + + private String getCurrentTime() { + // 获取当前时间,用作增量同步结束的时间 + // 创建日期格式化对象 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + // 获取当前系统时间 + Date now = new Date(); + + // 格式化当前时间并返回字符串 + return dateFormat.format(now); + } + + private void updateLastSyncTimeToDatabase(String lastSyncTime) { + // 更新最后同步时间到数据库 + try { + // 将字符串转换为 Date 对象 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date = dateFormat.parse(lastSyncTime); + + // 调用 Mapper 方法更新最后同步时间 + syncTaskLogMapper.updateLastSyncTime(date); + + System.out.println("最后同步时间已更新: " + lastSyncTime); + } catch (ParseException e) { + e.printStackTrace(); + System.err.println("时间格式错误: " + lastSyncTime); + } catch (Exception e) { + e.printStackTrace(); + System.err.println("更新数据库时发生错误"); + } + } + // 调用接口 + private String callApi(String apiUrl, Map params) { + // 假设 accessToken 是从某个地方获取的,比如从配置文件、Session 或者前端传递 + String accessToken = getAccessToken(); // 你可以根据自己的需求获取 token + + // 调用 HttpClientUtil 的 doPost 方法 + String response = HttpClientUtil.doPost(apiUrl, params, accessToken); + + // 如果需要,你可以进一步处理响应结果 + if (response != null && !response.isEmpty()) { + // 处理响应数据,比如解析 JSON 或者记录日志 + return response; + } else { + // 错误处理 + System.out.println("API 请求失败,未收到响应"); + return null; + } + } + // 假设这是获取 accessToken 的方法,根据需要修改 + private String getAccessToken() { + String apiUrl = getAPITokenUrl; + String accessToken = null; + + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet getRequest = new HttpGet(apiUrl); + + // 执行请求 + HttpResponse response = client.execute(getRequest); + + // 获取响应内容 + String responseString = EntityUtils.toString(response.getEntity()); + + // 解析响应 JSON + com.alibaba.fastjson.JSONObject responseObject = JSON.parseObject(responseString); + accessToken = responseObject.getString("accessToken"); // 假设返回的是 {"accessToken": "your-token"} + } catch (Exception e) { + System.out.println("获取 accessToken 失败: " + e.getMessage()); + } + + return accessToken; + } + public static void main(String[] args) { + +// String token = getAccessToken(); +// System.out.println("Access Token: " + token); + } + // 保存同步数据并展开字段 + private void saveSyncData(int offset, int limit, Map params, String responseData) { + + // 假设你已经解析了API的响应数据到Java对象中 + JSONObject responseJson = null; + JSONArray dataArray = null; + try { + responseJson = new JSONObject(responseData); + dataArray = responseJson.getJSONArray("data"); + + for (int i = 0; i < dataArray.size(); i++) { + JSONObject taskData = dataArray.getJSONObject(i); + // 从任务数据中获取学生用户ID + String stuUserId = getStringValue(taskData, "stuUserId"); + + + + // 1. 获取用户信息:根据云学堂的学生用户ID查询本地用户信息 + SyncUserInfoLog userInfo = syncUserInfoLogMapper.findUserInfoByStuUserId(stuUserId); + if (userInfo == null) { + continue; // 如果在本地数据库中找不到对应的用户信息,跳过当前记录的处理 + } + + // 2. 获取系统内部的user_id:通过用户名查找对应的用户ID + Long userId = userMapper.findUserIdByUsername(userInfo.getUsername()); + if (userId == null) { + continue; // 如果找不到对应的用户ID,跳过当前记录的处理 + } + + SyncTaskLog log = new SyncTaskLog(); + // 填充 SyncTaskLog 对象的字段 + log.setSyncTime(new Timestamp(System.currentTimeMillis())); + log.setOffset(offset); + log.setLimit(limit); + log.setSearchStartTime(parseTimestamp((String) params.get("searchStartTime"))); + log.setSearchEndTime(parseTimestamp((String) params.get("searchEndTime"))); + log.setStatus(1); // 假设同步成功 + + log.setTaskId(getLongValue(taskData, "taskId")); + log.setOrgId(getStringValue(taskData, "orgId")); + log.setProjectId(getLongValue(taskData, "projectId")); + log.setMainProjectId(getLongValue(taskData, "mainProjectId")); + log.setStuUserId(getStringValue(taskData, "stuUserId")); + log.setThirdUserId(getStringValue(taskData, "thirdUserId")); + log.setFormal(getIntValue(taskData, "formal")); + log.setPeriodId(getLongValue(taskData, "periodId")); + log.setResultRepeatFlag(getIntValue(taskData, "resultRepeatFlag")); + log.setSubResultId(getLongValue(taskData, "subResultId")); + log.setSubTaskId(getLongValue(taskData, "subTaskId")); + log.setRepeatCount(getIntValue(taskData, "repeatCount")); + log.setSubTaskResultId(getLongValue(taskData, "subTaskResultId")); + log.setOrderIndex(getIntValue(taskData, "orderIndex")); + log.setTaskStatus(getIntValue(taskData, "taskStatus")); + log.setTaskRequired(getIntValue(taskData, "taskRequired")); + log.setTaskSchedule(getBigDecimalValue(taskData, "taskSchedule")); + log.setTaskManualCompleted(getIntValue(taskData, "taskManualCompleted")); + log.setTaskStartTime(parseTimestamp(getStringValue(taskData, "taskStartTime"))); + log.setTaskCompletedTime(parseTimestamp(getStringValue(taskData, "taskCompletedTime"))); + log.setTaskDuration(getIntValue(taskData, "taskDuration")); + log.setIsRated(getIntValue(taskData, "isRated")); + log.setTaskTargetScores(getBigDecimalValue(taskData, "taskTargetScores")); + log.setTaskPassed(getIntValue(taskData, "taskPassed")); + log.setTaskIsExcellent(getIntValue(taskData, "taskIsExcellent")); + log.setTaskDelay(getIntValue(taskData, "taskDelay")); + log.setTaskSignStatus(getIntValue(taskData, "taskSignStatus")); + log.setTaskSignoutStatus(getIntValue(taskData, "taskSignoutStatus")); + log.setTaskSignTime(parseTimestamp(getStringValue(taskData, "taskSignTime"))); + log.setTaskSignoutTime(parseTimestamp(getStringValue(taskData, "taskSignoutTime"))); + log.setTaskSignAddress(getStringValue(taskData, "taskSignAddress")); + log.setTaskSignoutAddress(getStringValue(taskData, "taskSignoutAddress")); + log.setTaskAnswer(getStringValue(taskData, "taskAnswer")); + log.setTaskGetScores(getBigDecimalValue(taskData, "taskGetScores")); + log.setTaskGetPoints(getIntValue(taskData, "taskGetPoints")); + log.setTaskGetStudyHours(getIntValue(taskData, "taskGetStudyHours")); + log.setStuDeleted(getIntValue(taskData, "stuDeleted")); + log.setTaskResultDeleted(getIntValue(taskData, "taskResultDeleted")); + log.setTaskHasTutor(getIntValue(taskData, "taskHasTutor")); + log.setOjtTeacherId(getStringValue(taskData, "ojtTeacherId")); + log.setOjtTeacherFullname(getStringValue(taskData, "ojtTeacherFullname")); + log.setOjtStudyStatus(getIntValue(taskData, "ojtStudyStatus")); + log.setOjtOutTime(parseTimestamp(getStringValue(taskData, "ojtOutTime"))); + log.setOjtInTime(parseTimestamp(getStringValue(taskData, "ojtInTime"))); + log.setTrCreateUserId(getStringValue(taskData, "trCreateUserId")); + log.setTrUpdateUserId(getStringValue(taskData, "trUpdateUserId")); + log.setTrUpdateTime(parseTimestamp(getStringValue(taskData, "trUpdateTime"))); + log.setTaskType(getIntValue(taskData, "taskType")); + log.setTrCreateTime(parseTimestamp(getStringValue(taskData, "trCreateTime"))); + log.setUpdateTime(parseTimestamp(getStringValue(taskData, "updateTime"))); + log.setDbCreateTime(parseTimestamp(getStringValue(taskData, "dbCreateTime"))); + log.setDbUpdateTime(parseTimestamp(getStringValue(taskData, "dbUpdateTime"))); + + // 额外存储API响应的原始数据和错误信息 + log.setResponseData(responseData); + log.setErrorMessage(optString(taskData, "errorMessage", "")); + // 保存日志记录到数据库 + try { + syncTaskLogMapper.insert(log); + } catch (DataAccessException e) { + logger.error("数据库保存失败:"); + throw e; // 抛出异常,跳出循环 + } + // 去重逻辑:检查是否已经存在此taskId +// SyncTaskLog existingLog = syncTaskLogMapper.findByTaskId(log.getTaskId()); +// if (existingLog != null) { // 如果存在,进行更新操作 +// existingLog.setStatus(log.getStatus()); +// existingLog.setTaskSchedule(log.getTaskSchedule()); +// existingLog.setTaskDuration(log.getTaskDuration()); +// existingLog.setSyncTime(log.getSyncTime()); +// existingLog.setOffset(log.getOffset()); +// existingLog.setLimit(log.getLimit()); +// existingLog.setSearchStartTime(log.getSearchStartTime()); +// existingLog.setSearchEndTime(log.getSearchEndTime()); +// existingLog.setTaskId(log.getTaskId()); +// existingLog.setOrgId(log.getOrgId()); +// existingLog.setProjectId(log.getProjectId()); +// existingLog.setMainProjectId(log.getMainProjectId()); +// existingLog.setStuUserId(log.getStuUserId()); +// existingLog.setThirdUserId(log.getThirdUserId()); +// existingLog.setFormal(log.getFormal()); +// existingLog.setPeriodId(log.getPeriodId()); +// existingLog.setResultRepeatFlag(log.getResultRepeatFlag()); +// existingLog.setSubResultId(log.getSubResultId()); +// existingLog.setSubTaskId(log.getSubTaskId()); +// existingLog.setRepeatCount(log.getRepeatCount()); +// existingLog.setSubTaskResultId(log.getSubTaskResultId()); +// existingLog.setOrderIndex(log.getOrderIndex()); +// existingLog.setTaskStatus(log.getTaskStatus()); +// existingLog.setTaskRequired(log.getTaskRequired()); +// existingLog.setTaskManualCompleted(log.getTaskManualCompleted()); +// existingLog.setTaskStartTime(log.getTaskStartTime()); +// existingLog.setTaskCompletedTime(log.getTaskCompletedTime()); +// existingLog.setIsRated(log.getIsRated()); +// existingLog.setTaskTargetScores(log.getTaskTargetScores()); +// existingLog.setTaskPassed(log.getTaskPassed()); +// existingLog.setTaskIsExcellent(log.getTaskIsExcellent()); +// existingLog.setTaskDelay(log.getTaskDelay()); +// existingLog.setTaskSignStatus(log.getTaskSignStatus()); +// existingLog.setTaskSignoutStatus(log.getTaskSignoutStatus()); +// existingLog.setTaskSignTime(log.getTaskSignTime()); +// existingLog.setTaskSignoutTime(log.getTaskSignoutTime()); +// existingLog.setTaskSignAddress(log.getTaskSignAddress()); +// existingLog.setTaskSignoutAddress(log.getTaskSignoutAddress()); +// existingLog.setTaskAnswer(log.getTaskAnswer()); +// existingLog.setTaskGetScores(log.getTaskGetScores()); +// existingLog.setTaskGetPoints(log.getTaskGetPoints()); +// existingLog.setTaskGetStudyHours(log.getTaskGetStudyHours()); +// existingLog.setStuDeleted(log.getStuDeleted()); +// existingLog.setTaskResultDeleted(log.getTaskResultDeleted()); +// existingLog.setTaskHasTutor(log.getTaskHasTutor()); +// existingLog.setOjtTeacherId(log.getOjtTeacherId()); +// existingLog.setOjtTeacherFullname(log.getOjtTeacherFullname()); +// existingLog.setOjtStudyStatus(log.getOjtStudyStatus()); +// existingLog.setOjtOutTime(log.getOjtOutTime()); +// existingLog.setCreatedAt(log.getCreatedAt()); +// existingLog.setUpdatedAt(log.getUpdatedAt()); +// // 新增字段更新 +// existingLog.setTrCreateUserId(log.getTrCreateUserId()); +// existingLog.setTrUpdateUserId(log.getTrUpdateUserId()); +// existingLog.setTrUpdateTime(log.getTrUpdateTime()); +// existingLog.setTaskType(log.getTaskType()); +// existingLog.setTrCreateTime(log.getTrCreateTime()); +// existingLog.setUpdateTime(log.getUpdateTime()); +// existingLog.setDbCreateTime(log.getDbCreateTime()); +// existingLog.setDbUpdateTime(log.getDbUpdateTime()); +// // 额外存储API响应的原始数据和错误信息 +// existingLog.setResponseData(log.getResponseData()); +// existingLog.setErrorMessage(log.getErrorMessage()); +// +// // 执行更新操作 +// try { +// syncTaskLogMapper.update(existingLog); // 更新数据库中的记录 +// } catch (DataAccessException e) { +// logger.error("更新同步记录失败:", e); +// throw e; // 抛出异常,跳出循环 +// } +// } +// else { +// // 保存日志记录到数据库 +// try { +// syncTaskLogMapper.insert(log); +// } catch (DataAccessException e) { +// logger.error("数据库保存失败:"); +// throw e; // 抛出异常,跳出循环 +// } +// } + } + } catch (Exception e) { + logger.error("同步数据处理失败:", e); + throw e; // 抛出异常,跳出循环 + } + + + + } + // 辅助方法:转换字符串为时间戳 + private Timestamp parseTimestamp(String value) { + try { + return value != null && !value.isEmpty() ? Timestamp.valueOf(value) : null; + } catch (IllegalArgumentException e) { +// logger.error("时间转换失败: " + value, e); + return null; + } + } + + // 获取 Long 值,若为空则返回 null + private Long getLongValue(JSONObject json, String key) { + return json.containsKey(key) && json.get(key) != null ? json.getLong(key) : null; + } + + // 获取 String 值,若为空则返回空字符串 + private String getStringValue(JSONObject json, String key) { + return json.containsKey(key) && json.get(key) != null ? json.getStr(key) : ""; + } + + // 获取 Integer 值,若为空则返回 0 + private Integer getIntValue(JSONObject json, String key) { + if (json != null && json.containsKey(key) && json.get(key) != null) { + Object value = json.get(key); + if (value instanceof Integer) { + return (Integer) value; // 如果值是 Integer,直接返回 + } else { + try { + return Integer.parseInt(value.toString()); // 如果是其他类型,转换为 Integer + } catch (NumberFormatException e) { + return 0; // 转换失败,返回 0 + } + } + } + return 0; // 如果 json 为 null,或者 key 不存在,或者值是 JSONObject.NULL,返回 0 + } + + // 获取 BigDecimal 值,若为空则返回 null + private BigDecimal getBigDecimalValue(JSONObject json, String key) { + return json.containsKey(key) && json.get(key) != null ? json.getBigDecimal(key) : null; + } + // 实现类似于 org.json.JSONObject 的 optString 方法 + public String optString(JSONObject json, String key, String defaultValue) { + return json.containsKey(key) && json.get(key) != null ? json.getStr(key) : defaultValue; + } + + public void processTaskScores(List taskScoreSummaries) { + for (TaskScoreSummary summary : taskScoreSummaries) { + // 1. 获取用户信息 + SyncUserInfoLog userInfo = syncUserInfoLogMapper.findUserInfoByStuUserId(summary.getStuUserId()); + if (userInfo == null) { + continue; // 如果没有找到用户信息,跳过 + } + + // 2. 获取 user_id + Long userId = userMapper.findUserIdByUsername(userInfo.getUsername()); + if (userId == null) { + continue; // 如果没有找到用户 ID,跳过 + } + + // 3. 查找 qualification_review 记录 + TQualificationReview existingReview = tQualificationReviewMapper.findByUserIdAndProjectId(userId, summary.getProjectId()); + + // 4. 如果记录存在,则更新;如果记录不存在,则插入 + if (existingReview != null) { + try { + Long qualificationStandardsId = existingReview.getQualificationStandardsId(); + String orgCode = existingReview.getOrgCode(); + + // 检查资格标准ID和机构代码 + if (qualificationStandardsId == null) { + logger.error("资格标准ID为空,userId: " + existingReview.getUserId() + + ", projectId: " + existingReview.getProjectId()); + continue; + } + + if (orgCode == null || orgCode.trim().isEmpty()) { + logger.error("机构代码为空,userId: " + existingReview.getUserId() + + ", projectId: " + existingReview.getProjectId()); + continue; + } + + TQualificationStandards byId = tQualificationStandardsMapper.findByIdAndOrgCode(qualificationStandardsId, orgCode); + if (byId == null) { + logger.error("未找到对应的资格标准记录,standardsId: " + qualificationStandardsId + + ", orgCode: " + orgCode + ", userId: " + existingReview.getUserId()); + continue; + } + + String qualificationLevel = byId.getQualificationLevel(); + if (qualificationLevel == null || qualificationLevel.length() < 2) { + logger.error("资格等级为空或格式不正确: " + qualificationLevel); + return; + } + + String firstTwoChars = qualificationLevel.substring(0, 2); + LevelScores byLevel = levelScoresMapper.findByLevel(firstTwoChars); + if (byLevel == null) { + logger.error("未找到对应的等级分数要求: " + firstTwoChars); + return; + } + + if (summary.getRequiredTotalScores().compareTo(BigDecimal.valueOf(byLevel.getRequiredScore())) >= 0 + && summary.getElectiveTotalScores().compareTo(BigDecimal.valueOf(byLevel.getElectiveScore())) >= 0) { + existingReview.setStatus("1"); + //处理专业回馈达标 + existingReview = jobApplicationService.dealProfessionalFeedbackScore(existingReview); + updateQualificationReview(existingReview, summary); + }else{ + updateQualificationReview(existingReview, summary); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("处理资格审核记录时发生错误", e); + } + } + + //todo 暂时先不更新s: 这里的逻辑需要根据实际需求进行调整 +// else { +// insertQualificationReview(userId, summary); +// } + } + } + private void updateQualificationReview(TQualificationReview existingReview, TaskScoreSummary summary) { + // 假设这里是更新逻辑,按需要设置相关字段 + // 更新分数记录 + existingReview.setCompulsoryCourseScore(BigDecimal.valueOf(summary.getRequiredTotalScores().doubleValue())); + existingReview.setElectiveCourseScore(BigDecimal.valueOf(summary.getElectiveTotalScores().doubleValue())); + + + + // 执行更新操作 + tQualificationReviewMapper.updateQualificationReview(existingReview); // 更新操作,或者使用 UPDATE SQL 语句 + } + + private void insertQualificationReview(Long userId, TaskScoreSummary summary) { + TQualificationReview newReview = new TQualificationReview(); + newReview.setUserId(userId); + newReview.setProjectId(summary.getProjectId()); + newReview.setCompulsoryCourseScore(BigDecimal.valueOf(summary.getRequiredTotalScores().doubleValue())); + newReview.setElectiveCourseScore(BigDecimal.valueOf(summary.getElectiveTotalScores().doubleValue())); + // 其他需要填充的字段,如 department, org_code 等 + tQualificationReviewMapper.insertQualificationReview(newReview); + } +} diff --git a/src/main/java/cn/wepact/dfm/training/service/SyncUserInfoService.java b/src/main/java/cn/wepact/dfm/training/service/SyncUserInfoService.java new file mode 100644 index 0000000..db0782f --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/service/SyncUserInfoService.java @@ -0,0 +1,457 @@ +package cn.wepact.dfm.training.service; + +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONException; +import cn.hutool.json.JSONObject; +import cn.wepact.dfm.training.dto.SyncRequest; +import cn.wepact.dfm.training.dto.entity.SyncTaskLog; +import cn.wepact.dfm.training.dto.entity.SyncUserInfoLog; +import cn.wepact.dfm.training.mapper.SyncUserInfoLogMapper; +import cn.wepact.dfm.training.mapper.TUserMapper; +import cn.wepact.dfm.training.util.HttpClientUtil; +import com.alibaba.fastjson.JSON; +// 修改 import 语句 +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +// 删除这两行 +// import com.itextpdf.text.log.Logger; +// import com.itextpdf.text.log.LoggerFactory; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.dao.DataAccessException; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; + +import javax.transaction.Transactional; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +@Service +public class SyncUserInfoService { + + private static final Logger logger = LoggerFactory.getLogger(SyncUserInfoService.class); + @Autowired + private SyncUserInfoLogMapper syncUserInfoMapper; + @Autowired + private TUserMapper userMapper; + @Value("${api.All_API_USER_URL}") + private String All_API_USER_URL; + @Value("${api.Incr_API_USER_URL}") + private String Incr_API_USER_URL; + @Value("${api.getAPITokenUrl}") + private String getAPITokenUrl; + +@Transactional(rollbackOn = Exception.class) + public ResponseEntity syncUserInfos(SyncRequest syncRequest) { + try { + // 执行同步逻辑 + // 如果成功 + int offset =syncRequest.getOffset(); + int limit = syncRequest.getLimit(); + String searchStartTime = syncRequest.getSearchStartTime(); + String searchEndTime = syncRequest.getSearchEndTime(); + String syncType = syncRequest.getSyncType(); + int duration = syncRequest.getDuration(); + if ("full".equalsIgnoreCase(syncType)) { + // 全量同步,使用请求中传入的时间区间 + fullSync(offset, limit, searchStartTime, searchEndTime); + } else if ("incremental".equalsIgnoreCase(syncType)) { + // 增量同步,通常使用最后一次同步的时间戳 + incrementalSync(offset, limit,duration); + }else { + throw new IllegalArgumentException("Invalid syncType: " + syncType); + } + return ResponseEntity.ok("同步用户成功"); + } catch (Exception e) { + // 如果发生异常 + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("同步用户失败: " + e.getMessage()); + } + } + private void fullSync(int offset, int limit, String searchStartTime, String searchEndTime) { + while (true) { + // 请求数据 + Map requestParams = new HashMap<>(); + requestParams.put("offset", offset); + requestParams.put("limit", limit); + requestParams.put("searchStartTime", searchStartTime); + requestParams.put("searchEndTime", searchEndTime); + + // 调用API获取数据 + String response = callApi(All_API_USER_URL, requestParams); + + // 如果返回数据为空,则结束同步 + if (response == null || response.isEmpty()) { + break; + } + + try { + // 将返回的数据解析为 JSONObject + JSONObject responseJson = new JSONObject(response); + + // 检查返回的 "data" 是否为空 + if (responseJson.containsKey("data") && responseJson.getJSONArray("data").size() == 0) { + System.out.println("Data is empty, exiting the loop."); + break; // 如果 "data" 为空,跳出循环 + } + + // 在这里处理 "data" 非空的情况 + // 你可以继续进行数据处理 + // ... + + } catch (JSONException e) { + // 如果 JSON 解析出错,打印异常并跳出循环 + System.err.println("Error parsing JSON response: " + e.getMessage()); + break; + } + // 解析返回数据并保存到数据库 + saveSyncUserData(offset, limit, requestParams, response); + + // 更新offset值,进行下一次同步 + offset += limit; + } + } + + + + private void incrementalSync(int offset, int limit,int duration) { + // 获取上次同步的时间点,通常从数据库中获取 + String lastSyncTime = getLastSyncTimeFromDatabase(); + + // 增量同步,使用上次同步的时间点作为查询的起始时间 + String searchStartTime = lastSyncTime; + String searchEndTime = getCurrentTime(); + + // 请求数据 + while (true) { + Map requestParams = new HashMap<>(); + requestParams.put("offset", offset); + requestParams.put("limit", limit); + requestParams.put("searchStartTime", searchStartTime); + requestParams.put("searchEndTime", searchEndTime); + requestParams.put("duration", duration); + // 调用API获取数据 + String response = callApi(Incr_API_USER_URL, requestParams); + // 如果返回数据为空,则结束同步 + if (response == null || response.isEmpty()) { + break; + } + + try { + // 将返回的数据解析为 JSONObject + JSONObject responseJson = new JSONObject(response); + + // 检查返回的 "data" 是否为空 + if (responseJson.containsKey("data") && responseJson.getJSONArray("data").size() == 0) { + System.out.println("Data is empty, exiting the loop."); + break; // 如果 "data" 为空,跳出循环 + } + + // 在这里处理 "data" 非空的情况 + // 你可以继续进行数据处理 + // ... + + } catch (JSONException e) { + // 如果 JSON 解析出错,打印异常并跳出循环 + System.err.println("Error parsing JSON response: " + e.getMessage()); + break; + } + // 解析返回数据并保存到数据库 + saveSyncUserData(offset, limit, requestParams, response); + + // 更新offset值,进行下一次同步 + offset += limit; + } + + // 增量同步后,更新最后同步时间 + updateLastSyncTimeToDatabase(getCurrentTime()); + } + private void saveSyncUserData(int offset, int limit, Map params, String responseData) { + // 检查入参 + if (responseData == null || responseData.isEmpty()) { + logger.error("响应数据为空"); + return; + } + + JSONObject responseJson = null; + JSONArray dataArray = null; + try { + responseJson = new JSONObject(responseData); + // 检查data字段是否存在且不为空 + if (!responseJson.containsKey("data")) { + logger.error("响应数据中没有data字段"); + return; + } + + dataArray = responseJson.getJSONArray("data"); + if (dataArray == null || dataArray.size() == 0) { + logger.info("没有需要同步的数据"); + return; + } + + for (int i = 0; i < dataArray.size(); i++) { + JSONObject dataObject = dataArray.getJSONObject(i); + if (dataObject == null) { + logger.warn("第{}条数据为空,跳过处理", i); + continue; + } + + // 获取用户名,进行空值检查 + String username = getStringValue(dataObject, "username"); + if (username == null || username.trim().isEmpty()) { + logger.warn("用户名为空,跳过处理第{}条数据", i); + continue; + } + + // 获取系统内部的user_id + Long userId = userMapper.findUserIdByUsername(username); + if (userId == null) { + logger.warn("未找到用户: {}", username); + continue; + } + + // 后续代码保持不变 + SyncUserInfoLog userInfo = new SyncUserInfoLog(); + // 填充 SyncTaskLog 对象的字段 + userInfo.setSyncTime(new Timestamp(System.currentTimeMillis())); + userInfo.setOffset(offset); + userInfo.setSyncLimit(limit); + userInfo.setSearchStartTime(parseTimestamp((String) params.get("searchStartTime"))); + userInfo.setSearchEndTime(parseTimestamp((String) params.get("searchEndTime"))); + userInfo.setStatus(1); // 假设同步成功 + + userInfo.setId(getStringValue(dataObject, "id")); + userInfo.setUserId(getStringValue(dataObject, "userId")); + userInfo.setUsername(getStringValue(dataObject, "username")); + userInfo.setFullname(getStringValue(dataObject, "fullname")); + userInfo.setGender(getIntValue(dataObject, "gender")); + userInfo.setIdNo(getStringValue(dataObject, "idNo")); + userInfo.setBirthday(getDateValue(dataObject, "birthday")); + userInfo.setDeptId(getStringValue(dataObject, "deptId")); + userInfo.setDeptName(getStringValue(dataObject, "deptName")); + userInfo.setPositionId(getStringValue(dataObject, "positionId")); + userInfo.setPositionName(getStringValue(dataObject, "positionName")); + userInfo.setGradeId(getStringValue(dataObject, "gradeId")); + userInfo.setGradeName(getStringValue(dataObject, "gradeName")); + userInfo.setManagerId(getStringValue(dataObject, "managerId")); + userInfo.setManagerFullname(getStringValue(dataObject, "managerFullname")); + userInfo.setDeptManagerId(getStringValue(dataObject, "deptManagerId")); + userInfo.setDeptManagerFullname(getStringValue(dataObject, "deptManagerFullname")); + userInfo.setMobile(getStringValue(dataObject, "mobile")); + userInfo.setEmail(getStringValue(dataObject, "email")); + userInfo.setUserNo(getStringValue(dataObject, "userNo")); + userInfo.setHireDate(getDateValue(dataObject, "hireDate")); + userInfo.setExpiredTime(getDateValue(dataObject, "expiredTime")); + userInfo.setAreaCode(getStringValue(dataObject, "areaCode")); + userInfo.setUserStatus(getIntValue(dataObject, "userStatus")); + userInfo.setAvatarUrl(getStringValue(dataObject, "avatarUrl")); + userInfo.setAdmin(getIntValue(dataObject, "admin")); + userInfo.setDeleted(getIntValue(dataObject, "deleted")); + userInfo.setThirdUserId(getStringValue(dataObject, "thirdUserId")); + userInfo.setCreateTime(getDateValue(dataObject, "createTime")); + userInfo.setUpdateTime(getDateValue(dataObject, "updateTime")); + userInfo.setUserType(getIntValue(dataObject, "userType")); + // 额外存储API响应的原始数据和错误信息 + userInfo.setResponseData(responseData); + userInfo.setErrorMessage(optString(dataObject, "errorMessage", "")); + // Check if the user already exists in the database + try { + SyncUserInfoLog existingUser = syncUserInfoMapper.getUserInfoByUserId(userInfo.getUserId()); + if (existingUser == null) { + // New user, insert into database + try { + syncUserInfoMapper.insertUserInfo(userInfo); + logger.info("Successfully inserted new user: {}", userInfo.getUserId()); + } catch (DataAccessException e) { + logger.error("Failed to insert new user: {}, error: {}", userInfo.getUserId(), e.getMessage()); + userInfo.setStatus(0); // 设置同步状态为失败 + userInfo.setErrorMessage(e.getMessage()); + syncUserInfoMapper.insertUserInfo(userInfo); // 保存失败记录 + continue; // 继续处理下一条记录 + } + } else { + // Existing user, update the user info + try { + syncUserInfoMapper.updateUserInfo(userInfo); + logger.info("Successfully updated user: {}", userInfo.getUserId()); + } catch (DataAccessException e) { + logger.error("Failed to update user: {}, error: {}", userInfo.getUserId(), e.getMessage()); + userInfo.setStatus(0); // 设置同步状态为失败 + userInfo.setErrorMessage(e.getMessage()); + syncUserInfoMapper.updateUserInfo(userInfo); // 保存失败记录 + continue; // 继续处理下一条记录 + } + } + } catch (Exception e) { + logger.error("Error processing user: {}, error: {}", userInfo.getUserId(), e.getMessage()); + continue; // 继续处理下一条记录 + } + + } + } catch (Exception e) { + logger.error("同步数据处理失败:", e); + throw e; // 抛出异常,跳出循环 + } + + } + public String getLastSyncTimeFromDatabase() { + String formattedLastSyncTime = null; + try { + // 调用Mapper方法获取时间 + Date lastSyncTime = syncUserInfoMapper.getLastSyncTime(); + // Check if lastSyncTime is not null + if (lastSyncTime != null) { + // Format the date to a readable string (e.g., "yyyy-MM-dd HH:mm:ss") + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + formattedLastSyncTime = dateFormat.format(lastSyncTime); + } else { + formattedLastSyncTime = "No sync time recorded."; + } + } catch (Exception e) { + e.printStackTrace(); + formattedLastSyncTime = "Error retrieving last sync time."; + } + return formattedLastSyncTime; + } + + private String getCurrentTime() { + // 获取当前时间,用作增量同步结束的时间 + // 创建日期格式化对象 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + // 获取当前系统时间 + Date now = new Date(); + + // 格式化当前时间并返回字符串 + return dateFormat.format(now); + } + + private void updateLastSyncTimeToDatabase(String lastSyncTime) { + // 更新最后同步时间到数据库 + try { + // 将字符串转换为 Date 对象 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date = dateFormat.parse(lastSyncTime); + + // 调用 Mapper 方法更新最后同步时间 + syncUserInfoMapper.updateLastSyncTime(date); + + System.out.println("最后同步时间已更新: " + lastSyncTime); + } catch (ParseException e) { + e.printStackTrace(); + System.err.println("时间格式错误: " + lastSyncTime); + } catch (Exception e) { + e.printStackTrace(); + System.err.println("更新数据库时发生错误"); + } + } + // 调用接口 + private String callApi(String apiUrl, Map params) { + // 假设 accessToken 是从某个地方获取的,比如从配置文件、Session 或者前端传递 + String accessToken = getAccessToken(); // 你可以根据自己的需求获取 token + + // 调用 HttpClientUtil 的 doPost 方法 + String response = HttpClientUtil.doPost(apiUrl, params, accessToken); + + // 如果需要,你可以进一步处理响应结果 + if (response != null && !response.isEmpty()) { + // 处理响应数据,比如解析 JSON 或者记录日志 + return response; + } else { + // 错误处理 + System.out.println("API 请求失败,未收到响应"); + return null; + } + } + // 假设这是获取 accessToken 的方法,根据需要修改 + private String getAccessToken() { + String apiUrl =getAPITokenUrl; + String accessToken = null; + + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet getRequest = new HttpGet(apiUrl); + + // 执行请求 + HttpResponse response = client.execute(getRequest); + + // 获取响应内容 + String responseString = EntityUtils.toString(response.getEntity()); + + // 解析响应 JSON + com.alibaba.fastjson.JSONObject responseObject = JSON.parseObject(responseString); + accessToken = responseObject.getString("accessToken"); // 假设返回的是 {"accessToken": "your-token"} + } catch (Exception e) { + System.out.println("获取 accessToken 失败: " + e.getMessage()); + } + + return accessToken; + } + public static void main(String[] args) { + +// String token = getAccessToken(); +// System.out.println("Access Token: " + token); + } + + // 辅助方法:转换字符串为时间戳 + private Timestamp parseTimestamp(String value) { + try { + return value != null && !value.isEmpty() ? Timestamp.valueOf(value) : null; + } catch (IllegalArgumentException e) { +// logger.error("时间转换失败: " + value, e); + return null; + } + } + private Date getDateValue(JSONObject json, String key) { + String value = getStringValue(json, key); + try { + return value != null && !value.isEmpty() ? Timestamp.valueOf(value) : null; + } catch (IllegalArgumentException e) { + return null; // Invalid date format, return null + } + } + // 获取 Long 值,若为空则返回 null + private Long getLongValue(JSONObject json, String key) { + return json.containsKey(key) && json.get(key) != null ? json.getLong(key) : null; + } + + // 获取 String 值,若为空则返回空字符串 + private String getStringValue(JSONObject json, String key) { + return json.containsKey(key) && json.get(key) != null ? json.getStr(key) : ""; + } + + // 获取 Integer 值,若为空则返回 0 + private Integer getIntValue(JSONObject json, String key) { + if (json != null && json.containsKey(key) && json.get(key) != null) { + Object value = json.get(key); + if (value instanceof Integer) { + return (Integer) value; // 如果值是 Integer,直接返回 + } else { + try { + return Integer.parseInt(value.toString()); // 如果是其他类型,转换为 Integer + } catch (NumberFormatException e) { + return 0; // 转换失败,返回 0 + } + } + } + return 0; // 如果 json 为 null,或者 key 不存在,或者值是 JSONObject.NULL,返回 0 + } + + // 获取 BigDecimal 值,若为空则返回 null + private BigDecimal getBigDecimalValue(JSONObject json, String key) { + return json.containsKey(key) && json.get(key) != null ? json.getBigDecimal(key) : null; + } + // 实现类似于 org.json.JSONObject 的 optString 方法 + public String optString(JSONObject json, String key, String defaultValue) { + return json.containsKey(key) && json.get(key) != null ? json.getStr(key) : defaultValue; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/service/UserService.java b/src/main/java/cn/wepact/dfm/training/service/UserService.java new file mode 100644 index 0000000..a4886d1 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/service/UserService.java @@ -0,0 +1,144 @@ +package cn.wepact.dfm.training.service; + + +import cn.wepact.dfm.common.util.Constant; +import cn.wepact.dfm.common.util.GeneralRespBean; +import cn.wepact.dfm.training.dto.entity.TOrg; +import cn.wepact.dfm.training.dto.entity.TUser; +import cn.wepact.dfm.training.dto.entity.TUserPermission; +import cn.wepact.dfm.training.mapper.TOrgMapper; +import cn.wepact.dfm.training.mapper.TUserMapper; +import cn.wepact.dfm.training.mapper.TUserPermissionMapper; +import cn.wepact.dfm.training.utils.Md5Util; +import cn.wepact.dfm.training.utils.TokenUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import javax.transaction.Transactional; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Random; + +@Service +@Slf4j +public class UserService { + @Resource + private TUserMapper tUserMapper; + @Resource + private TUserPermissionMapper tUserPermissionMapper; + @Resource + private TOrgMapper tOrgMapper; + + //登录验证 + public TUser loginAndGetUser(TUser tUser) { + TUser result = new TUser(); + List user = tUserMapper.selectByConditions(tUser); + // 判断用户名和密码是否正确 + //密码用md5加密 + String password = Md5Util.getMD5(tUser.getPassword()); + + if (!CollectionUtils.isEmpty(user) && user.get(0).getPassword().equals(password)) { + result = user.get(0); + //获得权限 + List roles = new ArrayList<>(); + user.forEach(item-> { + TUserPermission roleTemp = new TUserPermission(); + roleTemp.setUserType(item.getUserType()); + roleTemp.setOrgCode(item.getOrgCode()); + roleTemp.setPreType(item.getPreType()); + roles.add(roleTemp); + }); + result.setRoles(roles); + + String token = TokenUtil.createToken(result); +// Map tokenMap = new HashMap<>(); +// tokenMap.put("token", token); +// tokenMap.put("tokenHead", tokenHead);//返回头部信息 +// https://blog.51cto.com/u_13317/9447469 + result.setToken(token); + return result; + } + return null; // 登录失败返回null + } + + //注册账号密码 + @Transactional(rollbackOn = Exception.class) + public Boolean register(TUser user) { + // 判断用户名是否已经存在 + List tUsers = tUserMapper.selectByConditions(user); + if (!CollectionUtils.isEmpty(tUsers)) { + log.info("用户名已经存在"); + return false; + } + // 密码用md5加密 + user.setPassword(Md5Util.getMD5(user.getPassword())); + tUserMapper.insertSelective(user); + TUserPermission tUserPermission = new TUserPermission(); + tUserPermission.setOrgCode(user.getOrgCode()); + tUserPermission.setUserType("1"); + tUserPermission.setUserId(user.getId()); + tUserPermissionMapper.insertSelective(tUserPermission); + return true; + } + + + public List getDeptList() { + return tOrgMapper.selectAll(); + } + + public TUser findByUserNo(String userNo) { + TUser user = tUserMapper.selectByUserNo(userNo); + return user; + } + + // 生成六位随机数字验证码 + public String generateRandomCode() { + Random random = new Random(); + StringBuilder smsCode = new StringBuilder(); + + // 随机生成6位数验证码 + for (int i = 0; i < 6; i++) { + smsCode.append(random.nextInt(10)); // 生成0-9之间的随机数字 + } + + return smsCode.toString(); + } + + public GeneralRespBean updatePwd(TUser tUser) { + GeneralRespBean respBean = new GeneralRespBean<>(); + TUser user = tUserMapper.selectByUserNo(tUser.getUserNo()); + String password = Md5Util.getMD5(tUser.getPassword()); + + if (user != null && user.getPassword().equals(password)) { + if (tUser.getNewPwd().equals(tUser.getConfirmPwd())) { + TUser updateUser = new TUser(); + updateUser.setId(user.getId()); + updateUser.setPassword(Md5Util.getMD5(tUser.getNewPwd())); + updateUser.setUpdatedAt(new Date()); + updateUser.setUpdatedBy(tUser.getUserNo()); + if(tUserMapper.updateByPrimaryKeySelective(updateUser)>0) { + respBean.setMsg(Constant.SUCCESS_MSG); + respBean.setCode(Constant.SUCCESS_CODE); + }else { + respBean.setMsg("修改密码失败!"); + respBean.setCode(Constant.ERROR_CODE); + } + }else { + respBean.setMsg("两次密码输入不一致!"); + respBean.setCode(Constant.ERROR_CODE); + } + }else { + respBean.setMsg("原密码错误!"); + respBean.setCode(Constant.ERROR_CODE); + } + return respBean; + } + + public Boolean cancelPreview(TUser user) { + user.setShowTip("1"); + return tUserMapper.updateByPrimaryKeySelective(user)>1; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/util/AuthorizationUtil.java b/src/main/java/cn/wepact/dfm/training/util/AuthorizationUtil.java new file mode 100644 index 0000000..6afc5b7 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/AuthorizationUtil.java @@ -0,0 +1,194 @@ +//package cn.wepact.dfm.training.util; +// +//import cn.wepact.dfm.account.client.OrgFeignClient; +//import cn.wepact.dfm.account.entity.MoreUser; +//import cn.wepact.dfm.common.util.GeneralRespBean; +//import cn.wepact.dfm.common.util.JsonUtil; +//import cn.wepact.dfm.org.entity.ProfileEmp; +//import cn.wepact.dfm.org.feign.ArchivesClient; +//import com.fasterxml.jackson.core.JsonProcessingException; +//import lombok.extern.slf4j.Slf4j; +//import org.apache.commons.lang.StringUtils; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Component; +//import org.springframework.util.ObjectUtils; +//import org.springframework.web.context.request.RequestContextHolder; +//import org.springframework.web.context.request.ServletRequestAttributes; +// +//import javax.annotation.Resource; +//import javax.servlet.http.HttpServletRequest; +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.List; +//import java.util.Map; +//import java.util.stream.Collectors; +// +//@Component +//@Slf4j +//public class AuthorizationUtil { +// +// +// private static final String REDIS_KEY_USER_INFOR = "user.%s.information"; +// private static final String REDIS_KEY_USERID_INFOR = "userid.%s.information"; +// private static final long REDIS_EXPRIE_SECONDS_USER_INFOR = 60*60; +// +// @Autowired +// private OrgFeignClient orgFeignClient; +// @Resource +// private RedisUtils redisUtils; +// +// @Resource +// private ArchivesClient archivesClient; +// +// private ServletRequestAttributes servletRequestAttributes() { +// return (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); +// } +// +// public HttpServletRequest getRequest() { +// return servletRequestAttributes().getRequest(); +// } +// +// public String getToken() { +// return getRequest().getHeader("token"); +// } +// +// public String getMenuCode() { +// return getRequest().getHeader("menuCode"); +// } +// +// public MoreUser getUser() throws Exception { +// MoreUser user = orgFeignClient.getUserByToken(getToken()).getData(); +// if (ObjectUtils.isEmpty(user)) { +// throw new Exception(); +// } +// return user; +// } +// +// /** +// * 获取登录用户角色 +// * @return +// */ +// public List getUserRoleList() { +// +// List roleList = new ArrayList<>(); +// +// List moreUsers = orgFeignClient.getOrgRoleUserByToken(getToken()).getData(); +// +// if (moreUsers != null && moreUsers.size() > 0) { +// for (MoreUser mo : moreUsers) { +// roleList.add(mo.getRoleCode()); +// } +// } +// +// return roleList; +// } +// +// public String getUserNo() throws Exception { +// MoreUser user = getUser(); +// if (ObjectUtils.isEmpty(user)) { +// throw new Exception(); +// } +// return user.getUserAccount(); +// } +// +// public MoreUser getUserByNo(String userNo){ +// String redisKey = String.format(REDIS_KEY_USER_INFOR, userNo); +// MoreUser user; +// if(redisUtils.exists(redisKey)){ +// user = (MoreUser) redisUtils.getObject(redisKey); +// }else{ +// user = orgFeignClient.getOrgRoleUserInfo(userNo).getData(); +// if(user==null) return null; +// redisUtils.setExpire(redisKey,user,REDIS_EXPRIE_SECONDS_USER_INFOR); +// } +// return user; +// } +// +// public MoreUser getUserByEmployeeNumber(String employeeNumber) { +// log.info("根据员工编号获取员工信息-getUserByEmployeeNumber-start"); +// log.info(" 调用[{}]的[{}]方法,参数:{}", "orgFeignClient", "getOrgRoleUserInfo", employeeNumber); +// try { +// MoreUser user = orgFeignClient.getOrgRoleUserInfo(employeeNumber).getData(); +// log.info(" 返回结果:{}", user); +// return user; +// } catch (Exception e) { +// log.error(" 调用报错:{}", e.fillInStackTrace()); +// } +// return null; +// } +// +// public ProfileEmp getProfileEmp(String employeeNumber) { +// log.info("根据员工编号获取员工信息-getProfileEmp-start"); +// log.info(" 调用[{}]的[{}]方法,参数:{}", "archivesClient", "getProfileEmp", employeeNumber); +// try { +// ProfileEmp user = archivesClient.getProfileEmp(employeeNumber).getData(); +// log.info(" 返回结果:{}", user); +// return user; +// } catch (Exception e) { +// log.error(" 调用报错:{}", e.fillInStackTrace()); +// } +// return null; +// } +// +// /** +// * 根据员工ID获取员工信息 +// * @param userId +// * @return +// */ +// public MoreUser getUserByUserId(Integer userId) { +// return orgFeignClient.getOrgRoleUserInfoById(userId).getData(); +// } +// +// public MoreUser getUserByUserIdFormRedis(Integer userId){ +// String redisKey = String.format(REDIS_KEY_USERID_INFOR, userId); +// MoreUser user; +// if(redisUtils.exists(redisKey)){ +// user = (MoreUser) redisUtils.getObject(redisKey); +// }else{ +// user = orgFeignClient.getOrgRoleUserInfoById(userId).getData(); +// if(user==null) return null; +// redisUtils.setExpire(redisKey,user,REDIS_EXPRIE_SECONDS_USER_INFOR); +// } +// return user; +// } +// +// /** +// * Get user name by userNo, null-safety. +// * @param userNo +// * @return +// */ +// public String getUserNameByNo(String userNo){ +// if(StringUtils.isBlank(userNo)) return ""; +// MoreUser user = this.getUserByNo(userNo); +// if(user==null || user.getUserName()==null) return ""; +// return user.getUserName(); +// } +// +// public List getUserDataRangeAll(String userAccount) { +// log.info("获取登录人有哪些组织的权限"); +// String menuCode = getRequest().getHeader("menuCode"); +// Map paramMap = new HashMap<>(); +// paramMap.put("menuCode",menuCode); +// paramMap.put("userAccount",userAccount); +// GeneralRespBean> respBean = orgFeignClient.getOrgAuthorityByMenuCodeTwo(paramMap); +// if (respBean.getCode().equals("200")){ +// if (respBean.getData()!=null){ +// List orgIdList = respBean.getData() +// .stream().filter(item->item.containsKey("orgId") && item.get("orgId")!=null) +// .map(item->Integer.parseInt(item.get("orgId").toString())).collect(Collectors.toList()); +// if (orgIdList.size()==0){ +// return new ArrayList<>(); +// }else{ +// return orgIdList; +// } +// } +// }else{ +// try { +// log.error("获取权限数据异常:msg{}", JsonUtil.toJson(respBean)); +// } catch (JsonProcessingException e) { +// log.error(e.getMessage(),e); +// } +// } +// return new ArrayList<>(); +// } +//} diff --git a/src/main/java/cn/wepact/dfm/training/util/CodeUtils.java b/src/main/java/cn/wepact/dfm/training/util/CodeUtils.java new file mode 100644 index 0000000..aa6013b --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/CodeUtils.java @@ -0,0 +1,20 @@ +package cn.wepact.dfm.training.util; + +public class CodeUtils { + + /** + * @Description: 处理 like sql参数 + * @param + * @return String 返回类型 + * @author gaod + * @date 2017年11月23日 下午1:51:40 + */ + public static String getLikeQueryStr(String param){ + param = param.replaceAll("~", "~~"); + param = param.replaceAll("_", "~_"); + param = param.replaceAll("%", "~%"); + return "%" +param.trim()+"%"; + } + +} + diff --git a/src/main/java/cn/wepact/dfm/training/util/Constant.java b/src/main/java/cn/wepact/dfm/training/util/Constant.java new file mode 100644 index 0000000..8900c3d --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/Constant.java @@ -0,0 +1,138 @@ +package cn.wepact.dfm.training.util; + +public class Constant { + + public static final String USER_FLAG_UIM = "uim"; + + public static final String USER_DEL_FLAG0 = "0";//未删除 + public static final String USER_DEL_FLAG1 = "1";//删除 + + public static final String USER_STATUS0 = "0";//未启用 + public static final String USER_STATUS1 = "1";//启用 + + //组织层级 + public static final String ORG_LEVEL1 = "1"; + public static final String ORG_LEVEL2 = "2"; + public static final String ORG_LEVEL3 = "3"; + public static final String ORG_LEVEL4 = "4"; + public static final String ORG_LEVEL5 = "5"; + public static final String ORG_LEVEL6 = "6"; + + // org_type + public static final String ORG_TYPE0 = "0"; + public static final String ORG_TYPE1 = "1"; + + public static final String PERSON_TYPE = "PERSON_TYPE"; + public static final String HIGH_EDU_LEVEL = "DFL_HIGH_EDU_LEVEL"; + public static final String DFL_TECH_NAME = "DFL_TECH_NAME"; + public static final String NATIONALITY = "NATIONALITY"; + public static final String CN_HUKOU_TYPE = "CN_HUKOU_TYPE"; + // 在岗状态 + public static final String EMP_CAT = "EMP_CAT"; + + public static final String PERSON_TYPE_1144 = "1144"; + public static final String PERSON_TYPE_1148 = "1148"; + + public static final String OPERATION_LOG_TYPE_CREATE = "EMP_CREATE"; + public static final String OPERATION_LOG_TYPE_UPDATE = "EMP_UPDATE"; + public static final String OPERATION_LOG_STATUS_1 = "1";//成功 + public static final String OPERATION_LOG_STATUS_0 = "0";//失败 + public static final String OPERATION_LOG_STATUS_2 = "2";//队列中 + + + //start 20200404223535 + //测试环境标记url + public static final String isLocation="isLocation"; + //生产环境标记url + public static final String isProduce="isProduce"; + + public static final String USER_STATUS_0 = "0"; + public static final String USER_STATUS_1 = "1"; + + //首次登陆 + public static final String isFirstLogin="1"; + public static final String isFirstLoginNo="no"; + //end + + //用户redis + public static final String USER_KEY="dfmc_login*"; + + //生产环境配置文件标志 + public static final String PROFILE_ENVIRONMENT="prod_new"; + + + // 招聘接口通用状态码 + public static String dFMc(int status){ + String result=""; + switch (status) { + case 0: + result = "成功"; + break; + case -1: + result = "系统繁忙"; + break; + case 40001: + result = "企业CODE必须"; + break; + case 40002: + result = "授权失败"; + break; + case 800001: + result = "参数不能为空"; + break; + case 800002: + result = "企业不存在或已失效"; + break; + case 800003: + result = "用户名或密码错误"; + break; + case 800004: + result = "无对应Id或相关信息"; + break; + case 800005: + result = "参数个数超过限制"; + break; + case 800006: + result = "无权限IP"; + break; + case 800007: + result = "Token不存在或已失效"; + break; + default: + result = "无对应错误码"; + } + return result; + } + public static final String PER_1 = "1";//人事口径 + public static final String PER_2 = "2";//薪酬口径 + public static final String PER_3 = "3";//通用口径 + public static final String PER_4 = "4";//其他口径 + public static final String PER_5 = "5";//招聘口径 + public static final String PER_6 = "6";//电子签口径 + public static final String PER_7 = "7";//档案口径 + public static final String PER_8 = "8";//一体机口径 + public static final String PER_OMP = "omp";//运营口径 + + /** + * 薪资归类 + */ + public static final String SELF_ELE_TYPE_1010 = "1010";//应发明细 + public static final String SELF_ELE_TYPE_1030 = "1030";//个人扣缴 + public static final String SELF_ELE_TYPE_1100 = "1100";//月工资纳税 + public static final String SELF_ELE_TYPE_1060 = "1060";//其他加扣 + public static final String SELF_ELE_TYPE_1050 = "1050";//实发额度 + public static final String SELF_ELE_TYPE_1070 = "1070";//企业缴纳 + public static final String SELF_ELE_TYPE_1020 = "1020";//相关说明 + + public static final String SALARY_TYPE_8 = "shouldGiveList";//饼图 应发 + public static final String SALARY_TYPE_9 = "shouldGiveListData";//饼图 应发 + public static final String SALARY_TYPE_10 = "withholdList";//饼图 个扣 + public static final String SALARY_TYPE_11 = "withholdListData";//饼图 个扣 + + public static final String SELF_ELE_TYPE_1040 = "1040";//应发额度 + public static final String SELF_ELE_TYPE_1080 = "1080";//任期业绩工资 + public static final String SELF_ELE_TYPE_1090 = "1090";//企业缴纳年金应扣税 + public static final String SELF_ELE_TYPE_1110 = "1110";//年度工资清算 + public static final String SELF_ELE_TYPE_1120 = "1120";//专项附加扣除项 + +} diff --git a/src/main/java/cn/wepact/dfm/training/util/CryptoUtil.java b/src/main/java/cn/wepact/dfm/training/util/CryptoUtil.java new file mode 100644 index 0000000..f698bf5 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/CryptoUtil.java @@ -0,0 +1,129 @@ +package cn.wepact.dfm.training.util; + +import java.security.MessageDigest; + +/** + * description 加密解密工具类 + * @author Bright + * */ +public class CryptoUtil { + + /** + * MD5加密(32位大写) + * + * @param src + * @return + */ + public static String md5ByHex(String src) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] b = src.getBytes(); + md.reset(); + md.update(b); + byte[] hash = md.digest(); + String hs = ""; + String stmp = ""; + for (int i = 0; i < hash.length; i++) { + stmp = Integer.toHexString(hash[i] & 0xFF); + if (stmp.length() == 1) + hs = hs + "0" + stmp; + else { + hs = hs + stmp; + } + } + return hs.toUpperCase(); + } catch (Exception e) { + return ""; + } + } + /** + * 密码强度 + * + * @return Z = 字母 S = 数字 T = 特殊字符 + */ + public static String checkPassword(String passwordStr) { + String regexZ = "\\d*"; + String regexS = "[a-zA-Z]+"; + String regexT = "\\W+$"; + String regexZT = "\\D*"; + String regexST = "[\\d\\W]*"; + String regexZS = "\\w*"; + String regexZST = "[\\w\\W]*"; + + if (passwordStr.matches(regexZ)) { + return "1";//弱 + } + if (passwordStr.matches(regexS)) { + return "1";//弱 + } + if (passwordStr.matches(regexT)) { + return "1";//弱 + } + if (passwordStr.matches(regexZT)) { + return "2";//中 + } + if (passwordStr.matches(regexST)) { + return "2";//中 + } + if (passwordStr.matches(regexZS)) { + return "2";//中 + } + if (passwordStr.matches(regexZST)) { + return "3";//强 + } + return passwordStr; + } + + /** + * @author lcp + * + * 强密码202203241721 + */ + public static String strongPassword(){ + String[] pswdStr = {"qwertyuiopasdfghjklzxcvbnm", "QWERTYUIOPASDFGHJKLZXCVBNM", "0123456789","!@#$%*+"}; + + int pswdLen = 8; + String pswd = " "; + char[] chs = new char[pswdLen]; + for (int i = 0; i < pswdStr.length; i++) { + + int idx = (int) (Math.random() * pswdStr[i].length()); + chs[i] = pswdStr[i].charAt(idx); + + } + + for (int i = pswdStr.length; i < pswdLen; i++) { + + int arrIdx = (int) (Math.random() * pswdStr.length); + int strIdx = (int) (Math.random() * pswdStr[arrIdx].length()); + + chs[i] = pswdStr[arrIdx].charAt(strIdx); + } + + for (int i = 0; i < 1000; i++) { + int idx1 = (int) (Math.random() * chs.length); + int idx2 = (int) (Math.random() * chs.length); + + if (idx1 == idx2) { + continue; + } + + char tempChar = chs[idx1]; + chs[idx1] = chs[idx2]; + chs[idx2] = tempChar; + } + + pswd = new String(chs); + return pswd; + } + + + +// public static void main(String[] args) { +// String passd = "a2E5@fd%@"; +// System.out.println(CryptoUtil.checkPassword(passd)); +// String strongPassword =CryptoUtil.strongPassword(); +// System.out.println("生成的强密码......................"+strongPassword); +// +// } +} diff --git a/src/main/java/cn/wepact/dfm/training/util/DESUtils.java b/src/main/java/cn/wepact/dfm/training/util/DESUtils.java new file mode 100644 index 0000000..037f1f9 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/DESUtils.java @@ -0,0 +1,451 @@ +package cn.wepact.dfm.training.util; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.codec.digest.DigestUtils; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.Security; +import java.util.Arrays; + + +public class DESUtils { + /** + * 编码加密工具类 + */ + + + public DESUtils() { + } + + + /** + * Base64 编码 + */ + public static final Base64 B64 = new Base64(); + /** + * 安全的随机数源 + */ + public static final SecureRandom RANDOM = new SecureRandom(); + /** + * SHA-1加密 + */ + public static MessageDigest SHA_1 = null; + + + static { + init(); + } + + + /** + * 初始化 + */ + public static void init() { + try { + SHA_1 = MessageDigest.getInstance("SHA-1"); + } catch (NoSuchAlgorithmException e) { + throw new IllegalStateException(e); + } + } + + + /** + * SHA-1加密 + * + * @param str 明文 + * @return 密文 + */ + public static String sha1(String str) { + return new String(B64.encode(SHA_1.digest(str.getBytes()))); + } + + + /** + * SHA-1加密(Url安全) + * + * @param str 明文 + * @return 密文 + */ + public static String sha1Url(String str) { + return new String(Base64.encodeBase64URLSafeString(SHA_1.digest(str.getBytes()))); + } + + + /** + * Base64编码 + * + * @param bs byte数组 + * @return 编码后的byte数组 + */ + public static byte[] b64Encode(byte[] bs) { + return B64.encode(bs); + } + + + /** + * Base64编码字符串 + * + * @param str 需要编码的字符串 + * @return 编码后的字符串 + */ + public static String b64Encode(String str) { + if (null != str) { + return new String(B64.encode(str.getBytes())); + } + return null; + } + + + /** + * Base64编码字符串(Url安全) + * + * @param str 需要编码的字符串 + * @return 编码后的字符串 + */ + public static String b64Url(String str) { + if (null != str) { + return Base64.encodeBase64URLSafeString(str.getBytes()); + } + return null; + } + + + /** + * Base64解码 + * + * @param bs byte数组 + * @return 解码后的byte数组 + */ + public static byte[] b64Decode(byte[] bs) { + return B64.decode(bs); + } + + + /** + * Base64解码字符串 + * + * @param str 需要解码的字符串 + * @return 解码后的字符串 + */ + public static String b64Decode(String str) { + if (null != str) { + byte[] bs = B64.decode(str.getBytes()); + if (null != bs) { + return new String(bs); + } + } + return null; + } + + + /** + * 生成32位MD5密文 + * + *
+     * org.apache.commons.codec.digest.DigestUtils
+     * 
+ * + * @param str 明文 + * @return 密文 + */ + public static String md5(String str) { + if (null != str) { + return DigestUtils.md5Hex(str); + } + return null; + } + + + /** + * DES加密算法 + */ + public static final String DES_ALGORITHM = "DESede"; // 可用 DES,DESede,Blowfish + /** + * DES默认加密 + */ + public static Cipher DES_CIPHER_ENC = null; + /** + * DES默认解密 + */ + public static Cipher DES_CIPHER_DEC = null; + /** + * 密钥 + */ + public static String privateKey ="abcdsxyzhkj12345"; + + + static { + // 添加JCE算法 + Security.addProvider(new com.sun.crypto.provider.SunJCE()); + // 初始化默认DES加密 + try { + // 密钥 + SecretKey desKey = new SecretKeySpec(new byte[]{0x11, 0x22, 0x4F, 0x58, (byte) 0x88, 0x10, 0x40, 0x38, + 0x28, 0x25, 0x79, 0x51, (byte) 0xCB, (byte) 0xDD, 0x55, 0x66, 0x77, 0x29, 0x74, (byte) 0x98, 0x30, + 0x40, 0x36, (byte) 0xE2}, DES_ALGORITHM); + // 初始化默认加密 + DES_CIPHER_ENC = Cipher.getInstance(DES_ALGORITHM); + DES_CIPHER_ENC.init(Cipher.ENCRYPT_MODE, desKey, RANDOM); + // 初始化默认解密 + DES_CIPHER_DEC = Cipher.getInstance(DES_ALGORITHM); + DES_CIPHER_DEC.init(Cipher.DECRYPT_MODE, desKey, RANDOM); + } catch (Exception e) { + System.err.println("DES默认加密解密初始化失败:" + e.getMessage()); + throw new RuntimeException("DES默认加密解密初始化失败:" + e.getMessage(), e); + } + } + + + /** + * DES加密(默认密钥) + * + * @param str 需要加密的明文 + * @return 加密后的密文(base64编码字符串) + */ + public static String desEncryp(String str) { + return desEncryp(str, false); + } + + + /** + * DES加密(默认密钥) + * + * @param str 需要加密的明文 + * @return 加密后的密文(base64编码字符串, Url安全) + */ + public static String desEncrypUrl(String str) { + return desEncryp(str, true); + } + + + /** + * DES加密(默认密钥) + * + * @param str 需要加密的明文 + * @param urlSafety 密文是否需要Url安全 + * @return 加密后的密文(str为null返回null) + */ + public static String desEncryp(String str, boolean urlSafety) { + if (null != str) { + try { + byte[] bytes = DES_CIPHER_ENC.doFinal(str.getBytes("UTF-8"));// 加密 + if (urlSafety) { + return Base64.encodeBase64URLSafeString(bytes); + } else { + return new String(B64.encode(bytes)); + } + } catch (Exception e) { + System.err.println("DES加密失败, 密文:" + str + ", 错误:" + e.getMessage()); + } + } + return null; + } + + + /** + * DES解密(默认密钥) + * + * @param str 需要解密的密文(base64编码字符串) + * @return 解密后的明文 + */ + public static String desDecrypt(String str) { + if (null != str) { + try { + byte[] bytes = DES_CIPHER_DEC.doFinal(B64.decode(str));// 解密 + return new String(bytes, "UTF-8"); + } catch (Exception e) { + System.err.println("DES解密失败, 密文:" + str + ", 错误:" + e.getMessage()); + } + } + return null; + } + + + /** + * DES加密 + * + * @param str 需要加密的明文 + * @param key 密钥(长度小于24字节自动补足,大于24取前24字节) + * @return 加密后的密文(base64编码字符串) + */ + public static String desEncryp(String str, String key) { + return desEncryp(str, key, false); + } + + + /** + * DES加密 + * + * @param str 需要加密的明文 + * @param key 密钥(长度小于24字节自动补足,大于24取前24字节) + * @return 加密后的密文(base64编码字符串, Url安全) + */ + public static String desEncrypUrl(String str, String key) { + return desEncryp(str, key, true); + } + + + /** + * DES加密 + * + * @param str 需要加密的明文 + * @param key 密钥(长度小于24字节自动补足,大于24取前24字节) + * @param urlSafety 密文是否需要Url安全 + * @return 加密后的密文(str / key为null返回null) + */ + public static String desEncryp(String str, String key, boolean urlSafety) { + if (null != str && null != key) { + try { + Cipher c = Cipher.getInstance(DES_ALGORITHM); + c.init(Cipher.ENCRYPT_MODE, desKey(key), RANDOM); + // 加密 + byte[] bytes = c.doFinal(str.getBytes("UTF-8"));// 加密 + // 返回b64处理后的字符串 + if (urlSafety) { + return Base64.encodeBase64URLSafeString(bytes); + } else { + return new String(B64.encode(bytes)); + } + } catch (Exception e) { + System.err.println("DES加密失败, 密文:" + str + ", key:" + key + ", 错误:" + e.getMessage()); + } + } + return null; + } + + + /** + * DES解密 + * + * @param str 需要解密的密文(base64编码字符串) + * @param key 密钥(长度小于24字节自动补足,大于24取前24字节) + * @return 解密后的明文 + */ + public static String desDecrypt(String str, String key) { + if (null != str && null != key) { + try { + Cipher c = Cipher.getInstance(DES_ALGORITHM); + c.init(Cipher.DECRYPT_MODE, desKey(key), RANDOM); + byte[] bytes = c.doFinal(B64.decode(str)); + return new String(bytes, "UTF-8"); + } catch (BadPaddingException e) { + System.err.println("DES解密失败, 密文:" + str + ", key:" + key + ", 错误:" + e.getMessage()); + } catch (Exception e) { + System.err.println("DES解密失败, 密文:" + str + ", key:" + key + ", 错误:" + e.getMessage()); + } + } + return null; + } + + + /** + * DES密钥 + */ + public static SecretKey desKey(String key) { + byte[] bs = key.getBytes(); + if (bs.length != 24) { + bs = Arrays.copyOf(bs, 24);// 处理数组长度为24 + } + return new SecretKeySpec(bs, DES_ALGORITHM); + } + + + /** + * AES加密算法 + */ + public static final String AES_ALGORITHM = "AES"; + + + /** + * AES加密 + * + * @param str 需要加密的明文 + * @param key 密钥 + * @return 加密后的密文(str / key为null返回null) + */ + public static String aesEncryp(String str, String key) { + return aesEncryp(str, key, false); + } + + + /** + * AES加密 + * + * @param str 需要加密的明文 + * @param key 密钥 + * @param urlSafety 密文是否需要Url安全 + * @return 加密后的密文(str / key为null返回null) + */ + public static String aesEncryp(String str, String key, boolean urlSafety) { + if (null != str && null != key) { + try { + Cipher c = Cipher.getInstance("AES/ECB/PKCS5Padding"); + c.init(Cipher.ENCRYPT_MODE, aesKey(key), RANDOM); + byte[] bytes = c.doFinal(str.getBytes("UTF-8"));// 加密 + if (urlSafety) { + return Base64.encodeBase64URLSafeString(bytes); + } else { + return new String(B64.encode(bytes)); + } + } catch (Exception e) { + System.err.println("AES加密失败, 密文:" + str + ", key:" + key + ", 错误:" + e.getMessage()); + } + } + return null; + } + + + /** + * AES解密 + * + * @param str 需要解密的密文(base64编码字符串) + * @param key 密钥 + * @return 解密后的明文 + */ + public static String aesDecrypt(String str, String key) { + if (null != str && null != key) { + try { + Cipher c = Cipher.getInstance("AES/ECB/PKCS5Padding"); + c.init(Cipher.DECRYPT_MODE, aesKey(key), RANDOM); + return new String(c.doFinal(B64.decode(str)), "UTF-8");// 解密 + } catch (BadPaddingException e) { + System.err.println("AES解密失败, 密文:" + str + ", key:" + key + ", 错误:" + e.getMessage()); + } catch (Exception e) { + System.err.println("AES解密失败, 密文:" + str + ", key:" + key + ", 错误:" + e.getMessage()); + } + } + return null; + } + + + /** + * AES密钥 + */ + public static SecretKeySpec aesKey(String key) { + byte[] bs = key.getBytes(); + if (bs.length != 16) { + bs = Arrays.copyOf(bs, 16);// 处理数组长度为16 + } + return new SecretKeySpec(bs, AES_ALGORITHM); + } + + + public static void main(String[] args) { + /** AES */ + System.out.println(aesKey("123").getAlgorithm()); + System.out.println(aesEncryp("8007508", privateKey)); + System.out.println(aesEncryp("8007508", privateKey, true)); + + + System.err.println(aesDecrypt("g5QD2gS3jPc3bdyXQCJcKQ==", privateKey)); + System.err.println(aesDecrypt("g5QD2gS3jPc3bdyXQCJcKQ", privateKey)); + } +} + + diff --git a/src/main/java/cn/wepact/dfm/training/util/DateHelper.java b/src/main/java/cn/wepact/dfm/training/util/DateHelper.java new file mode 100644 index 0000000..afbf288 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/DateHelper.java @@ -0,0 +1,608 @@ +package cn.wepact.dfm.training.util; + +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +public class DateHelper { + + public static final String HH_MM_SS_BEGIN = " 00:00:00"; + public static final String HH_MM_SS_END = " 23:59:59"; + // 年-月-日 + public static final String YYYY_MM_DD = "yyyy-MM-dd"; + + // 年-月-日 + public static final String YYYYMMDD = "yyyyMMdd"; + + public static final String YYYYMM = "yyyyMM"; + // 年-月-日 时:分:秒 + public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; + // 年月日 时分秒 + public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; + // 年月日 时分 + public static final String YYYYMMDDHHMM = "yyyyMMddHHmm"; + // 年月日 时分秒毫秒 + public static final String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmsssss"; + // 年 + public static final String YYYY = "yyyy"; + // 月 + public static final String MM = "MM"; + + public static final String SIEBEL_CPBHEC = "MM/dd/yyyy HH:mm:ss"; + public static final String US_FORMAT = "EEE MMM dd HH:mm:ss z yyyy"; + + public static final String YYYYMMDD_FORMAT = "yyyy年MM月dd日"; + + /** + * Example: getSystemDate(); + *

+ * return Date + * + * @return + */ + public static Date getSystemDate() { + + return new Date(); + } + + /** + * Example: getSystemDate("yyyyMMdd"); + *

+ * return 20110820 + * + * @param format + * @return + */ + public static String getSystemDateString(String format) { + + return formatDate(new Date(), format); + } + + /** + * Example: getCurrentTime(); + *

+ * return 20110820101010222 + * + * @param + * @return + */ + public static String getCurrentTime() { + + return getSystemDateString(YYYYMMDDHHMMSSSSS); + } + + /** + * Example: formatDate(date, "yyyyMMdd"); + *

+ * date = 2011/01/02, return 20110102 + * + * @param date + * @param format + * @return + */ + public static String formatDate(Date date, String format) { + + final SimpleDateFormat sdf = new SimpleDateFormat(format); + + if (date == null) + return null; + + return sdf.format(date); + } + + /** + * Example: format("2011/01/10", "yyyy/MM/dd", "yyyy.MM.dd"); + *

+ * return 2011.01.10 + * + * @param dateString + * @param srcFormat + * @param targetFormat + * @return + */ + public static String formatDate(String dateString, String srcFormat, String targetFormat) { + + final SimpleDateFormat sdf = new SimpleDateFormat(srcFormat); + + Date date = null; + try { + if (dateString != null && !"".equals(dateString.trim())) + date = sdf.parse(dateString); + } catch (ParseException e) { + } + + return formatDate(date, targetFormat); + } + + public static Date getDateFromStr(String dateString, String srcFormat) { + + final SimpleDateFormat sdf = new SimpleDateFormat(srcFormat); + + Date date = null; + try { + if (dateString != null && !"".equals(dateString.trim())) + date = sdf.parse(dateString); + } catch (ParseException e) { + } + + return date; + } + + public static boolean isBetweenDate(String beginDateString, String endDateString, String middleDateString, + String srcFormat) { + Date begin = getDateFromStr(beginDateString, srcFormat); + Date end = getDateFromStr(endDateString, srcFormat); + Date middle = getDateFromStr(middleDateString, srcFormat); + long btime = begin.getTime(); + long etime = end.getTime(); + long mtime = middle.getTime(); + + if (mtime >= btime && mtime <= etime) { + return true; + } + return false; + } + + ; + + /** + * Name: Description: 通过时间的毫秒数据计算 对应的时:分:秒 + * + * @param lms + * @return + * @author gaodan + * @date 2015年12月1日 下午3:22:27 + */ + @SuppressWarnings("deprecation") + public static String getTimeFormat(long time) { + StringBuffer dateStr = new StringBuffer(""); + Date date = new Date(time); + dateStr.append(date.getHours()).append(":").append(date.getMinutes()).append(":").append(date.getSeconds()); + return dateStr.toString(); + } + + /** + * Name: Description: + * + * @param y + * @param z + * @return + * @author gaodan + * @date 2015年12月2日 上午8:51:52 + */ + public static float getTimeCompletePercent(long y, long z) { + String baifenbi = "";// 接受百分比的值 + double baiy = y * 1.0; + double baiz = z * 1.0; + double fen = (baiy / baiz); + DecimalFormat df1 = new DecimalFormat("0.00"); + baifenbi = df1.format(fen); + float percent = Float.parseFloat(baifenbi) * 100; + return percent >= 100 ? 100 : percent; + } + + /** + * Name: Description: 将 0:3:12.56 时间格式转成毫秒 + * + * @param time + * @return + * @author gaodan + * @date 2015年12月2日 上午8:55:48 + */ + public static long getTimeMS(String time) { + String[] timeArray = time.split(":"); + long totalTime = 0; + for (int i = 0; i < timeArray.length; i++) { + String str = timeArray[i]; + if (i == 0) { + // 处理小时转毫秒 + long hour = Long.parseLong(str); + totalTime += hour * 60 * 60 * 1000; + } else if (i == 1) { + // 处理分钟转毫秒 + long minute = Long.parseLong(str); + totalTime += minute * 60 * 1000; + } else if (i == 2) { + // 处理秒转毫秒 + double second = Double.parseDouble(str); + totalTime += second * 1000; + } + + } + return totalTime; + } + + /** + * Name: Description: 将 0:3:12.56 时间格式转成秒 + * + * @param time + * @return + * @author gaodan + * @date 2015年12月2日 下午1:34:59 + */ + public static long getTimeSecond(String time) { + String[] timeArray = time.split(":"); + long totalTime = 0; + for (int i = 0; i < timeArray.length; i++) { + String str = timeArray[i]; + if (i == 0) { + // 处理小时转毫秒 + long hour = Long.parseLong(str); + totalTime += hour * 60 * 60; + } else if (i == 1) { + // 处理分钟转毫秒 + long minute = Long.parseLong(str); + totalTime += minute * 60; + } else if (i == 2) { + // 处理秒转毫秒 + double second = Double.parseDouble(str); + totalTime += second; + } + + } + return totalTime; + } + + /** + * Name: Description: 将分钟数转换成毫秒数 + * + * @param minute + * @return + * @author gaodan + * @date 2015年12月2日 上午9:08:33 + */ + public static long getMSFromMinute(int minute) { + return minute * 60 * 1000; + + } + + /** + * Name: Description: 计算两个时间相差的毫秒数 + * + * @param beginTime + * @param endTime + * @return + * @author gaodan + * @date 2015年12月3日 上午10:09:07 + */ + public static long geTimeDifference(Date beginTime, Date endTime) { + return (endTime.getTime() - beginTime.getTime()); + } + + /** + * Name: Description: 将毫秒转换成 0000:00:00格式字符串 + * + * @param time + * @return + * @author gaodan + * @date 2015年12月3日 上午10:13:36 + */ + public static String getMSTimeFormat(long ms) { + StringBuffer timeStr = new StringBuffer(); + int ss = 1000; + int mi = ss * 60; + int hh = mi * 60; + int dd = hh * 24; + long day = ms / dd; + long hour = (ms - day * dd) / hh; + long minute = (ms - day * dd - hour * hh) / mi; + long second = (ms - day * dd - hour * hh - minute * mi) / ss; + long milliSecond = ms - day * dd - hour * hh - minute * mi - second * ss; + // String strDay = day < 10 ? "0" + day : "" + day; //天 + hour += (day * 24); + String strHour = hour < 10 ? "000" + hour : "00" + hour;// 小时 + String strMinute = minute < 10 ? "0" + minute : "" + minute;// 分钟 + String strSecond = second < 10 ? "0" + second : "" + second;// 秒 + String strMilliSecond = milliSecond < 10 ? "0" + milliSecond : "" + milliSecond;// 毫秒 + strMilliSecond = milliSecond < 100 ? "0" + strMilliSecond : "" + strMilliSecond; + timeStr.append(strHour).append(":").append(strMinute).append(":").append(strSecond); + return timeStr.toString(); + } + + /** + * Name: Description: 将字符串"Thu Aug 27 11:16:20 CST 2015" 格式日期转换成Date类型 + * + * @param dateTime + * @return + * @throws Exception + * @author gaodan + * @date 2015年12月15日 下午3:08:37 + */ + public static Date parseDateFromUS(String dateTime) throws Exception { + SimpleDateFormat sdf = new SimpleDateFormat(US_FORMAT, Locale.US); + Date date = sdf.parse(dateTime); + return date; + } + // public static void main(String[] args) { + // System.out.println(getMSTimeFormat(25*60*60*1000+20*60*1000+5*1000)); + // } + + /** + * Name: Description: 判断当前时间是否在指定的时间范围内 + * + * @param startTime + * @param endTime + * @return + * @author gaodan + * @date 2015年12月16日 上午11:24:05 + */ + public static boolean isTimeAvailable(Date startTime, Date endTime) { + Date current = new Date(); + if (startTime.getTime() <= current.getTime() && current.getTime() <= endTime.getTime()) { + return true; + } + return false; + } + + /** + * Name: Description: 获取指定日期的第二天 + * + * @param currentDay + * @return + * @author gaodan + * @date 2015年12月31日 上午10:06:31 + */ + @SuppressWarnings("static-access") + public static Date getNextDay(Date currentDay, int days) { + Calendar calendar = new GregorianCalendar(); + calendar.setTime(currentDay); + calendar.add(calendar.DATE, days); + Date nextDate = calendar.getTime(); + return nextDate; + } + + public static String transferLongToDate(String dateFormat, Long millSec) { + + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); + + Date date = new Date(millSec); + + return sdf.format(date); + + } + + /** + * @Description: 获取指定格式的当前日期 + * @param + * @return Date 返回类型 + * @author gaod + * @throws Exception + * @date 2017年11月23日 下午2:01:56 + */ + public static Date getFormatDate(Date dateTime,String format) throws Exception { + SimpleDateFormat formatter = new SimpleDateFormat(format); + Date dateFormat = formatter.parse(formatter.format(dateTime)); + return dateFormat; + } + /** + * @Description: 判断两个日期是否是同一天 + * @param + * @return boolean 返回类型 + * @author gaod + * @date 2017年11月29日 上午10:39:14 + */ + public static boolean isTheSameDay(Date date1,Date date2){ + if(date1 != null && date2 != null) { + Calendar cal1 = Calendar.getInstance(); + cal1.setTime(date1); + Calendar cal2 = Calendar.getInstance(); + cal2.setTime(date2); + return isSameDay(cal1, cal2); + } else { + return false; + } + } + public static boolean isSameDay(Calendar cal1, Calendar cal2) { + if(cal1 != null && cal2 != null) { + return cal1.get(0) == cal2.get(0) && cal1.get(1) == cal2.get(1) && cal1.get(6) == cal2.get(6); + } else { + return false; + } + } + /** + * @Description: 获取当前时间前N个月 + * @param + * @return List 返回类型 + * @author gaod + * @date 2017年12月8日 上午11:07:50 + */ + public static List getBeforeMonth(int n){ + List monthList=new ArrayList(); + //获取当前时间的前6个月 + for(int i=n;i>0;i--){ + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.MONTH,-i); + Date date02 = calendar.getTime(); + monthList.add(formatDate(date02,YYYYMMDD).substring(0,6)); + } + return monthList; + } + public static boolean isValidDate(String dateStr,String format) { + //String str = "2007-01-02"; + DateFormat formatter = new SimpleDateFormat(format); + try{ + Date date = (Date)formatter.parse(dateStr); + return dateStr.equals(formatter.format(date)); + }catch(Exception e){ + return false; + } + } + + public static int differentDaysByMillisecond(Date date1,Date date2){ + int days = (int) ((date2.getTime() - date1.getTime()) / (1000*3600*24)); + return days; + } + public static Date getDateFromTimeStr(String timeStr){ + DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd"); + Date date = null; + try { + date = format1.parse(timeStr); + } catch (ParseException e) { + e.printStackTrace(); + } + return date; + } + /** + * 每个月1号统计的上个月一号到上个月最后一天日期集合 上个月, + * 不是1号(从2号开始)统计当月1号到昨天的日期集合 这个月 + * @return + */ + public static String getCycleDate(){ + Date now=new Date(); + String cycleDateStr=""; + //判断当前日期是否是每月的1号 + if(judgeDate(now,"01")){ + //获取上个月的年月格式 + cycleDateStr=formatDate(getLastMonthFirstDay(),YYYY_MM_DD); + }else{ + //不是一号 获取这个月的年月格式 + cycleDateStr=formatDate(getCurrentMonthFirstDay(),YYYY_MM_DD); + + } + return cycleDateStr.substring(0, 7); + } +/** + * @param date要判断的日期 + * @param day 指定的日 01 02 10 ...31 + * @return + */ +public static boolean judgeDate(Date date,String day){ + String dateStr=formatDate(date,YYYYMMDD); + String dayInDate=dateStr.substring(6); + if(dayInDate.equals(day)){ + return true; + } + return false; + } +/** + * @param date要判断的日期 + * @param moth 指定的月份 01 02 10 ...31 + * @return + */ +public static boolean judgeMonth(Date date,String month){ + String dateStr=formatDate(date,YYYYMMDD); + String dayInDate=dateStr.substring(4,6); + if(dayInDate.equals(month)){ + return true; + } + return false; + } +/** + * 获取当月第一天 + * @return + */ +public static Date getCurrentMonthFirstDay(){ + Calendar c = Calendar.getInstance(); + c.add(Calendar.MONTH, 0); + c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天 + return c.getTime(); +} +public static String getCurrentMonthStr(){ + Date date= getCurrentMonthFirstDay(); + return formatDate(date,YYYY_MM_DD).substring(0, 7); +} +public static String getLastMonthStr(){ + Date date= getLastMonthFirstDay(); + return formatDate(date,YYYY_MM_DD).substring(0, 7); +} +/** + * 获取当月最后一天 + * @return + */ +public static Date getCurrentMonthLastDay(){ + Calendar ca = Calendar.getInstance(); + ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH)); + return ca.getTime(); +} +/** + * 获取上个月月第一天 + * @return + */ +public static Date getLastMonthFirstDay(){ + Calendar c = Calendar.getInstance(); + c.add(Calendar.MONTH, -1); + c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天 + return c.getTime(); +} +/** + * 获取上个月最后一天 + * @return + */ +public static Date getLastMonthLastDay(){ + Calendar c = Calendar.getInstance(); + c.set(Calendar.DAY_OF_MONTH, 0); + return c.getTime(); +} +/** + * 获取两个日期之间所有的日期集合 + * @param d1 开始日期 + * @param d2 结束日期 + * @return + */ +public static List getDates(Date d1,Date d2){ + List dates = new ArrayList(); + Calendar dd = Calendar.getInstance();//定义日期实例 + dd.setTime(d1);//设置日期起始时间 + while(dd.getTime().getTime()<=d2.getTime()){//判断是否到结束日期 + SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD); + String str = sdf.format(dd.getTime()); + dates.add(str); + dd.add(Calendar.DAY_OF_MONTH, 1);//进行当前日期月份加1 + } + return dates; +} +public static Date getYesterday(){ + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE,-1); + return calendar.getTime(); +} + +public static Date getThisWeekMonday(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + // 获得当前日期是一个星期的第几天 + int dayWeek = cal.get(Calendar.DAY_OF_WEEK); + if (1 == dayWeek) { + cal.add(Calendar.DAY_OF_MONTH, -1); + } + // 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一 + cal.setFirstDayOfWeek(Calendar.MONDAY); + // 获得当前日期是一个星期的第几天 + int day = cal.get(Calendar.DAY_OF_WEEK); + // 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值 + cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - day); + return cal.getTime(); + + + + +} +public static Date geLastWeekMonday(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(getThisWeekMonday(date)); + cal.add(Calendar.DATE, -7); + return cal.getTime(); +} + /** + * + * 根据日期 找到对应日期的 星期 + */ + public static int getDayOfWeekByDate(String date) { + int dayOfweek = 0; + try { + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + Calendar cal = Calendar.getInstance(); // 获得一个日历 + Date datet = null; + datet = myFormatter.parse(date); + cal.setTime(datet); + int w = cal.get(Calendar.DAY_OF_WEEK) -1; // 指示一个星期中的某天。 + dayOfweek = w; + return dayOfweek; + } catch (Exception e) { + System.out.println(e.getMessage()); + } + return dayOfweek; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/util/HttpApiUtils.java b/src/main/java/cn/wepact/dfm/training/util/HttpApiUtils.java new file mode 100644 index 0000000..d02a360 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/HttpApiUtils.java @@ -0,0 +1,164 @@ +package cn.wepact.dfm.training.util; + +//import cn.wepact.dfm.log.api.client.LogServiceApiClient; +//import cn.wepact.dfm.log.api.model.InterfaceLog; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import org.apache.http.*; + +import org.apache.http.client.methods.*; + +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; + +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + + + + +@Component +public class HttpApiUtils { + + + private static Logger logger = LoggerFactory.getLogger(HttpApiUtils.class); + + @Value("${api.getPcToken.url}") + private String getPcTokenUrl; + @Value("${api.user}") + private String userAccount; + @Value("${api.password}") + private String password; + public String postRequestApi(String url, String data,int retryTimes) { + if(retryTimes==0){ + retryTimes=3; + } + int retryCount = 10; + String jsonStr=null; + CloseableHttpResponse response =null; + CloseableHttpClient httpclient = HttpClients.custom().build(); + while (true) { + try { + HttpPost httpost = new HttpPost(url); + httpost.setHeader("Content-Type", "application/json"); + if(url.indexOf("image_url")>0){ + httpost.setHeader("Content-Type", "application/x-www-form-urlencoded"); + System.out.println("image========"); + } + httpost.setEntity(new StringEntity(data, "UTF-8")); + response = httpclient.execute(httpost); + HttpEntity entity = response.getEntity(); + jsonStr= EntityUtils.toString(entity); + EntityUtils.consume(entity); + break; + } catch (Exception e) { + e.printStackTrace(); + if (retryCount >= retryTimes) { + logger.error("url="+url+"调用发生异常:"+e.getMessage()+"重试次数达到上限"); + break; + } + retryCount++; + try { + Thread.sleep(100); + } catch (Exception e1) { + e1.printStackTrace(); + } + logger.error("url="+url+"调用发生异常:"+e.getMessage()+" 正在进行第"+retryCount+"次重试"); + continue; + }finally{ + + if(response!=null){ + try { + response.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + } + logger.info("此次调用HTTP结果:"+jsonStr); + return jsonStr; + } + + + public String getRequestApi(String url, String employeeNo, int retryTimes) throws Exception { + if (retryTimes == 0) { + retryTimes = 3; // 默认重试次数 + } + + int retryCount = 0; + String jsonStr = null; + CloseableHttpResponse response = null; + CloseableHttpClient httpclient = HttpClients.custom().build(); + + // 构建带有路径参数的 URL + String fullUrl = url.replace("{employeeNo}", employeeNo); + // 确保 URL 是有效的 + try { + new java.net.URI(fullUrl); // 检查 URI 格式 + } catch (java.net.URISyntaxException e) { + throw new IllegalArgumentException("Invalid URL: " + fullUrl, e); + } + while (true) { + try { + HttpGet httpget = new HttpGet(fullUrl); + url=getPcTokenUrl; + + // 创建请求数据 + String jsonData = "{\n" + + " \"userAccount\": \"" + userAccount + "\",\n" + + " \"password\": \"" + password + "\"\n" + + "}"; + + // 调用 postRequest 方法 + String postResponse = this.postRequestApi(url, jsonData, 3); + + // 打印响应 + System.out.println("postResponse: " + postResponse); + // 解析 JSO + // 解析 JSON + JsonObject jsonObject = JsonParser.parseString(postResponse).getAsJsonObject(); + + // 提取 token + String token = jsonObject.getAsJsonObject("data").get("token").getAsString(); +// String authorization = SignUtil.makeBasicAuth(); // 假设这是一个生成授权头的方法 + httpget.addHeader("Content-Type", "application/json"); + httpget.addHeader("token", token); + + response = httpclient.execute(httpget); + HttpEntity entity = response.getEntity(); + jsonStr = EntityUtils.toString(entity, "utf-8"); + EntityUtils.consume(entity); + break; // 如果成功,退出循环 + } catch (Exception e) { + e.printStackTrace(); + if (retryCount >= retryTimes) { + break; // 超过重试次数,退出 + } + retryCount++; + try { + Thread.sleep(100); // 等待后重试 + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + continue; // 继续重试 + } finally { + if (response != null) { + try { + response.close(); // 关闭响应 + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } + + return jsonStr; // 返回 JSON 字符串 + } +} diff --git a/src/main/java/cn/wepact/dfm/training/util/HttpClientUtil.java b/src/main/java/cn/wepact/dfm/training/util/HttpClientUtil.java new file mode 100644 index 0000000..6e949bf --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/HttpClientUtil.java @@ -0,0 +1,77 @@ +package cn.wepact.dfm.training.util; + +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; + +import java.util.Map; + +@Slf4j +public class HttpClientUtil { + + public static String doPost(String pathUrl, Map dataMap, String accessToken) { + String result = null; + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpPost post = new HttpPost(pathUrl); + post.setHeader("Content-Type", "application/json;charset=utf-8"); + + if (accessToken != null && !accessToken.isEmpty()) { + post.setHeader("Authorization", accessToken); + } + + String dataStr = JSON.toJSONString(dataMap); + StringEntity entity = new StringEntity(dataStr, "UTF-8"); + post.setEntity(entity); + + try (CloseableHttpResponse response = client.execute(post)) { + result = EntityUtils.toString(response.getEntity(), "UTF-8"); + // Log response for debugging + log.debug("POST Response from {}: {}", pathUrl, result); + } + } catch (Exception e) { + e.printStackTrace(); + log.error("POST request failed - URL: {}, Data: {}, Error: {}", pathUrl, dataMap, e.getMessage(), e); + } + return result; + } + + public static String doGet(String pathUrl, Map dataMap, String accessToken) { + String result = null; + try (CloseableHttpClient client = HttpClients.createDefault()) { + StringBuilder urlBuilder = new StringBuilder(pathUrl); + if (dataMap != null && !dataMap.isEmpty()) { + urlBuilder.append(pathUrl.contains("?") ? "&" : "?"); + dataMap.forEach((key, value) -> { + if (value != null) { + urlBuilder.append(key).append("=").append(value).append("&"); + } + }); + urlBuilder.deleteCharAt(urlBuilder.length() - 1); + } + + HttpGet get = new HttpGet(urlBuilder.toString()); + get.setHeader("Content-Type", "application/json;charset=utf-8"); + + if (accessToken != null && !accessToken.isEmpty()) { + get.setHeader("Authorization", accessToken); + } + + try (CloseableHttpResponse response = client.execute(get)) { + result = EntityUtils.toString(response.getEntity(), "UTF-8"); + // Log response for debugging + log.debug("GET Response from {}: {}", pathUrl, result); + } + } catch (Exception e) { + e.printStackTrace(); + log.error("GET request failed - URL: {}, Parameters: {}, Error: {}", pathUrl, dataMap, e.getMessage(), e); + } + return result; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/util/IpUtil.java b/src/main/java/cn/wepact/dfm/training/util/IpUtil.java new file mode 100644 index 0000000..314107c --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/IpUtil.java @@ -0,0 +1,33 @@ +package cn.wepact.dfm.training.util; + +import javax.servlet.http.HttpServletRequest; + +import static org.apache.http.util.TextUtils.isEmpty; + +public class IpUtil { + public static String getIp(HttpServletRequest request) { + String ip = request.getHeader("x-forwarded-for"); + if (isEmpty(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (isEmpty(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (isEmpty(ip)) { + ip = request.getHeader("HTTP_CLIENT_IP"); + } + if (isEmpty(ip)) { + ip = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (isEmpty(ip)) { + ip = request.getHeader("X-Real-IP"); + } + if (isEmpty(ip)) { + ip = request.getRemoteAddr(); + } + if (!isEmpty(ip) && ip.contains(",")) { + ip = ip.substring(0, ip.indexOf(",")); + } + return ip; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/util/ListUtil.java b/src/main/java/cn/wepact/dfm/training/util/ListUtil.java new file mode 100644 index 0000000..9c2da30 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/ListUtil.java @@ -0,0 +1,33 @@ +package cn.wepact.dfm.training.util; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author chenglin.shi@jgdt.com + * @version 1.0 2023/8/3 + */ +public class ListUtil { + + /** + * 将集合按len数量分成若干个list + * @param list + * @param len 每个集合的数量 + * @return + */ + public List> splitList(List list, int len) { + if (list == null || list.size() == 0 || len < 1) { + return null; + } + List> result = new ArrayList<>(); + + int size = list.size(); + int count = (size + len - 1) / len; + + for (int i = 0; i < count; i++) { + List subList = list.subList(i * len, ((i + 1) * len > size ? size : len * (i + 1))); + result.add(subList); + } + return result; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/util/PageUtil.java b/src/main/java/cn/wepact/dfm/training/util/PageUtil.java new file mode 100644 index 0000000..c3e4211 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/PageUtil.java @@ -0,0 +1,50 @@ +package cn.wepact.dfm.training.util; + +import java.util.List; + +/** + * 自定义List分页工具 + * @author hanwl + */ +public class PageUtil { + + /** + * 开始分页 + * @param list + * @param pageNum 页码 + * @param pageSize 每页多少条数据 + * @return + */ + public static List startPage(List list, Integer pageNum, + Integer pageSize) { + if (list == null) { + return null; + } + if (list.size() == 0) { + return null; + } + + Integer count = list.size(); // 记录总数 + Integer pageCount = 0; // 页数 + if (count % pageSize == 0) { + pageCount = count / pageSize; + } else { + pageCount = count / pageSize + 1; + } + + int fromIndex = 0; // 开始索引 + int toIndex = 0; // 结束索引 + + if (pageNum != pageCount) { + fromIndex = (pageNum - 1) * pageSize; + toIndex = fromIndex + pageSize; + } else { + fromIndex = (pageNum - 1) * pageSize; + toIndex = count; + } + + List pageList = list.subList(fromIndex, toIndex); + + return pageList; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/util/PinYinUtil.java b/src/main/java/cn/wepact/dfm/training/util/PinYinUtil.java new file mode 100644 index 0000000..1a450ac --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/PinYinUtil.java @@ -0,0 +1,97 @@ +package cn.wepact.dfm.training.util; + +import net.sourceforge.pinyin4j.PinyinHelper; +import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; +import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; +import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; +import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType; +import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; +import org.springframework.stereotype.Component; + +/** + * 拼音工具类 + * + * @author lsf + */ +@Component +public class PinYinUtil { + /** + * 将字符串中的中文转化为拼音,其他字符不变 + * + * @param inputString + * @return + */ + public static String getPingYin(String inputString) { + HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat(); + format.setCaseType(HanyuPinyinCaseType.LOWERCASE); + format.setToneType(HanyuPinyinToneType.WITHOUT_TONE); + format.setVCharType(HanyuPinyinVCharType.WITH_V); + + char[] input = inputString.trim().toCharArray(); + String output = ""; + + try { + for (int i = 0; i < input.length; i++) { + if (Character.toString(input[i]).matches("[\\u4E00-\\u9FA5]+")) { + String[] temp = PinyinHelper.toHanyuPinyinStringArray(input[i], format); + output += temp[0]; + } else + output += Character.toString(input[i]); + } + } catch (BadHanyuPinyinOutputFormatCombination e) { + e.printStackTrace(); + } + return output; + } + /** + * 获取汉字串拼音首字母,英文字符不变 + * @param chinese 汉字串 + * @return 汉语拼音首字母 + */ + public static String getFirstSpell(String chinese) { + StringBuffer pybf = new StringBuffer(); + char[] arr = chinese.toCharArray(); + HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat(); + defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE); + defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); + for (int i = 0; i < arr.length; i++) { + if (arr[i] > 128) { + try { + String[] temp = PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat); + if (temp != null) { + pybf.append(temp[0].charAt(0)); + } + } catch (BadHanyuPinyinOutputFormatCombination e) { + e.printStackTrace(); + } + } else { + pybf.append(arr[i]); + } + } + return pybf.toString().replaceAll("\\W", "").trim(); + } + /** + * 获取汉字串拼音,英文字符不变 + * @param chinese 汉字串 + * @return 汉语拼音 + */ + public static String getFullSpell(String chinese) { + StringBuffer pybf = new StringBuffer(); + char[] arr = chinese.toCharArray(); + HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat(); + defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE); + defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); + for (int i = 0; i < arr.length; i++) { + if (arr[i] > 128) { + try { + pybf.append(PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat)[0]); + } catch (BadHanyuPinyinOutputFormatCombination e) { + e.printStackTrace(); + } + } else { + pybf.append(arr[i]); + } + } + return pybf.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/cn/wepact/dfm/training/util/RedisUtils.java b/src/main/java/cn/wepact/dfm/training/util/RedisUtils.java new file mode 100644 index 0000000..a2c6163 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/RedisUtils.java @@ -0,0 +1,703 @@ +package cn.wepact.dfm.training.util; + +import org.springframework.data.geo.*; +import org.springframework.data.redis.connection.RedisGeoCommands; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +@Component +public class RedisUtils { + + + @Resource + private RedisTemplate redisTemplate; + + @Resource + private StringRedisTemplate stringRedisTemplate; + + /** + * 清空 redis 缓存 (慎用) + * + * @return 结果 + */ + public String flushDB() { + stringRedisTemplate.getConnectionFactory().getConnection().flushDb(); + return "ok"; + } + + + /* Key(键) */ + + /** + * 单个删除 + * + * @param key 键 + * @return 是否删除成功 + */ + public Boolean delete(String key) { + return stringRedisTemplate.delete(key); + } + + /** + * 批量删除 + * + * @param keys 键集合 + * @return 删除成功的个数 + */ + public Long deleteMulti(Set keys) { + return stringRedisTemplate.delete(keys); + } + + /** + * 检查是否存在改key值 + * + * @param key 键 + * @return 结果 + */ + public Boolean exists(final String key) { + return stringRedisTemplate.hasKey(key); + } + + /** + * 修改键名 + * + * @param oldKey 旧键 + * @param newKey 新键 + */ + public void rename(String oldKey, String newKey) { + stringRedisTemplate.rename(oldKey, newKey); + } + + /** + * 获取所有key + * + * @param patternKey 模糊key + * @return 结果 + */ + public Collection keys(String patternKey) { + return stringRedisTemplate.keys(patternKey); + } + + /** + * 获取指定key的有效时间,秒 + * + * @param key 键 + * @return 有效时间 + */ + public Long getExpireSeconds(String key) { + return stringRedisTemplate.getExpire(key); + } + + /** + * 获取指定key的有效时间,分 + * + * @param key 键 + * @return 有效时间 + */ + public Long getExpireMinutes(String key) { + return stringRedisTemplate.getExpire(key, TimeUnit.MINUTES); + } + + /** + * 获取指定key的有效时间,小时 + * + * @param key 键 + * @return 有效时间 + */ + public Long getExpireHours(String key) { + return stringRedisTemplate.getExpire(key, TimeUnit.HOURS); + } + + /** + * 获取指定key的有效时间,天 + * + * @param key 键 + * @return 有效时间 + */ + public Long getExpireDays(String key) { + return stringRedisTemplate.getExpire(key, TimeUnit.DAYS); + } + + + /* string(字符串) */ + + + /** + * 添加key和value + * + * @param key 键 + * @param value 值 + */ + public void setString(String key, String value) { + stringRedisTemplate.opsForValue().set(key, value); + } + + public void setObject(String key, Object value) { + redisTemplate.opsForValue().set(key, value); + } + + /** + * 根据key值,查询value值 + * + * @param key 键 + * @return 值 + */ + public String getString(final String key) { + return stringRedisTemplate.opsForValue().get(key); + } + + public Object getObject(final String key) { + return redisTemplate.opsForValue().get(key); + } + + /** + * 如果key值不存在,则存储 + * + * @param key 键 + * @param value 值 + */ + public void setIfAbsent(String key, String value) { + stringRedisTemplate.opsForValue().setIfAbsent(key, value); + } + + public void setIfAbsent(String key, Object value) { + redisTemplate.opsForValue().setIfAbsent(key, value); + } + + /** + * 在原有value值后面追加value + * + * @param key 键 + * @param value 值 + * @return 追加后value的长度 + */ + public Integer append(String key, String value) { + return stringRedisTemplate.opsForValue().append(key, value); + } + + /** + * 添加key和value时候,设定失效时长,单位秒 + * + * @param key 键 + * @param value 值 + * @param expireSeconds 失效时长,秒 + */ + public void setExpire(String key, String value, Long expireSeconds) { + stringRedisTemplate.opsForValue().set(key, value, expireSeconds, TimeUnit.SECONDS); + } + + public void setExpire(String key, Object value, Long expireSeconds) { + redisTemplate.opsForValue().set(key, value, expireSeconds, TimeUnit.SECONDS); + } + + /** + * 批量添加key和value + * + * @param map 键值集合 + */ + public void multiSetString(Map map) { + stringRedisTemplate.opsForValue().multiSet(map); + } + + public void multiSetObject(Map map) { + redisTemplate.opsForValue().multiSet(map); + } + + /** + * 批量查询value + * + * @param keys 键集合 + * @return 值集合 + */ + public List multiGetString(Set keys) { + return stringRedisTemplate.opsForValue().multiGet(keys); + } + + public List multiGetObject(Set keys) { + return redisTemplate.opsForValue().multiGet(keys); + } + + /** + * 获取value同时,更新value值 + * + * @param key 键 + * @param value 新值 + * @return 旧值 + */ + public String getAndSet(String key, String value) { + return stringRedisTemplate.opsForValue().getAndSet(key, value); + } + + public Object getAndSet(String key, Object value) { + return redisTemplate.opsForValue().getAndSet(key, value); + } + + /** + * 根据strIndex和endIndex,截取value值 + * + * @param key 键 + * @param strIndex 开始角标 + * @param endIndex 结束角标,-1为获取所有的value值 + * @return 结果 + */ + public String rangeOfString(String key, long strIndex, long endIndex) { + return stringRedisTemplate.opsForValue().get(key, strIndex, endIndex); + } + + /** + * 获取所有符合patternKey键的值 + * + * @param patternKey 模糊键 + * @return 所有值 + */ + public List getStringValues(String patternKey) { + return multiGetString((Set) keys(patternKey)); + } + + public List getObjectValues(String patternKey) { + return multiGetObject((Set) keys(patternKey)); + } + + + /* List(列表) */ + + /** + * 写入list,入栈 + * + * @param key 键 + * @param value 值 + * @return 入栈之后list的长度 + */ + public Long pushElementOfList(final String key, Object... value) { + + return redisTemplate.opsForList().rightPushAll(key, value); + } + + /** + * 左侧写入list,入栈 + * + * @param key 键 + * @param value 值 + * @return 入栈之后list的长度 + */ + public Long leftPushElementOfList(final String key, Object value) { + return redisTemplate.opsForList().leftPush(key, value); + } + + /** + * 右侧写入list,入栈 + * + * @param key 键 + * @param value 值 + * @return 入栈之后list的长度 + */ + public Long rightPushElementOfList(final String key, Object value) { + return redisTemplate.opsForList().rightPush(key, value); + } + + /** + * 左侧获取list一条数据,出栈 + * + * @param key 键 + * @return 值 + */ + public Object leftPopElementOfList(final String key) { + return redisTemplate.opsForList().leftPop(key); + } + + /** + * 右侧获取list一条数据,出栈 + * + * @param key 键 + * @return 值 + */ + public Object rightPopElementOfList(final String key) { + return redisTemplate.opsForList().rightPop(key); + } + + /** + * 修改list中指定element值 + * + * @param key 键 + * @param index list角标 + * @param value 值 + */ + public void setElementOfList(final String key, long index, Object value) { + redisTemplate.opsForList().set(key, index, value); + } + + /** + * 获取list中指定element值 + * + * @param key 键 + * @param index list角标 + * @return 值 + */ + public Object indexElementOfList(final String key, long index) { + return redisTemplate.opsForList().index(key, index); + } + + /** + * 获取指定key的list + * + * @param key 键 + * @return 列表 + */ + public List allElementsOfList(final String key) { + return rangeElementsOfList(key, 0L, -1L); + } + + /** + * 获取指定key的,指定范围的list + * + * @param key 键 + * @param strIndex 开始角标 + * @param endIndex 结束角标 + * @return 指定范围的list + */ + public List rangeElementsOfList(final String key, long strIndex, long endIndex) { + return redisTemplate.opsForList().range(key, strIndex, endIndex); + } + + /** + * 删除list中指定element值 + * + * @param key 键 + * @param index list角标 + * @param value 值 + * @return 删除成功的个数 + */ + public Long removeElementOfList(final String key, long index, Object value) { + return redisTemplate.opsForList().remove(key, index, value); + } + + /** + * 获取list的大小 + * + * @param key 键 + * @return list的大小 + */ + public Long sizeOfList(final String key) { + return redisTemplate.opsForList().size(key); + } + + + /* Hash(哈希表) */ + + /** + * 写入一条hash数据 + * + * @param key 键 + * @param hashKey hash键 + * @param hashValue hash值 + */ + public void putEelementOfHash(final String key, Object hashKey, Object hashValue) { + stringRedisTemplate.opsForHash().put(key, hashKey, hashValue); + } + + /** + * 获取一条hash数据 + * + * @param key 键 + * @param hashKey hash键 + * @return hash值 + */ + public Object getElementOfHash(final String key, Object hashKey) { + return stringRedisTemplate.opsForHash().get(key, hashKey); + } + + /** + * 删除hash数据 + * + * @param key 键 + * @param hashKey hash键 + * @return 删除数据的数量 + */ + public Long deleteEelementOfHash(final String key, Object... hashKey) { + return stringRedisTemplate.opsForHash().delete(key, hashKey); + } + + /** + * 获取hash的大小 + * + * @param key 键 + * @return hash大小 + */ + public Long sizeOfHash(final String key) { + return stringRedisTemplate.opsForHash().size(key); + } + + + /* Set(集合) */ + + /** + * 添加元素到set + * + * @param key 键 + * @param value set中的值 + * @return 添加成功的条数 + */ + public Long addElementOfSet(final String key, Object... value) { + return redisTemplate.opsForSet().add(key, value); + } + + /** + * 从set中获取所有元素 + * + * @param key 键 + * @return 所有set值 + */ + public Set allElementsOfSet(final String key) { + return redisTemplate.opsForSet().members(key); + } + + /** + * 从set中获取一条 (出栈) + * + * @param key 键 + * @return 获取一条 + */ + public Object popElementOfSet(final String key) { + return redisTemplate.opsForSet().pop(key); + } + + /** + * 判断元素是否为set中的元素 + * + * @param key 键 + * @param value 元素值 + * @return 结果 + */ + public Boolean isElementOfSet(final String key, Object value) { + return redisTemplate.opsForSet().isMember(key, value); + } + + /** + * 从set中移除某元素 + * + * @param key 键 + * @param value list中的值 + * @return 成功移除元素的个数 + */ + public Long removeElementOfSet(final String key, Object... value) { + return redisTemplate.opsForSet().remove(key, value); + } + + /** + * 获取set的元素个数 + * + * @param key 键 + * @return set的元素个数 + */ + public Long sizeOfSet(final String key) { + return redisTemplate.opsForSet().size(key); + } + + /* SortedSet(有序集合) */ + + /** + * 添加元素到sortedSet + * + * @param key 键 + * @param value 元素 + * @param score 排序值 + * @return 是否添加成功 + */ + public Boolean addElementOfZSet(final String key, Object value, double score) { + return redisTemplate.opsForZSet().add(key, value, score); + } + + /** + * 从sortedSet中移除元素 + * + * @param key 键 + * @param value 被移除的元素 + * @return 成功移除元素的个数 + */ + public Long removeElementOfZSet(final String key, Object... value) { + return redisTemplate.opsForZSet().remove(key, value); + } + + /** + * 截取sortedSet中的元素 (按照score正序排序) + * + * @param key 键 + * @param strIndex 开始的角标 + * @param endIndex 结束的角标 + * @return 截取的元素 + */ + public Set rangeElementOfZSet(final String key, long strIndex, long endIndex) { + return redisTemplate.opsForZSet().range(key, strIndex, endIndex); + } + + /** + * 截取sortedSet中的元素 (按照score倒叙排序) + * + * @param key 键 + * @param strIndex 开始的角标 + * @param endIndex 结束的角标 + * @return 截取的元素 + */ + public Set reverseRangeElementOfZSet(final String key, long strIndex, long endIndex) { + return redisTemplate.opsForZSet().reverseRange(key, strIndex, endIndex); + } + + + + /* GEO(地理位置) */ + + /** + * 将给定的空间元素(纬度、经度、名字)添加到指定的键里面 + * + * @param key 键 + * @param x 经度 + * @param y 纬度 + * @param member 名字 + * @return 成功添加的个数 + */ + public Long geoAdd(final String key, double x, double y, String member) { + Point point = new Point(x, y); + return geoAdd(key, point, member); + } + + /** + * 将给定的空间元素(纬度、经度、名字)添加到指定的键里面 + * + * @param key 键 + * @param point 经度,纬度封装对象 + * @param member 名字 + * @return 成功添加的个数 + */ + public Long geoAdd(final String key, Point point, String member) { + return redisTemplate.opsForGeo().add(key, point, member); + } + + /** + * 将给定的空间元素(纬度、经度、名字)添加到指定的键里面 + * + * @param key 键 + * @param geoLocation 经纬度,名字的封装对象 + * @return 成功添加的个数 + */ + public Long geoAdd(final String key, RedisGeoCommands.GeoLocation geoLocation) { + return stringRedisTemplate.opsForGeo().add(key, geoLocation); + } + + /** + * 从键里面返回所有给定位置元素的位置(经度和纬度) + * + * @param key 键 + * @param members 名称 + * @return 经纬度封装对象列表 + */ + public List geoPos(final String key, String... members) { + return stringRedisTemplate.opsForGeo().position(key, members); + } + + /** + * 返回两个给定位置之间的距离。 + * + * @param key 键 + * @param member1 给定位置1 + * @param member2 给定位置2 + * @return 距离 + */ + public Distance geoDist(final String key, String member1, String member2) { + return stringRedisTemplate.opsForGeo().distance(key, member1, member2); + } + + /** + * 返回两个给定位置之间的距离。 + * + * @param key 键 + * @param member1 给定位置1 + * @param member2 给定位置2 + * @param metric 长度单位 + * @return 单位 + */ + public Distance geoDist(final String key, String member1, String member2, Metric metric) { + return stringRedisTemplate.opsForGeo().distance(key, member1, member2, metric); + } + + /** + * 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 + * + * @param key 键 + * @param circle 给定的经纬度,以及半径 + * @return 所有符合距离的位置元素 + */ + public GeoResults> geoRadius(final String key, Circle circle) { + return stringRedisTemplate.opsForGeo().radius(key, circle); + } + + /** + * 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 + * + * @param key 键 + * @param circle 给定的经纬度,以及半径 + * @param geoRadiusCommandArgs 额外命令 + * @return 所有符合距离的位置元素 + */ + public GeoResults> geoRadius(final String key, + Circle circle, + RedisGeoCommands.GeoRadiusCommandArgs geoRadiusCommandArgs) { + return stringRedisTemplate.opsForGeo().radius(key, circle, geoRadiusCommandArgs); + } + + /** + * 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 + * + * @param key 键 + * @param member 存储的位置名称 + * @param radius 半径,单位默认米 + * @return 所有符合距离的位置元素 + */ + public GeoResults> geoRadius(final String key, String member, double radius) { + return stringRedisTemplate.opsForGeo().radius(key, member, radius); + } + + /** + * 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 + * + * @param key 键 + * @param member 存储的位置名称 + * @param distance 半径 + * @return 所有符合距离的位置元素 + */ + public GeoResults> geoRadius(final String key, String member, Distance distance) { + return stringRedisTemplate.opsForGeo().radius(key, member, distance); + } + + /** + * 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 + * + * @param key 键 + * @param member 存储的位置名称 + * @param distance 半径 + * @return 所有符合距离的位置元素 + */ + public GeoResults> geoRadius(final String key, String member, + Distance distance, + RedisGeoCommands.GeoRadiusCommandArgs geoRadiusCommandArgs) { + return stringRedisTemplate.opsForGeo().radius(key, member, distance, geoRadiusCommandArgs); + } + + /** + * 返回一个或多个位置元素的 Geohash 表示。 + * + * @param key 键 + * @param members 存储的位置名称 + * @return geohash 值 + */ + public List geoHash(final String key, String... members) { + return stringRedisTemplate.opsForGeo().hash(key, members); + } +} diff --git a/src/main/java/cn/wepact/dfm/training/util/SHA256.java b/src/main/java/cn/wepact/dfm/training/util/SHA256.java new file mode 100644 index 0000000..51e08ba --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/SHA256.java @@ -0,0 +1,50 @@ +package cn.wepact.dfm.training.util; + +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * Created by liuye on 2019/7/30. + */ +public class SHA256 { + /** +   * 利用java原生的摘要实现SHA256加密 +   * @param str 加密后的报文 +   * @return +   */ + public static String getSHA256StrJava(String str){ + MessageDigest messageDigest; + String encodeStr = ""; + try { + messageDigest = MessageDigest.getInstance("SHA-256"); + messageDigest.update(str.getBytes("UTF-8")); + encodeStr = byte2Hex(messageDigest.digest()); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return encodeStr; + } + + /** +   * 将byte转为16进制 +   * @param bytes +   * @return +   */ + private static String byte2Hex(byte[] bytes){ + StringBuffer stringBuffer = new StringBuffer(); + String temp = null; + for (int i=0;i getStrList(String inputString, int length) { + int size = inputString.length() / length; + if (inputString.length() % length != 0) { + size += 1; + } + return getStrList(inputString, length, size); + } + + /** + * 把原始字符串分割成指定长度的字符串列表 + * + * @param inputString + * 原始字符串 + * @param length + * 指定长度 + * @param size + * 指定列表大小 + * @return + */ + public static List getStrList(String inputString, int length, + int size) { + List list = new ArrayList(); + int count = 0; + for (int index = 0; index < size; index++) { + String childStr; + int f = index * length; + int t = (index + 1) * length; + childStr = substring(inputString , f+ count , t); + if(null != childStr && childStr.length()>0){ + count = count + check(childStr," "); + if(index>0) f = f + count; + t = t + count; + childStr = substring(inputString , f , t); + list.add(childStr); + } + } + return list; + } + + /** + * 分割字符串,如果开始位置大于字符串长度,返回空 + * + * @param str + * 原始字符串 + * @param f + * 开始位置 + * @param t + * 结束位置 + * @return + */ + public static String substring(String str, int f, int t) { + if (f > str.length()) + return null; + if (t > str.length()) { + return str.substring(f, str.length()); + } else { + return str.substring(f, t); + } + } + + private static int check(String str, String word) { + int count = 0; + for (int i = 0; i < str.length(); i++) { + if(str.charAt(i) == word.charAt(0)){ + count++; + } + } + return count; + } + +} + diff --git a/src/main/java/cn/wepact/dfm/training/util/UUID16.java b/src/main/java/cn/wepact/dfm/training/util/UUID16.java new file mode 100644 index 0000000..d35379a --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/UUID16.java @@ -0,0 +1,34 @@ +package cn.wepact.dfm.training.util; + +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.stereotype.Component; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; + +/** + * Created by daiYu + */ +@Component +@RefreshScope +public class UUID16 { + + public static String get16UUID(){ + // 1.开头两位,标识业务代码或机器代码(可变参数) + String machineId = "50"; + // 2.中间四位整数,标识日期 + SimpleDateFormat sdf = new SimpleDateFormat("MMdd"); + String dayTime = sdf.format(new Date()); + // 3.生成uuid的hashCode值 + int hashCode = UUID.randomUUID().toString().hashCode(); + // 4.可能为负数 + if(hashCode < 0){ + hashCode = -hashCode; + } + // 5.算法处理: 0-代表前面补充0; 10-代表长度为10; d-代表参数为正数型 + String value = machineId + dayTime + String.format("%010d", hashCode); + return value; + } + +} diff --git a/src/main/java/cn/wepact/dfm/training/util/WorkingDayUtil.java b/src/main/java/cn/wepact/dfm/training/util/WorkingDayUtil.java new file mode 100644 index 0000000..b168a77 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/util/WorkingDayUtil.java @@ -0,0 +1,170 @@ +package cn.wepact.dfm.training.util; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +public class WorkingDayUtil { + /** + * 获取指定日期到现在一共经过了几个工作日 + * + * @param date 指定日期 + * @param days 工作日数组 + * @return 中间的工作日天数 + */ + public static long getWorkingDays(Date date, String[] days) { + long days1 = getDays(date); + return getWorkingDays(days1, days); + } + + public static long getWorkingDays(Date date, List days) { + long days1 = getDays(date); + return getWorkingDays(days1, days); + } + + /** + * 获取经过了几个工作日 + * + * @param dayCount 天数 + * @param days 工作日数组 + * @return 工作日 + */ + private static long getWorkingDays(long dayCount, String[] days) { + List strings = Arrays.asList(days); + return getWorkingDays(dayCount, strings); + } + + private static long getWorkingDays(long dayCount, List days) { + Date date = new Date(); + List dateList = new ArrayList<>(); + for (int i = 0; i < dayCount; i++) { + Calendar instance = Calendar.getInstance(); + instance.setTime(date); + instance.add(Calendar.DAY_OF_MONTH, -i - 1); + Date time = instance.getTime(); + dateList.add(new SimpleDateFormat("yyyy-MM-dd").format(time)); + } + dateList = dateList.stream().filter(days::contains).collect(Collectors.toList()); + return dateList.size(); + } + + /** + * 获取指定日期距今几天,不足一天舍去 + * + * @param startDate 指定日期 + * @return 天数 + */ + private static long getDays(Date startDate) { + return (System.currentTimeMillis() + 10000 - startDate.getTime()) / 1000 / 60 / 60 / 24; + } + + /** + * 自定义日期 + * + * @param year 年 + * @param month 月 + * @param day 日 + * @return 日期 + */ + private static Date getCustomDate(int year, int month, int day) { + return getCustomDate(year, month, day, 0, 0, 0); + } + + /** + * 自定义日期 + * + * @param year 年 + * @param month 月 + * @param day 日 + * @param hour 时 + * @param minute 分 + * @param second 秒 + * @return 日期 + */ + private static Date getCustomDate(int year, int month, int day, int hour, int minute, int second) { + Calendar instance = Calendar.getInstance(); + instance.set(year, month - 1, day, hour, minute, second); + return instance.getTime(); + } + + /** + * 获取几个工作日之前的时间点 + * + * @param days 相隔天数 + * @param day 工作日列表 + * @return 时间点 + */ + public static Date getWorkingDayAfterNow(List days, int day,String today) throws ParseException { + if (days.size() < day + 1) { + return null; + } + Date current = new Date(); + List newList = new ArrayList<>(); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + current = dateFormat.parse(today); + for (String s : days) { + if (newList.size() > day) { + break; + } + Date parse = dateFormat.parse(s); + if (parse.getTime() < current.getTime()) { + continue; + } + newList.add(s); + } + if (newList.size() < day + 1) { + return null; + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String s = newList.get(day); + + Calendar instance = Calendar.getInstance(); + instance.setTime(new Date()); + int hour = instance.get(Calendar.HOUR_OF_DAY); + int minute = instance.get(Calendar.MINUTE); + int second = instance.get(Calendar.SECOND); + s += " " + hour + ":" + minute + ":" + second; + return sdf.parse(s); + } + + /** + * 获取几个工作日之前的时间点 + * + * @param days 相隔天数 + * @param day 工作日列表 + * @return 时间点 + */ + public static Date getWorkingDayBeforeNow(List days, int day) throws ParseException { + if (days.size() < day + 1) { + return null; + } + Date current = new Date(); + List newList = new ArrayList<>(); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + for (String s : days) { + if (newList.size() > day) { + break; + } + Date parse = dateFormat.parse(s); + if (parse.getTime() > current.getTime()) { + continue; + } + newList.add(s); + } + if (newList.size() < day + 1) { + return null; + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String s = newList.get(day); + + Calendar instance = Calendar.getInstance(); + instance.setTime(current); + int hour = instance.get(Calendar.HOUR_OF_DAY); + int minute = instance.get(Calendar.MINUTE); + int second = instance.get(Calendar.SECOND); + s += " " + hour + ":" + minute + ":" + second; + return sdf.parse(s); + } +} diff --git a/src/main/java/cn/wepact/dfm/training/utils/EmailUtil.java b/src/main/java/cn/wepact/dfm/training/utils/EmailUtil.java new file mode 100644 index 0000000..2379814 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/utils/EmailUtil.java @@ -0,0 +1,74 @@ +package cn.wepact.dfm.training.utils; + +import lombok.Data; + +import javax.mail.*; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import java.util.Properties; + +public class EmailUtil { + private static final String SMTP_SERVER = "mails.dfmc.com.cn"; + private static final String SMTP_PORT = "25"; + private static final String FROM_ADDRESS = "dfmc-hrssc@dfmc.com.cn"; + private static final String TO_ADDRESS = "zhangsc@dfmc.com.cn"; + private static final String PASSWORD = "Kw4a9zpXHnrUag2d"; + + @Data + public static class Email{ + private String to; + private String subject; + private String content; + } + + public static void sendMail(Email email) { + // 发件人的邮箱账号 + String from = FROM_ADDRESS; + // 发件人的邮箱密码 + String password = PASSWORD; + // 收件人的邮箱账号 + String to = email.getTo(); + // 获取系统属性 + Properties properties = System.getProperties(); + // 设置邮件服务器 + properties.put("mail.debug", "true"); + properties.put("mail.smtp.host", SMTP_SERVER); + properties.put("mail.smtp.port", SMTP_PORT); + properties.put("mail.smtp.auth", "true"); + // 创建验证器对象 + Authenticator authenticator = new Authenticator() { + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(from, password); + } + }; + // 创建会话对象 + Session session = Session.getDefaultInstance(properties, authenticator); + try { + // 创建默认的MimeMessage对象 + Message message = new MimeMessage(session); + // 设置发件人 + message.setFrom(new InternetAddress(from)); + // 设置收件人 + message.setRecipient(Message.RecipientType.TO, new InternetAddress(to)); + // 设置邮件主题 + message.setSubject(email.getSubject()); + // 设置邮件内容 + message.setText(email.getContent()); + // 发送邮件 + Transport.send(message); + System.out.println("邮件发送成功"); + } catch (MessagingException mex) { + mex.printStackTrace(); + } + } + + public static void main(String[] args) { + Email email = new Email(); + email.setTo(TO_ADDRESS); + email.setSubject("测试邮件"); + email.setContent("测试邮件内容"); + sendMail(email); + } + + +} diff --git a/src/main/java/cn/wepact/dfm/training/utils/FileUtil.java b/src/main/java/cn/wepact/dfm/training/utils/FileUtil.java new file mode 100644 index 0000000..56598ec --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/utils/FileUtil.java @@ -0,0 +1,29 @@ +package cn.wepact.dfm.training.utils; + +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; + +public class FileUtil { + public static String saveFile(MultipartFile file, String filePath) { + // 检查文件是否为空 + if (file.isEmpty()) { + return null; + } + try { + // 创建目标文件对象 + File dest = new File(filePath); + // 检查目标文件的父目录是否存在,如果不存在则创建 + if (!dest.getParentFile().exists()) { + dest.getParentFile().mkdirs(); + } + // 将上传的文件保存到目标文件 + file.transferTo(dest); + return filePath; + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } +} diff --git a/src/main/java/cn/wepact/dfm/training/utils/Md5Util.java b/src/main/java/cn/wepact/dfm/training/utils/Md5Util.java new file mode 100644 index 0000000..4f3e409 --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/utils/Md5Util.java @@ -0,0 +1,31 @@ +package cn.wepact.dfm.training.utils; + + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class Md5Util { + + public static String getMD5(String str) { + if (str == null) { + return null; + } + try { + MessageDigest md5 = MessageDigest.getInstance("MD5"); + byte[] bytes = md5.digest(str.getBytes()); + StringBuilder sb = new StringBuilder(); + for (byte b : bytes) { + int val = b & 0xff; + String hex = Integer.toHexString(val); + if (hex.length() == 1) { + sb.append("0"); + } + sb.append(hex); + } + return sb.toString(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/src/main/java/cn/wepact/dfm/training/utils/TokenUtil.java b/src/main/java/cn/wepact/dfm/training/utils/TokenUtil.java new file mode 100644 index 0000000..2f98ddd --- /dev/null +++ b/src/main/java/cn/wepact/dfm/training/utils/TokenUtil.java @@ -0,0 +1,59 @@ +package cn.wepact.dfm.training.utils; + +import cn.wepact.dfm.training.dto.entity.TUser; +import com.alibaba.fastjson.JSON; +import com.auth0.jwt.JWT; +import com.auth0.jwt.algorithms.Algorithm; +import com.auth0.jwt.exceptions.JWTVerificationException; +import com.auth0.jwt.interfaces.Claim; +import com.auth0.jwt.interfaces.DecodedJWT; +import com.auth0.jwt.interfaces.JWTVerifier; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.Map; + +@Component +public class TokenUtil { + private static final String SECRET = "your-secret"; // 密钥,生产环境应保持安全 + + public static String createToken(TUser user) { + try { + Date expireDate = new Date(System.currentTimeMillis() + 3600 * 1000); // 设置Token过期时间 + return JWT.create() + .withIssuer("auth0") + .withClaim("userInfo", JSON.toJSONString(user)) + .withExpiresAt(expireDate) + .sign(Algorithm.HMAC256(SECRET)); + } catch (Exception exception) { + throw new RuntimeException("Token创建失败"); + } + } + + public static Map verifyToken(String token) { + try { + JWTVerifier verifier = JWT.require(Algorithm.HMAC256(SECRET)) + .withIssuer("auth0") + .build(); + DecodedJWT jwt = verifier.verify(token); + return jwt.getClaims(); + } catch (JWTVerificationException exception) { + throw new RuntimeException("Token验证失败"); + } + } + + //获取用户信息 + public static TUser getUserInfo(String token) { + try { + JWTVerifier verifier = JWT.require(Algorithm.HMAC256(SECRET)) + .withIssuer("auth0") + .build(); + DecodedJWT jwt = verifier.verify(token); + String userInfo = jwt.getClaim("userInfo").asString(); + TUser user = JSON.parseObject(userInfo, TUser.class); + return user; + } catch (JWTVerificationException exception) { + throw new RuntimeException("Token验证失败"); + } + } +} diff --git a/src/main/resources/application-custom.yml b/src/main/resources/application-custom.yml new file mode 100644 index 0000000..94ab1a9 --- /dev/null +++ b/src/main/resources/application-custom.yml @@ -0,0 +1,67 @@ +server: + port: 18089 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + druid: + username: root + password: 1qaz!WSX + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://10.100.5.9:3308/qualification_db_custom?serverTimezone=Asia/Shanghai&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false + filter: + wall: + enabled: true + config: + multi-statement-allow: true + stat: + enabled: true + stat-view-servlet: + login-username: root + login-password: 1qaz!WSX + enabled: true + url-pattern: /druid/* + max-active: 30 + initial-size: 1 + validation-query: SELECT 'x' + test-while-idle: true + test-on-borrow: false + test-on-return: false + servlet: + multipart: + max-file-size: 100MB + max-request-size: 100MB + +management: + health: + rabbit: + enabled: false +api: +# user: c3dcf1d0-f2d9-3dcc-9bc7-95b4d5f0e43b +# password: ehr206! + user: DFMC + password: 8d4BPV8E5gnlHiFd + openApiSign: MG1KcUszbkljNXRySndIQ3NXNVFsSzhqWDRzd0pKbUl0RzRSQl93NUdQWT06MTk4MDY1NzI5ODIwMDA3MTE2OA== + employeeResume: +# url: http://10.87.0.127/api/portal-service/resume/getFullEmployeeResumeInformation/{employeeNo} +# url: http://10.10.2.50:8080/api/portal-service/resume/getJobApplicationResumeInformation/{employeeNo} + url: https://hrssc.dfmc.com.cn/api/portal-service/resume/getJobApplicationResumeInformation/{employeeNo} + getPcToken: + url: https://hrssc.dfmc.com.cn/api/authority-management-service/recruit/getPcToken + All_API_URL: https://openapi.yunxuetang.cn/v1/rpt2open/public/o2o/task/student/sync/all + Incr_API_URL: https://openapi.yunxuetang.cn/v1/rpt2open/public/o2o/task/student/sync/incr + All_API_USER_URL: https://openapi.yunxuetang.cn/v1/rpt2open/public/user/sync/all + Incr_API_USER_URL: https://openapi.yunxuetang.cn/v1/rpt2open/public/user/sync/incr + getAPITokenUrl: https://openapi.yunxuetang.cn/token?appId=6hdkfa06dyt&appSecret=OWYwN2MyYzc1MWQ3 + dongfeng_project_url: https://openapi.yunxuetang.cn/v1/mix2/dongfeng/project/get + project_add_member_url: https://openapi.yunxuetang.cn/v1/mix2/dongfeng/project/add/member + +logging: + # logback.xml配置文件的位置 + config: classpath:logback-spring.xml + file: + level: INFO + +upload: + basePath: D:\upload-custom\ + + diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml new file mode 100644 index 0000000..f4ed448 --- /dev/null +++ b/src/main/resources/application-local.yml @@ -0,0 +1,61 @@ +server: + port: 8089 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + druid: + username: root + password: 1qaz!WSX + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3308/qualification_db?serverTimezone=Asia/Shanghai&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false + filter: + wall: + enabled: true + config: + multi-statement-allow: true + stat: + enabled: true + stat-view-servlet: + login-username: root + login-password: 1qaz!WSX + enabled: true + url-pattern: /druid/* + max-active: 30 + initial-size: 1 + validation-query: SELECT 'x' + test-while-idle: true + test-on-borrow: false + test-on-return: false + servlet: + multipart: + max-file-size: 100MB + max-request-size: 100MB + +management: + health: + rabbit: + enabled: false +api: + user: DFMC + password: 8d4BPV8E5gnlHiFd + openApiSign: MG1KcUszbkljNXRySndIQ3NXNVFsSzhqWDRzd0pKbUl0RzRSQl93NUdQWT06MTk4MDY1NzI5ODIwMDA3MTE2OA== + employeeResume: + url: http://10.87.0.127/api/portal-service/resume/getJobApplicationResumeInformation/{employeeNo} + getPcToken: + url: http://10.87.0.127/api/authority-management-service/recruit/getPcToken + All_API_URL: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/rpt2open/public/o2o/task/student/sync/all + Incr_API_URL: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/rpt2open/public/o2o/task/student/sync/incr + All_API_USER_URL: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/rpt2open/public/user/sync/all + Incr_API_USER_URL: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/rpt2open/public/user/sync/incr + getAPITokenUrl: https://openapi-tf-ali-01.yunxuetang.com.cn/token?appId=4asv2fqldt7&appSecret=M2E3NzkzODA5Mzc3 + dongfeng_project_url: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/mix2/dongfeng/project/get + project_add_member_url: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/mix2/dongfeng/project/add/member + +logging: + # logback.xml配置文件的位置 + config: classpath:logback-spring.xml + file: + level: DEBUG + +upload: + basePath: D:\upload\ diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml new file mode 100644 index 0000000..8b20ade --- /dev/null +++ b/src/main/resources/application-test.yml @@ -0,0 +1,65 @@ +server: + port: 8089 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + druid: + username: root + password: 1qaz!WSX + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://10.100.5.9:3308/qualification_db?serverTimezone=Asia/Shanghai&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false + filter: + wall: + enabled: true + config: + multi-statement-allow: true + stat: + enabled: true + stat-view-servlet: + login-username: root + login-password: 1qaz!WSX + enabled: true + url-pattern: /druid/* + max-active: 30 + initial-size: 1 + validation-query: SELECT 'x' + test-while-idle: true + test-on-borrow: false + test-on-return: false + servlet: + multipart: + max-file-size: 100MB + max-request-size: 100MB + +management: + health: + rabbit: + enabled: false +api: +# user: c3dcf1d0-f2d9-3dcc-9bc7-95b4d5f0e43b +# password: ehr206! + user: DFMC + password: 8d4BPV8E5gnlHiFd + openApiSign: MG1KcUszbkljNXRySndIQ3NXNVFsSzhqWDRzd0pKbUl0RzRSQl93NUdQWT06MTk4MDY1NzI5ODIwMDA3MTE2OA== + employeeResume: +# url: http://10.87.0.127/api/portal-service/resume/getFullEmployeeResumeInformation/{employeeNo} +# url: http://10.10.2.50:8080/api/portal-service/resume/getJobApplicationResumeInformation/{employeeNo} + url: http://10.87.0.127/api/portal-service/resume/getJobApplicationResumeInformation/{employeeNo} + getPcToken: + url: http://10.87.0.127/api/authority-management-service/recruit/getPcToken + All_API_URL: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/rpt2open/public/o2o/task/student/sync/all + Incr_API_URL: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/rpt2open/public/o2o/task/student/sync/incr + All_API_USER_URL: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/rpt2open/public/user/sync/all + Incr_API_USER_URL: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/rpt2open/public/user/sync/incr + getAPITokenUrl: https://openapi-tf-ali-01.yunxuetang.com.cn/token?appId=4asv2fqldt7&appSecret=M2E3NzkzODA5Mzc3 + dongfeng_project_url: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/mix2/dongfeng/project/get + project_add_member_url: https://openapi-tf-ali-01.yunxuetang.com.cn/v1/mix2/dongfeng/project/add/member + +logging: + # logback.xml配置文件的位置 + config: classpath:logback-spring.xml + file: + level: INFO + +upload: + basePath: D:\upload\ diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..f64e7a4 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,3 @@ +server: + servlet: + context-path: /qualifications-service diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..7327662 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + %d{HH:mm:ss.SSS} %-5level [%thread] %logger{35} - %msg%n + UTF-8 + + + + + + ${log.path}/all.log + + ${log.path}/all-%d{yyyy-MM-dd}.%i.gz + 90 + + 100MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{35} - %msg%n + UTF-8 + + + + + + ${log.path}/error.log + + ${log.path}/error-%d{yyyy-MM-dd}.%i.gz + 30 + + 100MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{35} - %msg%n + UTF-8 + + + WARN + + + + + + ${log.path}/slow.log + + ${log.path}/slow-%d{yyyy-MM-dd}.%i.gz + 30 + + 100MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{35} - %msg%n + UTF-8 + + + + + + + + + + + + + + + + + + + + + + + + + + +