first commit

This commit is contained in:
8324144
2026-05-18 14:39:26 +08:00
commit 3e9264ebc6
109 changed files with 13139 additions and 0 deletions

651
pom.xml Normal file
View File

@@ -0,0 +1,651 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.wepact.dfm</groupId>
<artifactId>dependency-service</artifactId>
<version>1.0.2</version>
</parent>
<artifactId>qualifications-management-service</artifactId>
<version>1.0.4</version>
<name>qualifications-management-service</name>
<packaging>jar</packaging>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
<swagger2.version>2.9.2</swagger2.version>
</properties>
<dependencies>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.1.0</version>
</dependency>
<!--xxl-job end-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<!-- swagger2 Api -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.6</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-consul-discovery</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.8</version> <!-- 请根据需要选择版本 -->
</dependency>
<!--<dependency>-->
<!--<groupId>com.h2database</groupId>-->
<!--<artifactId>h2</artifactId>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.18</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cn.wepact.dfm</groupId>
<artifactId>common-util</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>organization-management-service-api</artifactId>-->
<!-- <version>[1.0.359,)</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>authority-management-service-api</artifactId>-->
<!-- <version>[1.0.0,)</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>notification-service-api</artifactId>-->
<!-- <version>[1.0.2,)</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>portal-service-api</artifactId>-->
<!-- <version>[1.0.44,)</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>hrprocess-master-api</artifactId>-->
<!-- <version>[1.0.67,)</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>profile-service-api</artifactId>-->
<!-- <version>[0.0.22,)</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>service-workflow-api</artifactId>-->
<!-- <version>[1.0.0,)</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>talent-gps-service-api</artifactId>-->
<!-- <version>[1.0.14,)</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>wechat-service-api</artifactId>-->
<!-- <version>[1.0.1,)</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>operation-management-service-api</artifactId>-->
<!-- <version>[1.0.0,)</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>log-center-service-api</artifactId>-->
<!-- <version>[1.0.10,)</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.24</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>salary-management-api</artifactId>-->
<!-- <version>1.0.4</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-mongodb</artifactId>-->
<!-- </dependency>-->
<!--easyExcel 开始-->
<!-- easyexcel 主要依赖 这一个基本上就够了-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>2.1.4</version>
</dependency>
<!-- servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.3.10</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>core-service-api</artifactId>-->
<!-- <version>[0.1.45,)</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.wepact.dfm</groupId>-->
<!-- <artifactId>config-service-api</artifactId>-->
<!-- <version>[1.0.15,)</version>-->
<!-- </dependency>-->
<!--easyExcel 结束-->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.1.6</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.2</version>
</dependency>
<!--xxl-job end-->
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-quartz</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-actuator</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-web</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.24</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-data-mongodb</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- swagger2 Api -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.1</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.cloud</groupId>-->
<!--<artifactId>spring-cloud-starter-consul-discovery</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-amqp</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>com.h2database</groupId>-->
<!--<artifactId>h2</artifactId>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.18</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-data-redis</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>cn.wepact.dfm</groupId>
<artifactId>common-util</artifactId>
<version>[1.0.0,)</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-excel</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-annotation</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-web</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.10</version>
</dependency>
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>1.26.6</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.cloud</groupId>-->
<!--<artifactId>spring-cloud-starter-openfeign</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext-asian</artifactId>
<version>5.2.0</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-airec</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.5.7</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-push</artifactId>
<version>3.13.5</version>
</dependency>
<!-- batik -->
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-codec</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.1.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.74</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>
<!--easyExcel 开始-->
<!-- easyexcel 主要依赖 这一个基本上就够了-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>2.1.4</version>
</dependency>
<!-- servlet-api -->
<!-- <dependency>-->
<!-- <groupId>javax.servlet</groupId>-->
<!-- <artifactId>javax.servlet-api</artifactId>-->
<!-- <version>4.0.1</version>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.3.10</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.jetbrains.kotlin</groupId>-->
<!-- <artifactId>kotlin-stdlib</artifactId>-->
<!-- <version>${kotlin.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>javax.servlet</groupId>-->
<!--<artifactId>javax.servlet-api</artifactId>-->
<!--<version>3.1.0</version>-->
<!--<scope>provided</scope>-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>9.0.45</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.10.3</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<finalName>qualifications-management-service</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--<configuration>-->
<!--<mainClass>cn.wepact.dfm.training.PortalApplication</mainClass>-->
<!--</configuration>-->
</plugin>
<!--<plugin>-->
<!--<groupId>org.mybatis.generator</groupId>-->
<!--<artifactId>mybatis-generator-maven-plugin</artifactId>-->
<!--<version>1.3.2</version>-->
<!--<configuration>-->
<!--<configurationFile>${basedir}/src/main/resources/generatorConfig.xml</configurationFile>-->
<!--<overwrite>true</overwrite>-->
<!--<verbose>true</verbose>-->
<!--</configuration>-->
<!--<dependencies>-->
<!--<dependency>-->
<!--<groupId>mysql</groupId>-->
<!--<artifactId>mysql-connector-java</artifactId>-->
<!--<version>8.0.18</version>-->
<!--</dependency>-->
<!--</dependencies>-->
<!--</plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.jetbrains.kotlin</groupId>-->
<!-- <artifactId>kotlin-maven-plugin</artifactId>-->
<!-- <version>${kotlin.version}</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>compile</goal>-->
<!-- <goal>test-compile</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<!-- 是否替换资源中的属性 -->
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.yml</include>
<include>**/*.xlsx</include>
<include>**/*.xls</include>
<include>**/*.docx</include>
<include>**/*.pdf</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>nexus-devcloud-releases</id>
<url>https://devcloud.dfmc.com.cn/nexus/repository/maven-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus-devcloud-releases</id>
<url>https://devcloud.dfmc.com.cn/nexus/repository/maven-public/</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>nexus-devcloud-releases</id>
<url>https://devcloud.dfmc.com.cn/nexus/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-devcloud-snapshots</id>
<url>https://devcloud.dfmc.com.cn/nexus/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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<SqlSessionFactory> 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));
}
}

View File

@@ -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<String, Claim> claims = TokenUtil.verifyToken(token);
if (claims != null) {
return true;
}
}
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.getWriter().write("Unauthorized");
return false;
}
}

View File

@@ -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/**");
}
}

View File

@@ -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();
}
}

View File

@@ -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<PageInfo<TEvidenceSubmission>> getPersonalBehaviorEvidenceList(@RequestBody PageParam<TEvidenceSubmission> tEvidenceSubmissionPageParam) {
GeneralRespBean<PageInfo<TEvidenceSubmission>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
tEvidenceSubmissionPageParam.getCondition().setUserId(userInfo.getId());
tEvidenceSubmissionPageParam.getCondition().setOrgCode(userInfo.getOrgCode());
PageInfo<TEvidenceSubmission> personalBehaviorEvidenceList = behaviorEvidenceService.getPersonalBehaviorEvidenceList(tEvidenceSubmissionPageParam);
respBean.setData(personalBehaviorEvidenceList);
respBean.setMsg("获取个人行为举证列表成功!");
respBean.setCode("200");
return respBean;
}
// 新增个人行为举证
@RequestMapping("/addPersonalBehaviorEvidence")
public GeneralRespBean<Boolean> addPersonalBehaviorEvidence(@RequestBody TEvidenceSubmission evidence) {
GeneralRespBean<Boolean> 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<String> uploadPersonalBehaviorEvidenceAttachment(@RequestParam("file") MultipartFile file) {
GeneralRespBean<String> 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);
}
}
}

View File

@@ -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<List<TDictionary>> getDictionary(@RequestBody TDictionary tDictionary) {
GeneralRespBean<List<TDictionary>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
tDictionary.setOrgCode(userInfo.getOrgCode());
List<TDictionary> result = dictionaryService.getDictionaryList(tDictionary);
if(!CollectionUtils.isEmpty(result)){
respBean.setData(result);
respBean.setMsg("获取字典列表成功!");
respBean.setCode("200");
}else{
respBean.setMsg("获取字典列表失败!");
respBean.setCode("500");
}
return respBean;
}
}

View File

@@ -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<PageInfo<TQualificationStandards>> getInternalInformationList(@RequestBody PageParam<InternalInfoParam> internalInfoParam) {
GeneralRespBean<PageInfo<TQualificationStandards>> respBean = new GeneralRespBean<>();
PageInfo<TQualificationStandards> 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<Boolean> addPositionSequenceLevel(@RequestBody TQualificationStandards tQualificationStandards) {
GeneralRespBean<Boolean> 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<Boolean> modifyPositionSequenceLevel(@RequestBody TQualificationStandards tQualificationStandards) {
GeneralRespBean<Boolean> 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<Boolean> deletePositionSequenceLevel(@RequestBody TQualificationStandards tQualificationStandards) {
GeneralRespBean<Boolean> 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<Boolean> uploadQualificationManagementMeasures(@RequestParam("file") MultipartFile file) {
GeneralRespBean<Boolean> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
internalInformationService.uploadQualificationManagementMeasures(userInfo, file);
respBean.setMsg("上传任职资格管理办法成功!");
respBean.setCode("200");
return respBean;
}
// 上传任职资格标准
@RequestMapping("/uploadQualificationStandard/{path}")
public GeneralRespBean<String> uploadQualificationStandard(@RequestParam("file") MultipartFile file,
@PathVariable("path") String path) {
GeneralRespBean<String> 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<TDictionary> getQualificationManagementMeasures() {
GeneralRespBean<TDictionary> 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);
}
}
}

View File

@@ -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<String, JsonElement> 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<UserBaseInfo> queryBasicInformation() {
GeneralRespBean<UserBaseInfo> 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<TQualificationReview> 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 <Integer.parseInt(fullEmployeeResumeInformationMap.get("employeeExperiencesListNumber").toString()); i++) { // 假设你知道最多有10条经历
String startDate = fullEmployeeResumeInformationMap.get("Estart" + i).toString();
String endDate = fullEmployeeResumeInformationMap.get("Eend" + i).toString();
String orgName = fullEmployeeResumeInformationMap.get("unit" + i).toString();
String positionName = fullEmployeeResumeInformationMap.get("Epos" + i).toString();
// 检查是否有对应的工作经历信息
if (startDate != null || endDate != null || orgName != null || positionName != null) {
userBaseInfo.getExperience().add(
Experience.builder()
.startDate(startDate != null ? startDate : "-") // 可以根据需求处理null情况
.endDate(endDate != null ? endDate : "-")
.orgName(orgName != null ? orgName : "-")
.positionName(positionName != null ? positionName : "-")
.build()
);
}
}
if (fullEmployeeResumeInformationMap != null) {
// 确保 PerformanceList 被初始化
if (userBaseInfo.getPerformanceList() == null) {
userBaseInfo.setPerformanceList(new ArrayList<>());
}
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<List<TQualificationStandards>> getQualificationSequenceList(String orgCode) {
GeneralRespBean<List<TQualificationStandards>> respBean = new GeneralRespBean();
List<TQualificationStandards> 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<CourseListResponse> getCourseList(@RequestBody CourseListRequest request) {
GeneralRespBean<CourseListResponse> 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<Boolean> submitQualificationApplication(@RequestBody QualificationApplicationParam param) {
TUser userInfo = getUserInfo();
GeneralRespBean<Boolean> 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<Map<String, CourseListResponse>> isLearningExamInProgress() {
GeneralRespBean<Map<String, CourseListResponse>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
Map<String, CourseListResponse> 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<PageInfo<TQualificationReview>> getDeclaredQualificationList(@RequestBody PageParam<AppliedParam> appliedParam ) {
GeneralRespBean<PageInfo<TQualificationReview>> 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<TQualificationReview> 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<PageInfo<TQualificationReview>> getQualificationAuditList(@RequestBody PageParam<AppliedParam> appliedParam) {
GeneralRespBean<PageInfo<TQualificationReview>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
if (appliedParam.getCondition() == null) {
appliedParam.setCondition(new AppliedParam());
}
appliedParam.getCondition().setOrgCode(userInfo.getOrgCode());
try {
PageInfo<TQualificationReview> 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<Boolean> qualificationAuditStatus(@RequestBody TQualificationReview param) {
GeneralRespBean<Boolean> 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<String, Object> jsonToMap(JSONObject jsonObject) {
// Map<String, Object> map = new HashMap<>();
// Iterator<String> 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<List<TPerformanceRule>> getPerformanceRuleList() {
GeneralRespBean<List<TPerformanceRule>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
List<TPerformanceRule> 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<TAppCheck> getAppCheck(@RequestBody TAppCheck param) {
GeneralRespBean<TAppCheck> 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;
}
}

View File

@@ -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<PageInfo<TProfessionalFeedback>> getProfessionalFeedbackList(@RequestBody PageParam<TProfessionalFeedback> tProfessionalFeedback) {
GeneralRespBean<PageInfo<TProfessionalFeedback>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
tProfessionalFeedback.getCondition().setOrgCode(userInfo.getOrgCode());
tProfessionalFeedback.getCondition().setUserId(userInfo.getId());
PageInfo<TProfessionalFeedback> professionalFeedbackList = professionalFeedbackService.getProfessionalFeedbackList(tProfessionalFeedback);
respBean.setData(professionalFeedbackList);
respBean.setMsg("获取专业回馈列表成功!");
respBean.setCode("200");
return respBean;
}
// 获取专业回馈列表,管理员
@PostMapping("/getProfessionalFeedbackByRoleList")
public GeneralRespBean<PageInfo<TProfessionalFeedback>> getProfessionalFeedbackByRoleList(@RequestBody PageParam<TProfessionalFeedback> tProfessionalFeedback) {
GeneralRespBean<PageInfo<TProfessionalFeedback>> respBean = new GeneralRespBean<>();
TUser tUser = getUserInfo();
PageInfo<TProfessionalFeedback> professionalFeedbackList = professionalFeedbackService.getProfessionalFeedbackByRoleList(tProfessionalFeedback, tUser);
respBean.setData(professionalFeedbackList);
respBean.setMsg("获取专业回馈列表成功!");
respBean.setCode("200");
return respBean;
}
// 新增专业回馈信息
@PostMapping("/addProfessionalFeedbackInfo")
public GeneralRespBean<Boolean> addProfessionalFeedbackInfo(@RequestBody TProfessionalFeedback tProfessionalFeedback) {
GeneralRespBean<Boolean> 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<String> uploadProfessionalFeedbackAttachment(@RequestParam("file") MultipartFile file) {
GeneralRespBean<String> 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<List<TDictionary>> getProfessionalFeedbackCategoryList() {
GeneralRespBean<List<TDictionary>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
List<TDictionary> professionalFeedbackCategoryList = professionalFeedbackService.getProfessionalFeedbackCategoryList(userInfo);
respBean.setData(professionalFeedbackCategoryList);
respBean.setMsg("获取专业回馈类别列表成功!");
respBean.setCode("200");
return respBean;
}
// 获取专业回馈类别结构
@PostMapping("/getProfessionalFeedbackCategoryStruct")
public GeneralRespBean<List<TProfessionalStdRule>> getProfessionalFeedbackCategoryStruct() {
GeneralRespBean<List<TProfessionalStdRule>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
List<TProfessionalStdRule> professionalFeedbackCategoryList = professionalFeedbackService.getProfessionalFeedbackCategoryStruct(userInfo);
respBean.setData(professionalFeedbackCategoryList);
respBean.setMsg("获取专业回馈类别列表成功!");
respBean.setCode("200");
return respBean;
}
@PostMapping("/getProfessionalFeedbackDefineList")
public GeneralRespBean<List<TDictionary>> getProfessionalFeedbackDefineList() {
GeneralRespBean<List<TDictionary>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
List<TDictionary> data = professionalFeedbackService.getProfessionalFeedbackDefineList(userInfo);
respBean.setData(data);
respBean.setMsg("获取专业回馈定义列表成功!");
respBean.setCode("200");
return respBean;
}
// 获取专业回馈单位列表
@PostMapping("/getProfessionalFeedbackUnitList")
public GeneralRespBean<List<TDictionary>> getProfessionalFeedbackUnitList() {
GeneralRespBean<List<TDictionary>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
List<TDictionary> professionalFeedbackUnitList = professionalFeedbackService.getProfessionalFeedbackUnitList(userInfo);
respBean.setData(professionalFeedbackUnitList);
respBean.setMsg("获取专业回馈单位列表成功!");
respBean.setCode("200");
return respBean;
}
// 获取专业回馈角色列表
@PostMapping("/getProfessionalFeedbackRoleList")
public GeneralRespBean<List<TDictionary>> getProfessionalFeedbackRoleList() {
GeneralRespBean<List<TDictionary>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
List<TDictionary> professionalFeedbackRoleList = professionalFeedbackService.getProfessionalFeedbackRoleList(userInfo);
respBean.setData(professionalFeedbackRoleList);
respBean.setMsg("获取专业回馈角色列表成功!");
respBean.setCode("200");
return respBean;
}
// 获取专业回馈层级列表
@PostMapping("/getProfessionalFeedbackHierarchyList")
public GeneralRespBean<List<TDictionary>> getProfessionalFeedbackHierarchyList() {
GeneralRespBean<List<TDictionary>> respBean = new GeneralRespBean<>();
TUser userInfo = getUserInfo();
List<TDictionary> 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<Boolean> professionalFeedbackAuditApproval(@RequestBody TProfessionalFeedback tProfessionalFeedback) {
GeneralRespBean<Boolean> 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<Boolean> professionalFeedbackAuditRejection(@RequestBody TProfessionalFeedback tProfessionalFeedback) {
GeneralRespBean<Boolean> 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();
// }
}

View File

@@ -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<String> syncTasks(@RequestBody SyncRequest syncRequest) {
// 调用 syncTasks 方法并传入请求数据
taskSyncService.syncTasks(syncRequest);
// 返回成功响应
return ResponseEntity.ok("同步任务完成");
}
@PostMapping("/syncUsers")
public ResponseEntity<String> syncUsers(@RequestBody SyncRequest syncRequest) {
// 调用 syncTasks 方法并传入请求数据
syncUserInfoService.syncUserInfos(syncRequest);
// 返回成功响应
return ResponseEntity.ok("同步任务完成");
}
// /**
// * 获取每个学生每个项目下必修和选修的任务汇总分数
// * @return 汇总任务分数的响应
// */
// @GetMapping("/task-scores")
// public ResponseEntity<List<TaskScoreSummary>> getTaskScores() {
// List<TaskScoreSummary> taskScoreSummaries = taskSyncService.getTaskScoreSummary();
// return ResponseEntity.ok(taskScoreSummaries);
// }
/**
* 处理任务分数,插入或更新任职资格审核记录
* @param taskScoreSummaries 学生任务汇总分数
* @return 操作结果
*/
@PostMapping("/process-scores")
public ResponseEntity<String> processTaskScores() {
try {
List<TaskScoreSummary> 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<String> 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<String> 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());
}
}
}

View File

@@ -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<TUser> login(@RequestBody TUser loginRequest) {
GeneralRespBean<TUser> 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<String> register(@RequestBody TUser registerRequest) {
GeneralRespBean<String> 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<List<TOrg>> getDeptList() {
GeneralRespBean<List<TOrg>> respBean = new GeneralRespBean();
List<TOrg> tOrgList = userService.getDeptList();
respBean.setData(tOrgList);
respBean.setMsg(Constant.SUCCESS_MSG);
respBean.setCode(Constant.SUCCESS_CODE);
return respBean;
}
/**
* 用于生成带六位数字验证码并发送邮件
*/
@PostMapping(value = "/captcha")
public GeneralRespBean<Boolean> captchacode(HttpSession session) throws Exception {
GeneralRespBean<Boolean> 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<Boolean> updatePwd(HttpSession session,
@RequestBody TUser tUser) throws Exception {
GeneralRespBean<Boolean> 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<Boolean> cancelPreview() {
GeneralRespBean<Boolean> 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;
}
}

View File

@@ -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<String> statusList;
private Long userId;
private Date reviewTime;
private Date startTime;
private String username;
private String userNo;
private List<String> positionNameList;
}

View File

@@ -0,0 +1,10 @@
package cn.wepact.dfm.training.dto;
import lombok.Data;
@Data
public class CourseListRequest {
private String projectName; // 项目名称
// Getter and Setter methods
}

View File

@@ -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<Task> tasks;
@Data
public static class Task {
private String targetId;
private String taskId;
private String name;
private List<Kng> kngs;
// 新增字段
private Integer type;
private Integer required;
}
@Data
public static class Kng {
private String kngTitle;
private String kngId;
// 新增字段
private String kngType;
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}

View File

@@ -0,0 +1,11 @@
package cn.wepact.dfm.training.dto;
import lombok.Data;
@Data
public class PageParam<T> {
private Integer pageNo;
private Integer pageSize;
private Integer totalCount;
private T condition;
}

View File

@@ -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;
}
}
}

View File

@@ -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)
}

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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() {
}
}

View File

@@ -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
}

View File

@@ -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;
}
}

View File

@@ -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> sequenceLevel;
private List<Experience> experience;
private List<Performance> 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> sequenceLevel,
List<Experience> experience, List<Performance> 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<>();
}
}

View File

@@ -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;
}
}

View File

@@ -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
}

View File

@@ -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;
}

View File

@@ -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();
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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();
}
}

View File

@@ -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<String> defineCodeList;
private Date selectStartTime;
private Date selectEndTime;
}

View File

@@ -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<TProfessionalStdRule> roleList;
private List<TProfessionalStdRule> levelList;
public TProfessionalStdRule() {
this.roleList = new ArrayList<>();
this.levelList = new ArrayList<>();
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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<TUserPermission> 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;
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.LevelScoresMapper">
<!-- 公共的列清单 -->
<sql id="Base_Column_List">
id, level, required_score, elective_score, org_code
</sql>
<!-- 基本的结果映射 -->
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.LevelScores">
<id column="id" property="id" />
<result column="level" property="level" />
<result column="required_score" property="requiredScore" />
<result column="elective_score" property="electiveScore" />
<result column="org_code" property="orgCode" />
</resultMap>
<!-- 根据层级查找对应的记录 -->
<select id="findByLevel" parameterType="string" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM LevelScores
WHERE level = #{level}
</select>
</mapper>

View File

@@ -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 <Model> The Model Class 这里是泛型不是Model类
* @param <PK> The Primary Key Class 如果是无主键则可以用Model来跳过如果是多主键则是Key类
*/
public interface MyBatisBaseDao<Model, PK extends Serializable> {
int deleteByPrimaryKey(PK id);
int insert(Model record);
int insertSelective(Model record);
Model selectByPrimaryKey(PK id);
int updateByPrimaryKeySelective(Model record);
int updateByPrimaryKey(Model record);
}

View File

@@ -0,0 +1,22 @@
package cn.wepact.dfm.training.mapper;
import java.io.Serializable;
/**
* DAO公共基类由MybatisGenerator自动生成请勿修改
* @param <Model> The Model Class 这里是泛型不是Model类
* @param <PK> The Primary Key Class 如果是无主键则可以用Model来跳过如果是多主键则是Key类
*/
public interface MyBatisBaseMapper<Model, PK extends Serializable> {
int deleteByPrimaryKey(PK id);
int insert(Model record);
int insertSelective(Model record);
Model selectByPrimaryKey(PK id);
int updateByPrimaryKeySelective(Model record);
int updateByPrimaryKey(Model record);
}

View File

@@ -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<SyncTaskLog, Long> {
int insert(SyncTaskLog log);
SyncTaskLog findByTaskId(Long taskId);
Date getLastSyncTime();
void updateLastSyncTime(Date lastSyncTime);
void update(SyncTaskLog existingLog);
List<TaskScoreSummary> getTaskScoreSummary();
}

View File

@@ -0,0 +1,382 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.SyncTaskLogMapper">
<!-- 结果映射字段到Java对象属性的映射 -->
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.SyncTaskLog">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="sync_time" jdbcType="TIMESTAMP" property="syncTime"/>
<result column="offset" jdbcType="INTEGER" property="offset"/>
<result column="sync_limit" jdbcType="INTEGER" property="limit"/>
<result column="search_start_time" jdbcType="TIMESTAMP" property="searchStartTime"/>
<result column="search_end_time" jdbcType="TIMESTAMP" property="searchEndTime"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="task_id" jdbcType="BIGINT" property="taskId"/>
<result column="org_id" jdbcType="BIGINT" property="orgId"/>
<result column="project_id" jdbcType="BIGINT" property="projectId"/>
<result column="main_project_id" jdbcType="BIGINT" property="mainProjectId"/>
<result column="stu_user_id" jdbcType="BIGINT" property="stuUserId"/>
<result column="third_user_id" jdbcType="BIGINT" property="thirdUserId"/>
<result column="formal" jdbcType="BOOLEAN" property="formal"/>
<result column="period_id" jdbcType="BIGINT" property="periodId"/>
<result column="result_repeat_flag" jdbcType="BOOLEAN" property="resultRepeatFlag"/>
<result column="sub_result_id" jdbcType="BIGINT" property="subResultId"/>
<result column="sub_task_id" jdbcType="BIGINT" property="subTaskId"/>
<result column="repeat_count" jdbcType="INTEGER" property="repeatCount"/>
<result column="sub_task_result_id" jdbcType="BIGINT" property="subTaskResultId"/>
<result column="order_index" jdbcType="INTEGER" property="orderIndex"/>
<result column="task_status" jdbcType="VARCHAR" property="taskStatus"/>
<result column="task_required" jdbcType="BOOLEAN" property="taskRequired"/>
<result column="task_schedule" jdbcType="INTEGER" property="taskSchedule"/>
<result column="task_manual_completed" jdbcType="BOOLEAN" property="taskManualCompleted"/>
<result column="task_start_time" jdbcType="TIMESTAMP" property="taskStartTime"/>
<result column="task_completed_time" jdbcType="TIMESTAMP" property="taskCompletedTime"/>
<result column="task_duration" jdbcType="INTEGER" property="taskDuration"/>
<result column="is_rated" jdbcType="BOOLEAN" property="isRated"/>
<result column="task_target_scores" jdbcType="INTEGER" property="taskTargetScores"/>
<result column="task_passed" jdbcType="BOOLEAN" property="taskPassed"/>
<result column="task_is_excellent" jdbcType="BOOLEAN" property="taskIsExcellent"/>
<result column="task_delay" jdbcType="INTEGER" property="taskDelay"/>
<result column="task_sign_status" jdbcType="BOOLEAN" property="taskSignStatus"/>
<result column="task_signout_status" jdbcType="BOOLEAN" property="taskSignoutStatus"/>
<result column="task_sign_time" jdbcType="TIMESTAMP" property="taskSignTime"/>
<result column="task_signout_time" jdbcType="TIMESTAMP" property="taskSignoutTime"/>
<result column="task_sign_address" jdbcType="VARCHAR" property="taskSignAddress"/>
<result column="task_signout_address" jdbcType="VARCHAR" property="taskSignoutAddress"/>
<result column="task_answer" jdbcType="VARCHAR" property="taskAnswer"/>
<result column="task_get_scores" jdbcType="INTEGER" property="taskGetScores"/>
<result column="task_get_points" jdbcType="INTEGER" property="taskGetPoints"/>
<result column="task_get_study_hours" jdbcType="INTEGER" property="taskGetStudyHours"/>
<result column="stu_deleted" jdbcType="BOOLEAN" property="stuDeleted"/>
<result column="task_result_deleted" jdbcType="BOOLEAN" property="taskResultDeleted"/>
<result column="task_has_tutor" jdbcType="BOOLEAN" property="taskHasTutor"/>
<result column="ojt_teacher_id" jdbcType="BIGINT" property="ojtTeacherId"/>
<result column="ojt_teacher_fullname" jdbcType="VARCHAR" property="ojtTeacherFullname"/>
<result column="ojt_study_status" jdbcType="VARCHAR" property="ojtStudyStatus"/>
<result column="ojt_out_time" jdbcType="TIMESTAMP" property="ojtOutTime"/>
<result column="ojt_in_time" jdbcType="TIMESTAMP" property="ojtInTime"/>
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt"/>
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt"/>
<!-- New mappings -->
<result column="tr_create_user_id" jdbcType="VARCHAR" property="trCreateUserId"/>
<result column="tr_update_user_id" jdbcType="VARCHAR" property="trUpdateUserId"/>
<result column="tr_update_time" jdbcType="TIMESTAMP" property="trUpdateTime"/>
<result column="task_type" jdbcType="INTEGER" property="taskType"/>
<result column="tr_create_time" jdbcType="TIMESTAMP" property="trCreateTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="db_create_time" jdbcType="TIMESTAMP" property="dbCreateTime"/>
<result column="db_update_time" jdbcType="TIMESTAMP" property="dbUpdateTime"/>
</resultMap>
<!-- 基础列清单 -->
<sql id="Base_Column_List">
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
</sql>
<!-- 插入同步任务日志 -->
<insert id="insert" parameterType="cn.wepact.dfm.training.dto.entity.SyncTaskLog">
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}
)
</insert>
<!-- 根据任务ID查找同步任务日志 -->
<select id="findByTaskId" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM sync_task_log
WHERE task_id = #{taskId}
LIMIT 1
</select>
<!-- 获取最后一次同步时间 -->
<select id="getLastSyncTime" resultType="java.util.Date">
SELECT sync_time
FROM sync_task_log
ORDER BY sync_time DESC
LIMIT 1
</select>
<!-- 更新最后同步时间 -->
<update id="updateLastSyncTime" parameterType="java.util.Date">
UPDATE sync_task_log
SET sync_time = #{syncTime}
</update>
<update id="update" parameterType="cn.wepact.dfm.training.dto.entity.SyncTaskLog">
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}
</update>
<select id="getTaskScoreSummary" resultType="cn.wepact.dfm.training.dto.TaskScoreSummary">
<!-- SELECT-->
<!-- s.stu_user_id AS stuUserId,-->
<!-- s.project_id AS projectId,-->
<!-- SUM(CASE WHEN s.task_required = 1 THEN s.task_get_scores ELSE 0 END) AS requiredTotalScores,-->
<!-- SUM(CASE WHEN s.task_required = 0 THEN s.task_get_scores ELSE 0 END) AS electiveTotalScores-->
<!-- FROM-->
<!-- (SELECT -->
<!-- stu_user_id,-->
<!-- project_id,-->
<!-- task_id,-->
<!-- task_required,-->
<!-- task_get_scores,-->
<!-- task_status,-->
<!-- task_completed_time-->
<!-- FROM sync_task_log s1-->
<!-- WHERE s1.id = (-->
<!-- SELECT id -->
<!-- FROM sync_task_log s2 -->
<!-- WHERE s2.task_id = s1.task_id -->
<!-- ORDER BY created_at DESC -->
<!-- LIMIT 1-->
<!-- )-->
<!-- AND s1.task_status = 2-->
<!-- ) s-->
<!-- JOIN -->
<!-- sync_user_info_log u ON s.stu_user_id = u.user_id-->
<!-- JOIN -->
<!-- t_user tu ON u.username = tu.user_no-->
<!-- JOIN -->
<!-- t_qualification_review q ON tu.id = q.user_id -->
<!-- AND s.project_id = q.project_id-->
<!-- WHERE-->
<!-- s.task_completed_time > q.created_at-->
<!-- AND q.del_flag = '0'-->
<!-- AND q.status IN ('0', '1', '2', '3')-->
<!-- GROUP BY-->
<!-- s.stu_user_id,-->
<!-- s.project_id;-->
SELECT
s.stu_user_id AS stuUserId,
s.project_id AS projectId,
SUM(CASE WHEN s.task_required = 1 THEN s.task_get_scores ELSE 0 END) AS requiredTotalScores,
SUM(CASE WHEN s.task_required = 0 THEN s.task_get_scores ELSE 0 END) AS electiveTotalScores
FROM
(SELECT
s1.stu_user_id,
s1.project_id,
s1.task_id,
s1.task_required,
s1.task_get_scores,
s1.task_status,
s1.task_completed_time
FROM sync_task_log s1
INNER JOIN (
SELECT task_id, stu_user_id, MAX(created_at) as latest_created_at
FROM sync_task_log
WHERE task_status = 2
GROUP BY task_id, stu_user_id
) latest ON s1.task_id = latest.task_id
AND s1.stu_user_id = latest.stu_user_id
AND s1.created_at = latest.latest_created_at
) s
LEFT JOIN
sync_user_info_log u ON s.stu_user_id = u.user_id
LEFT JOIN
t_user tu ON u.username = tu.user_no
LEFT JOIN
t_qualification_review q ON tu.id = q.user_id
AND s.project_id = q.project_id
AND q.del_flag = '0'
AND q.status IN ('0', '1', '2', '3')
WHERE
s.task_completed_time > q.created_at
GROUP BY
s.stu_user_id,
s.project_id;
</select>
</mapper>

View File

@@ -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, Long> {
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);
}

View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.SyncUserInfoLogMapper">
<resultMap id="UserResultMap" type="cn.wepact.dfm.training.dto.entity.SyncUserInfoLog">
<result property="id" column="id"/> <!-- 用户ID -->
<result property="syncTime" column="sync_time"/> <!-- 同步时间 -->
<result property="offset" column="offset"/> <!-- 偏移量 -->
<result property="syncLimit" column="sync_limit"/> <!-- 同步限制 -->
<result property="searchStartTime" column="search_start_time"/> <!-- 搜索开始时间 -->
<result property="searchEndTime" column="search_end_time"/> <!-- 搜索结束时间 -->
<result property="status" column="status"/> <!-- 状态 -->
<result property="userId" column="user_id"/> <!-- 用户唯一标识 -->
<result property="username" column="username"/> <!-- 用户名 -->
<result property="fullname" column="fullname"/> <!-- 全名 -->
<result property="gender" column="gender"/> <!-- 性别 (1: 男, 2: 女) -->
<result property="idNo" column="id_no"/> <!-- 身份证号 -->
<result property="birthday" column="birthday"/> <!-- 生日 -->
<result property="deptId" column="dept_id"/> <!-- 部门ID -->
<result property="deptName" column="dept_name"/> <!-- 部门名称 -->
<result property="positionId" column="position_id"/> <!-- 职位ID -->
<result property="positionName" column="position_name"/> <!-- 职位名称 -->
<result property="gradeId" column="grade_id"/> <!-- 等级ID -->
<result property="gradeName" column="grade_name"/> <!-- 等级名称 -->
<result property="managerId" column="manager_id"/> <!-- 经理ID -->
<result property="managerFullname" column="manager_fullname"/> <!-- 经理全名 -->
<result property="deptManagerId" column="dept_manager_id"/> <!-- 部门经理ID -->
<result property="deptManagerFullname" column="dept_manager_fullname"/> <!-- 部门经理全名 -->
<result property="mobile" column="mobile"/> <!-- 手机号 -->
<result property="email" column="email"/> <!-- 邮箱 -->
<result property="userNo" column="user_no"/> <!-- 用户工号 -->
<result property="hireDate" column="hire_date"/> <!-- 入职时间 -->
<result property="expiredTime" column="expired_time"/> <!-- 到期时间 -->
<result property="areaCode" column="area_code"/> <!-- 区号 -->
<result property="userStatus" column="user_status"/> <!-- 用户状态 -->
<result property="avatarUrl" column="avatar_url"/> <!-- 头像URL -->
<result property="admin" column="admin"/> <!-- 是否是管理员 -->
<result property="deleted" column="deleted"/> <!-- 是否删除 -->
<result property="thirdUserId" column="third_user_id"/> <!-- 第三方用户ID -->
<result property="createTime" column="create_time"/> <!-- 创建时间 -->
<result property="updateTime" column="update_time"/> <!-- 更新时间 -->
<result property="userType" column="user_type"/> <!-- 用户类型 -->
</resultMap>
<sql id="Base_Column_List">
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
</sql>
<insert id="insertUserInfo">
INSERT INTO sync_user_info_log (<include refid="Base_Column_List"/>)
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})
</insert>
<update id="updateUserInfo">
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>
<select id="getUserInfoByUserId" resultMap="UserResultMap">
SELECT <include refid="Base_Column_List"/> FROM sync_user_info_log WHERE user_id = #{userId}
</select>
<!-- 获取最后一次同步时间 -->
<select id="getLastSyncTime" resultType="java.util.Date">
SELECT sync_time
FROM sync_user_info_log
ORDER BY sync_time DESC
LIMIT 1
</select>
<!-- 更新最后同步时间 -->
<update id="updateLastSyncTime" parameterType="java.util.Date">
UPDATE sync_user_info_log
SET sync_time = #{syncTime}
</update>
<select id="findUserInfoByStuUserId" resultMap="UserResultMap">
SELECT user_id, username FROM sync_user_info_log WHERE user_id = #{stuUserId}
</select>
</mapper>

View File

@@ -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<TAppCheck, Long> {
List<TAppCheck> selectByConditions(@Param("param") TAppCheck param);
}

View File

@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.TAppCheckMapper">
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TAppCheck">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="org_code" jdbcType="VARCHAR" property="orgCode" />
<result column="degree" jdbcType="VARCHAR" property="degree" />
<result column="level" jdbcType="VARCHAR" property="level" />
<result column="s_year" jdbcType="INTEGER" property="sYear" />
<result column="p_year" jdbcType="INTEGER" property="pYear" />
<result column="jx" jdbcType="INTEGER" property="jx" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
id, org_code, `degree`, `level`, s_year, p_year, jx, updated_at, updated_by, created_at,
created_by, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_app_check
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectByConditions" resultMap="BaseResultMap"
parameterType="cn.wepact.dfm.training.dto.entity.TAppCheck">
select
<include refid="Base_Column_List" />
from t_app_check
where
del_flag='0'
<if test="param.orgCode != null">
and org_code = #{param.orgCode,jdbcType=VARCHAR}
</if>
<if test="param.degree != null">
and `degree` = #{param.degree,jdbcType=VARCHAR}
</if>
<if test="param.level != null">
and `level` = #{param.level,jdbcType=VARCHAR}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_app_check
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TAppCheck" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TAppCheck" useGeneratedKeys="true">
insert into t_app_check
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orgCode != null">
org_code,
</if>
<if test="degree != null">
`degree`,
</if>
<if test="level != null">
`level`,
</if>
<if test="sYear != null">
s_year,
</if>
<if test="pYear != null">
p_year,
</if>
<if test="jx != null">
jx,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orgCode != null">
#{orgCode,jdbcType=VARCHAR},
</if>
<if test="degree != null">
#{degree,jdbcType=VARCHAR},
</if>
<if test="level != null">
#{level,jdbcType=VARCHAR},
</if>
<if test="sYear != null">
#{sYear,jdbcType=INTEGER},
</if>
<if test="pYear != null">
#{pYear,jdbcType=INTEGER},
</if>
<if test="jx != null">
#{jx,jdbcType=INTEGER},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TAppCheck">
update t_app_check
<set>
<if test="orgCode != null">
org_code = #{orgCode,jdbcType=VARCHAR},
</if>
<if test="degree != null">
`degree` = #{degree,jdbcType=VARCHAR},
</if>
<if test="level != null">
`level` = #{level,jdbcType=VARCHAR},
</if>
<if test="sYear != null">
s_year = #{sYear,jdbcType=INTEGER},
</if>
<if test="pYear != null">
p_year = #{pYear,jdbcType=INTEGER},
</if>
<if test="jx != null">
jx = #{jx,jdbcType=INTEGER},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TAppCheck">
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}
</update>
</mapper>

View File

@@ -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<TDictionary, Long> {
List<TDictionary> selectByCondition(TDictionary tDictionary);
}

View File

@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.TDictionaryMapper">
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TDictionary">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="org_code" jdbcType="VARCHAR" property="orgCode" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="value" jdbcType="VARCHAR" property="value" />
<result column="version" jdbcType="INTEGER" property="version" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
id, org_code, `type`, code, `value`, version, updated_at, updated_by, created_at,
created_by, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_dictionary
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectByCondition" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from
t_dictionary
where
del_flag=0
<if test="orgCode != null">
and org_code = #{orgCode}
</if>
<if test="type != null">
and `type` = #{type}
</if>
<if test="code != null">
and code = #{code}
</if>
<if test="version != null">
and version = #{version}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_dictionary
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TDictionary" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TDictionary" useGeneratedKeys="true">
insert into t_dictionary
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orgCode != null">
org_code,
</if>
<if test="type != null">
`type`,
</if>
<if test="code != null">
code,
</if>
<if test="value != null">
`value`,
</if>
<if test="version != null">
version,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orgCode != null">
#{orgCode,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="value != null">
#{value,jdbcType=VARCHAR},
</if>
<if test="version != null">
#{version,jdbcType=INTEGER},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TDictionary">
update t_dictionary
<set>
<if test="orgCode != null">
org_code = #{orgCode,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="value != null">
`value` = #{value,jdbcType=VARCHAR},
</if>
<if test="version != null">
version = #{version,jdbcType=INTEGER},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TDictionary">
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}
</update>
</mapper>

View File

@@ -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<TEvidenceSubmission, Long> {
List<TEvidenceSubmission> selectByCondition(TEvidenceSubmission condition);
}

View File

@@ -0,0 +1,252 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.TEvidenceSubmissionMapper">
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TEvidenceSubmission">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="org_code" jdbcType="BIGINT" property="orgCode" />
<result column="evidence_no" jdbcType="VARCHAR" property="evidenceNo" />
<result column="evidence_name" jdbcType="VARCHAR" property="evidenceName" />
<result column="evidence_witness" jdbcType="VARCHAR" property="evidenceWitness" />
<result column="evidence_attachment" jdbcType="VARCHAR" property="evidenceAttachment" />
<result column="upload_date" jdbcType="TIMESTAMP" property="uploadDate" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
<result column="evidence_description" jdbcType="LONGVARCHAR" property="evidenceDescription" />
<result column="remarks" jdbcType="LONGVARCHAR" property="remarks" />
</resultMap>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_evidence_submission
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_evidence_submission
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TEvidenceSubmission" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TEvidenceSubmission" useGeneratedKeys="true">
insert into t_evidence_submission
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="orgCode != null">
org_code,
</if>
<if test="evidenceNo != null">
evidence_no,
</if>
<if test="evidenceName != null">
evidence_name,
</if>
<if test="evidenceWitness != null">
evidence_witness,
</if>
<if test="evidenceAttachment != null">
evidence_attachment,
</if>
<if test="uploadDate != null">
upload_date,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="evidenceDescription != null">
evidence_description,
</if>
<if test="remarks != null">
remarks,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="orgCode != null">
#{orgCode,jdbcType=VARCHAR},
</if>
<if test="evidenceNo != null">
#{evidenceNo,jdbcType=VARCHAR},
</if>
<if test="evidenceName != null">
#{evidenceName,jdbcType=VARCHAR},
</if>
<if test="evidenceWitness != null">
#{evidenceWitness,jdbcType=VARCHAR},
</if>
<if test="evidenceAttachment != null">
#{evidenceAttachment,jdbcType=VARCHAR},
</if>
<if test="uploadDate != null">
#{uploadDate,jdbcType=TIMESTAMP},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
<if test="evidenceDescription != null">
#{evidenceDescription,jdbcType=LONGVARCHAR},
</if>
<if test="remarks != null">
#{remarks,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TEvidenceSubmission">
update t_evidence_submission
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="orgCode != null">
org_code = #{orgCode,jdbcType=VARCHAR},
</if>
<if test="evidenceNo != null">
evidence_no = #{evidenceNo,jdbcType=VARCHAR},
</if>
<if test="evidenceName != null">
evidence_name = #{evidenceName,jdbcType=VARCHAR},
</if>
<if test="evidenceWitness != null">
evidence_witness = #{evidenceWitness,jdbcType=VARCHAR},
</if>
<if test="evidenceAttachment != null">
evidence_attachment = #{evidenceAttachment,jdbcType=VARCHAR},
</if>
<if test="uploadDate != null">
upload_date = #{uploadDate,jdbcType=TIMESTAMP},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
<if test="evidenceDescription != null">
evidence_description = #{evidenceDescription,jdbcType=LONGVARCHAR},
</if>
<if test="remarks != null">
remarks = #{remarks,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<!-- <update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TEvidenceSubmission">-->
<!-- 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},-->
<!-- evidence_description = #{evidenceDescription,jdbcType=LONGVARCHAR},-->
<!-- remarks = #{remarks,jdbcType=LONGVARCHAR}-->
<!-- where id = #{id,jdbcType=BIGINT}-->
<!-- </update>-->
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TEvidenceSubmission">
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}
</update>
<select id="selectByCondition" resultType="cn.wepact.dfm.training.dto.entity.TEvidenceSubmission">
SELECT
id,
user_id AS userId,
org_code AS orgCode,
evidence_no AS evidenceNo,
evidence_name AS evidenceName,
evidence_witness AS evidenceWitness,
evidence_attachment AS evidenceAttachment,
created_at AS createdAt,
created_by AS createdBy,
updated_at AS updatedAt,
updated_by AS updatedBy,
remarks
FROM
t_evidence_submission
WHERE
del_flag =0
<if test="orgCode != null">
and org_code = #{orgCode,jdbcType=VARCHAR}
</if>
<if test="userId != null">
and user_id = #{userId,jdbcType=VARCHAR}
</if>
<if test="evidenceNo != null and evidenceNo !=''">
and evidence_no = #{evidenceNo,jdbcType=VARCHAR}
</if>
<if test="evidenceName != null and evidenceName !=''">
and evidence_name like CONCAT("%", #{evidenceName,jdbcType=VARCHAR}, "%")
</if>
</select>
</mapper>

View File

@@ -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, Long> {
TOrg selectByCode(@Param("code") String code);
List<TOrg> selectAll();
}

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.TOrgMapper">
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TOrg">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="short_name" jdbcType="VARCHAR" property="shortName" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
id, `name`, code, short_name, updated_at, updated_by, created_at, created_by, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_org
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectByCode" resultMap="BaseResultMap"
parameterType="java.lang.String">
select
<include refid="Base_Column_List" />
from t_org
where code = #{code}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_org
where del_flag = '0'
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_org
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TOrg" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TOrg" useGeneratedKeys="true">
insert into t_org
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">
`name`,
</if>
<if test="code != null">
code,
</if>
<if test="shortName != null">
short_name,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="shortName != null">
#{shortName,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TOrg">
update t_org
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="shortName != null">
short_name = #{shortName,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TOrg">
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}
</update>
</mapper>

View File

@@ -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<TPerformanceRule, Long> {
List<TPerformanceRule> selectByConditions(@Param("param") TPerformanceRule param);
}

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.TPerformanceRuleMapper">
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TPerformanceRule">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="org_code" jdbcType="VARCHAR" property="orgCode" />
<result column="jx_name" jdbcType="VARCHAR" property="jxName" />
<result column="score" jdbcType="INTEGER" property="score" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
id, org_code, jx_name, score, updated_at, updated_by, created_at, created_by, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_performance_rule
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectByConditions" resultMap="BaseResultMap"
parameterType="cn.wepact.dfm.training.dto.entity.TPerformanceRule">
select
<include refid="Base_Column_List" />
from t_performance_rule
where
del_flag='0'
<if test="param.orgCode != null">
and org_code = #{param.orgCode,jdbcType=VARCHAR}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_performance_rule
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TPerformanceRule" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TPerformanceRule" useGeneratedKeys="true">
insert into t_performance_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orgCode != null">
org_code,
</if>
<if test="jxName != null">
jx_name,
</if>
<if test="score != null">
score,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orgCode != null">
#{orgCode,jdbcType=VARCHAR},
</if>
<if test="jxName != null">
#{jxName,jdbcType=VARCHAR},
</if>
<if test="score != null">
#{score,jdbcType=INTEGER},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TPerformanceRule">
update t_performance_rule
<set>
<if test="orgCode != null">
org_code = #{orgCode,jdbcType=VARCHAR},
</if>
<if test="jxName != null">
jx_name = #{jxName,jdbcType=VARCHAR},
</if>
<if test="score != null">
score = #{score,jdbcType=INTEGER},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TPerformanceRule">
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}
</update>
</mapper>

View File

@@ -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<TProfessionalFeedback, Long> {
List<TProfessionalFeedback> selectByCondition(TProfessionalFeedback tProfessionalFeedback);
List<TProfessionalFeedback> selectWithUserInfoByCondition(TProfessionalFeedback condition);
}

View File

@@ -0,0 +1,457 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.TProfessionalFeedbackMapper">
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TProfessionalFeedback">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="org_code" jdbcType="VARCHAR" property="orgCode" />
<result column="category_code" jdbcType="VARCHAR" property="categoryCode" />
<result column="define_code" jdbcType="VARCHAR" property="defineCode" />
<result column="specific_task" jdbcType="VARCHAR" property="specificTask" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="number" jdbcType="INTEGER" property="number" />
<result column="unit_code" jdbcType="VARCHAR" property="unitCode" />
<result column="initiating_department" jdbcType="VARCHAR" property="initiatingDepartment" />
<result column="role_code" jdbcType="VARCHAR" property="roleCode" />
<result column="level_code" jdbcType="VARCHAR" property="levelCode" />
<result column="proof_material" jdbcType="VARCHAR" property="proofMaterial" />
<result column="audit_status" jdbcType="VARCHAR" property="auditStatus" />
<result column="auditor" jdbcType="VARCHAR" property="auditor" />
<result column="audit_date" jdbcType="TIMESTAMP" property="auditDate" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
<result column="remarks" jdbcType="LONGVARCHAR" property="remarks" />
<result column="score" jdbcType="REAL" property="score" />
</resultMap>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_professional_feedback
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectByCondition" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM
t_professional_feedback
WHERE
del_flag = 0
<if test="orgCode != null">
and org_code = #{orgCode,jdbcType=VARCHAR}
</if>
<if test="userId != null">
and user_id = #{userId,jdbcType=VARCHAR}
</if>
<if test="categoryCode != null">
and category_code = #{categoryCode,jdbcType=VARCHAR}
</if>
<if test="defineCode != null">
and define_code = #{defineCode, jdbcType=VARCHAR}
</if>
<if test="specificTask != null and specificTask !=''">
and specific_task like CONCAT("%", #{specificTask,jdbcType=VARCHAR}, "%")
</if>
<if test="startTime != null">
and start_time = #{startTime,jdbcType=TIMESTAMP}
</if>
<if test="endTime != null">
and end_time = #{endTime,jdbcType=TIMESTAMP}
</if>
<if test="selectStartTime != null and selectEndTime != null">
and end_time > #{selectStartTime,jdbcType=TIMESTAMP}
and start_time <![CDATA[<]]> #{selectEndTime,jdbcType=TIMESTAMP}
</if>
<if test="number != null">
and `number` = #{number,jdbcType=INTEGER}
</if>
<if test="unitCode != null">
and unit_code = #{unitCode,jdbcType=VARCHAR}
</if>
<if test="initiatingDepartment != null">
and initiating_department = #{initiatingDepartment,jdbcType=VARCHAR}
</if>
<if test="roleCode != null">
and role_code = #{roleCode,jdbcType=VARCHAR}
</if>
<if test="levelCode != null">
and level_code = #{levelCode,jdbcType=VARCHAR}
</if>
<if test="auditStatus != null">
and audit_status = #{auditStatus,jdbcType=VARCHAR}
</if>
</select>
<select id="selectWithUserInfoByCondition" resultType="cn.wepact.dfm.training.dto.entity.TProfessionalFeedback">
SELECT
a.id,
a.user_id as userId,
a.org_code as orgCode,
a.category_code as categoryCode,
a.define_code as defineCode,
a.score,
a.specific_task as specificTask,
a.start_time as startTime,
a.end_time as endTime,
a.`number`,
a.unit_code as unitCode,
a.initiating_department as initiatingDepartment,
a.role_code as roleCode,
a.level_code as levelCode,
a.proof_material as proofMaterial,
a.audit_status as auditStatus,
a.auditor,
a.audit_date as auditDate,
a.created_at as createdAt,
a.created_by as createdBy,
a.updated_at as updatedAt,
a.updated_by as updatedBy,
a.del_flag as delFlag,
a.remarks,
b.username,
b.user_no as userNo
FROM
t_professional_feedback a left join
t_user b on a.user_id = b.id
WHERE
a.del_flag = 0
<if test="orgCode != null">
and a.org_code = #{orgCode,jdbcType=VARCHAR}
</if>
<if test="categoryCode != null">
and a.category_code = #{categoryCode,jdbcType=VARCHAR}
</if>
<if test= "defineCode != null">
and a.define_code = #{defineCode, jdbcType=VARCHAR}
</if>
<if test="defineCodeList != null">
<foreach collection="defineCodeList" item="item" open="and a.define_code in (" close=")" separator=",">
#{item,jdbcType=VARCHAR}
</foreach>
</if>
<if test="specificTask != null">
and specific_task like CONCAT("%", #{specificTask,jdbcType=VARCHAR}, "%")
</if>
<if test="startTime != null">
and a.start_time = #{startTime,jdbcType=TIMESTAMP}
</if>
<if test="endTime != null">
and a.end_time = #{endTime,jdbcType=TIMESTAMP}
</if>
<if test="number != null">
and a.`number` = #{number,jdbcType=INTEGER}
</if>
<if test="unitCode != null">
and a.unit_code = #{unitCode,jdbcType=VARCHAR}
</if>
<if test="initiatingDepartment != null">
and a.initiating_department = #{initiatingDepartment,jdbcType=VARCHAR}
</if>
<if test="roleCode != null">
and a.role_code = #{roleCode,jdbcType=VARCHAR}
</if>
<if test="levelCode != null">
and a.level_code = #{levelCode,jdbcType=VARCHAR}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_professional_feedback
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TProfessionalFeedback" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TProfessionalFeedback" useGeneratedKeys="true">
insert into t_professional_feedback
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="orgCode != null">
org_code,
</if>
<if test="categoryCode != null">
category_code,
</if>
<if test="defineCode != null">
define_code,
</if>
<if test="score != null">
score,
</if>
<if test="specificTask != null">
specific_task,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="number != null">
`number`,
</if>
<if test="unitCode != null">
unit_code,
</if>
<if test="initiatingDepartment != null">
initiating_department,
</if>
<if test="roleCode != null">
role_code,
</if>
<if test="levelCode != null">
level_code,
</if>
<if test="proofMaterial != null">
proof_material,
</if>
<if test="auditStatus != null">
audit_status,
</if>
<if test="auditor != null">
auditor,
</if>
<if test="auditDate != null">
audit_date,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="remarks != null">
remarks,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="orgCode != null">
#{orgCode,jdbcType=VARCHAR},
</if>
<if test="categoryCode != null">
#{categoryCode,jdbcType=VARCHAR},
</if>
<if test="defineCode != null">
#{defineCode,jdbcType=VARCHAR},
</if>
<if test="score != null">
#{score,jdbcType=REAL},
</if>
<if test="specificTask != null">
#{specificTask,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="number != null">
#{number,jdbcType=INTEGER},
</if>
<if test="unitCode != null">
#{unitCode,jdbcType=VARCHAR},
</if>
<if test="initiatingDepartment != null">
#{initiatingDepartment,jdbcType=VARCHAR},
</if>
<if test="roleCode != null">
#{roleCode,jdbcType=VARCHAR},
</if>
<if test="levelCode != null">
#{levelCode,jdbcType=VARCHAR},
</if>
<if test="proofMaterial != null">
#{proofMaterial,jdbcType=VARCHAR},
</if>
<if test="auditStatus != null">
#{auditStatus,jdbcType=VARCHAR},
</if>
<if test="auditor != null">
#{auditor,jdbcType=VARCHAR},
</if>
<if test="auditDate != null">
#{auditDate,jdbcType=TIMESTAMP},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
<if test="remarks != null">
#{remarks,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TProfessionalFeedback">
update t_professional_feedback
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="orgCode != null">
org_code = #{orgCode,jdbcType=VARCHAR},
</if>
<if test="categoryCode != null">
category_code = #{categoryCode,jdbcType=VARCHAR},
</if>
<if test="defineCode != null">
define_code = #{defineCode,jdbcType=VARCHAR},
</if>
<if test="score != null">
score = #{score,jdbcType=REAL},
</if>
<if test="specificTask != null">
specific_task = #{specificTask,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="number != null">
`number` = #{number,jdbcType=INTEGER},
</if>
<if test="unitCode != null">
unit_code = #{unitCode,jdbcType=VARCHAR},
</if>
<if test="initiatingDepartment != null">
initiating_department = #{initiatingDepartment,jdbcType=VARCHAR},
</if>
<if test="roleCode != null">
role_code = #{roleCode,jdbcType=VARCHAR},
</if>
<if test="levelCode != null">
level_code = #{levelCode,jdbcType=VARCHAR},
</if>
<if test="proofMaterial != null">
proof_material = #{proofMaterial,jdbcType=VARCHAR},
</if>
<if test="auditStatus != null">
audit_status = #{auditStatus,jdbcType=VARCHAR},
</if>
<if test="auditor != null">
auditor = #{auditor,jdbcType=VARCHAR},
</if>
<if test="auditDate != null">
audit_date = #{auditDate,jdbcType=TIMESTAMP},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
<if test="remarks != null">
remarks = #{remarks,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<!-- <update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TProfessionalFeedback">-->
<!-- update t_professional_feedback-->
<!-- set user_id = #{userId,jdbcType=BIGINT},-->
<!-- org_code = #{orgCode,jdbcType=VARCHAR},-->
<!-- category_code = #{categoryCode,jdbcType=VARCHAR},-->
<!-- 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>-->
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TProfessionalFeedback">
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}
</update>
</mapper>

View File

@@ -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<TProfessionalStdRule, Long> {
List<TProfessionalStdRule> selectByCondition(TProfessionalStdRule tProfessionalStdRule);
}

View File

@@ -0,0 +1,246 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.TProfessionalStdRuleMapper">
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TProfessionalStdRule">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="org_code" jdbcType="VARCHAR" property="orgCode" />
<result column="qualification_level" jdbcType="VARCHAR" property="qualificationLevel" />
<result column="category_code" jdbcType="VARCHAR" property="categoryCode" />
<result column="define_code" jdbcType="VARCHAR" property="defineCode" />
<result column="role_code" jdbcType="VARCHAR" property="roleCode" />
<result column="level_code" jdbcType="VARCHAR" property="levelCode" />
<result column="score" jdbcType="REAL" property="score" />
<result column="required_qlevel" jdbcType="VARCHAR" property="requiredQlevel" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_professional_std_rule
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectByCondition" resultMap="BaseResultMap"
parameterType="cn.wepact.dfm.training.dto.entity.TProfessionalStdRule">
SELECT
<include refid="Base_Column_List" />
FROM
t_professional_std_rule
WHERE
del_flag = 0
<if test="orgCode != null and orgCode != ''">
and org_code = #{orgCode,jdbcType=VARCHAR}
</if>
<if test="parentId != null">
and parent_id = #{parentId,jdbcType=BIGINT}
</if>
<if test="type != null">
and type = #{type,jdbcType=VARCHAR}
</if>
<if test="categoryCode != null">
and category_code = #{categoryCode,jdbcType=VARCHAR}
</if>
<if test="defineCode != null">
and define_code = #{defineCode,jdbcType=VARCHAR}
</if>
<if test="roleCode != null">
and role_code = #{roleCode,jdbcType=VARCHAR}
</if>
<if test="levelCode != null">
and level_code = #{levelCode,jdbcType=VARCHAR}
</if>
order by type
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_professional_std_rule
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TProfessionalStdRule" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TProfessionalStdRule" useGeneratedKeys="true">
insert into t_professional_std_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orgCode != null">
org_code,
</if>
<if test="qualificationLevel != null">
qualification_level,
</if>
<if test="categoryCode != null">
category_code,
</if>
<if test="defineCode != null">
define_code,
</if>
<if test="roleCode != null">
role_code,
</if>
<if test="levelCode != null">
level_code,
</if>
<if test="score != null">
score,
</if>
<if test="requiredQlevel != null">
required_qlevel,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="type != null">
`type`,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orgCode != null">
#{orgCode,jdbcType=VARCHAR},
</if>
<if test="qualificationLevel != null">
#{qualificationLevel, jdbcType=VARCHAR},
</if>
<if test="categoryCode != null">
#{categoryCode,jdbcType=VARCHAR},
</if>
<if test="defineCode != null">
#{defineCode,jdbcType=VARCHAR},
</if>
<if test="roleCode != null">
#{roleCode,jdbcType=VARCHAR},
</if>
<if test="levelCode != null">
#{levelCode,jdbcType=VARCHAR},
</if>
<if test="score != null">
#{score,jdbcType=REAL},
</if>
<if test="requiredQlevel != null">
#{requiredQlevel,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
#{parentId,jdbcType=BIGINT},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TProfessionalStdRule">
update t_professional_std_rule
<set>
<if test="orgCode != null">
org_code = #{orgCode,jdbcType=VARCHAR},
</if>
<if test="qualificationLevel != null">
qualification_level = #{qualificationLevel, jdbcType=VARCHAR},
</if>
<if test="categoryCode != null">
category_code = #{categoryCode,jdbcType=VARCHAR},
</if>
<if test="defineCode != null">
define_code = #{defineCode,jdbcType=VARCHAR},
</if>
<if test="roleCode != null">
role_code = #{roleCode,jdbcType=VARCHAR},
</if>
<if test="levelCode != null">
level_code = #{levelCode,jdbcType=VARCHAR},
</if>
<if test="score != null">
score = #{score,jdbcType=REAL},
</if>
<if test="requiredQlevel != null">
required_qlevel = #{requiredQlevel,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=BIGINT},
</if>
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TProfessionalStdRule">
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}
</update>
</mapper>

View File

@@ -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<TQualificationReview, Long> {
List<TQualificationReview> selectByCondition(AppliedParam appliedParam);
List<TQualificationReview> 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);
}

View File

@@ -0,0 +1,414 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.TQualificationReviewMapper">
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TQualificationReview">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="current_department" jdbcType="VARCHAR" property="currentDepartment" />
<result column="qualification_standards_id" jdbcType="BIGINT" property="qualificationStandardsId" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="review_time" jdbcType="TIMESTAMP" property="reviewTime" />
<result column="professional_score" jdbcType="DECIMAL" property="professionalScore" />
<result column="professional_tip" jdbcType="VARCHAR" property="professionalTip" />
<result column="elective_course_score" jdbcType="DECIMAL" property="electiveCourseScore" />
<result column="compulsory_course_score" jdbcType="DECIMAL" property="compulsoryCourseScore" />
<result column="offline_score" jdbcType="DECIMAL" property="offlineScore" />
<result column="org_code" jdbcType="VARCHAR" property="orgCode" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
<result column="project_id" jdbcType="BIGINT" property="projectId" /> <!-- 新增的项目ID字段 -->
</resultMap>
<sql id="Base_Column_List">
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 <!-- 新增的项目ID字段 -->
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_qualification_review
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectByCondition" resultType="cn.wepact.dfm.training.dto.entity.TQualificationReview"
parameterType="cn.wepact.dfm.training.dto.AppliedParam">
SELECT
a.id,
a.user_id as userId,
a.current_department as currentDepartment,
a.`status`,
a.review_time as reviewTime,
b.position_name as positionName,
b.qualification_level as qualificationLevel,
a.compulsory_course_score as compulsoryCourseScore,
a.offline_score as offlineScore,
a.elective_course_score as electiveCourseScore,
a.professional_score as professionalScore,
a.professional_tip as professionalTip,
a.created_at as createdAt,
a.qualification_standards_id as qualificationStandardsId
FROM
t_qualification_review a,
t_qualification_standards b
WHERE
a.qualification_standards_id = b.id
and a.del_flag = 0
<if test="userId != null">
and a.user_id = #{userId}
</if>
<if test="orgCode != null">
and a.org_code = #{orgCode}
</if>
<if test="level != null and level!=''">
and b.qualification_level = #{level}
</if>
<if test="positionName != null and positionName != ''">
and b.position_name = #{positionName}
</if>
<if test="status != null">
and a.`status` = #{status}
</if>
<if test="statusList != null">
<foreach collection="statusList" item="item" open="and a.status in (" separator="," close=")">
#{item}
</foreach>
</if>
<if test="reviewTime != null">
and a.`review_time` = #{reviewTime}
</if>
<if test="startTime != null">
and a.`review_time` >= #{startTime}
</if>
ORDER BY a.created_at desc
</select>
<select id="selectWithUserInfoByCondition" resultType="cn.wepact.dfm.training.dto.entity.TQualificationReview"
parameterType="cn.wepact.dfm.training.dto.AppliedParam">
SELECT
a.id,
a.current_department as currentDepartment,
a.`status`,
a.review_time as reviewTime,
b.position_name as positionName,
b.qualification_level as qualificationLevel,
a.compulsory_course_score as compulsoryCourseScore,
a.offline_score as offlineScore,
a.elective_course_score as electiveCourseScore,
a.professional_score as professionalScore,
a.professional_tip as professionalTip,
a.created_at as createdAt,
c.username,
c.user_no as userNo
FROM
t_qualification_review a,
t_qualification_standards b,
t_user c
WHERE
a.qualification_standards_id = b.id
and a.user_id = c.id
and a.del_flag = 0
<if test="userId != null">
and a.user_id = #{userId}
</if>
<if test="orgCode != null">
and a.org_code = #{orgCode}
</if>
<if test="level != null and level!=''">
and b.qualification_level = #{level}
</if>
<if test="positionName != null and positionName != ''">
and b.position_name = #{positionName}
</if>
<if test="positionNameList != null">
<foreach collection="positionNameList" item="item" open="and b.position_name in (" close=")" separator=",">
#{item,jdbcType=VARCHAR}
</foreach>
</if>
<if test="status != null and status !=''">
and a.`status` = #{status}
</if>
<if test="username != null and username != ''">
and c.`username` = #{username}
</if>
<if test="userNo != null and userNo != ''">
and c.`user_no` = #{userNo}
</if>
<if test="statusList != null">
<foreach collection="statusList" item="item" open="and a.status in (" separator="," close=")">
#{item}
</foreach>
</if>
<if test="reviewTime != null">
and a.`review_time` = #{reviewTime}
</if>
<if test="startTime != null">
and a.`review_time` >= #{startTime}
</if>
ORDER BY a.created_at desc
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_qualification_review
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TQualificationReview" useGeneratedKeys="true">
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}) <!-- 新增的项目ID字段 -->
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TQualificationReview" useGeneratedKeys="true">
insert into t_qualification_review
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="currentDepartment != null">
current_department,
</if>
<if test="qualificationStandardsId != null">
qualification_standards_id,
</if>
<if test="status != null">
`status`,
</if>
<if test="reviewTime != null">
`review_time`,
</if>
<if test="professionalScore !=null">
professional_score,
</if>
<if test="professionalTip !=null">
professional_tip,
</if>
<if test="electiveCourseScore != null">
elective_course_score,
</if>
<if test="compulsoryCourseScore != null">
compulsory_course_score,
</if>
<if test="offlineScore != null">
offline_score,
</if>
<if test="orgCode != null">
org_code,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="projectId != null">
project_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="currentDepartment != null">
#{currentDepartment,jdbcType=VARCHAR},
</if>
<if test="qualificationStandardsId != null">
#{qualificationStandardsId,jdbcType=BIGINT},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="reviewTime != null">
#{reviewTime,jdbcType=TIMESTAMP},
</if>
<if test="professionalScore !=null">
#{professionalScore, jdbcType=DECIMAL},
</if>
<if test="professionalTip != null">
#{professionalTip, jdbcType=VARCHAR},
</if>
<if test="electiveCourseScore != null">
#{electiveCourseScore,jdbcType=DECIMAL},
</if>
<if test="compulsoryCourseScore != null">
#{compulsoryCourseScore,jdbcType=DECIMAL},
</if>
<if test="offlineScore!= null">
#{offlineScore,jdbcType=DECIMAL},
</if>
<if test="orgCode != null">
#{orgCode,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TQualificationReview">
update t_qualification_review
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="currentDepartment != null">
current_department = #{currentDepartment,jdbcType=VARCHAR},
</if>
<if test="qualificationStandardsId != null">
qualification_standards_id = #{qualificationStandardsId,jdbcType=BIGINT},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="reviewTime != null">
review_time = #{reviewTime,jdbcType=TIMESTAMP},
</if>
<if test="professionalScore != null">
professional_score = #{professionalScore, jdbcType=DECIMAL},
</if>
<if test="professionalTip != null">
professional_tip = #{professionalTip, jdbcType=VARCHAR},
</if>
<if test="professionalScore != null">
professional_score = #{professionalScore, jdbcType=DECIMAL},
</if>
<if test="professionalTip != null">
professional_tip = #{professionalTip, jdbcType=VARCHAR},
</if>
<if test="electiveCourseScore != null">
elective_course_score = #{electiveCourseScore,jdbcType=DECIMAL},
</if>
<if test="compulsoryCourseScore != null">
compulsory_course_score = #{compulsoryCourseScore,jdbcType=DECIMAL},
</if>
<if test="offlineScore != null">
offline_score = #{offlineScore,jdbcType=DECIMAL},
</if>
<if test="orgCode != null">
org_code = #{orgCode,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TQualificationReview">
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} <!-- 新增的项目ID字段 -->
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findByUserIdAndProjectId" resultMap="BaseResultMap">
SELECT *
FROM t_qualification_review
WHERE user_id = #{userId}
AND project_id = #{projectId}
AND status IN ('0', '1', '2', '3')
AND del_flag = '0' <!-- 假设 "del_flag" 表示删除标记 -->
</select>
<insert id="insertQualificationReview">
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}
)
</insert>
<!-- 更新资格审核记录 -->
<update id="updateQualificationReview" parameterType="cn.wepact.dfm.training.dto.entity.TQualificationReview">
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')
</update>
</mapper>

View File

@@ -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<TQualificationStandards, Long> {
List<TQualificationStandards> selectAllByOrgCode(@Param("orgCode") String orgCode);
List<TQualificationStandards> 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);
}

View File

@@ -0,0 +1,231 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.TQualificationStandardsMapper">
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TQualificationStandards">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="position_name" jdbcType="VARCHAR" property="positionName" />
<result column="qualification_level" jdbcType="VARCHAR" property="qualificationLevel" />
<result column="org_code" jdbcType="VARCHAR" property="orgCode" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
<result column="qualification_criteria" jdbcType="LONGVARCHAR" property="qualificationCriteria" />
</resultMap>
<sql id="Base_Column_List">
id, position_name, qualification_level, org_code, created_at,
created_by, updated_at, updated_by, del_flag,qualification_criteria
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_qualification_standards
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectAllByOrgCode" resultType="cn.wepact.dfm.training.dto.entity.TQualificationStandards"
parameterType="java.lang.String">
SELECT
id,
position_name as positionName,
qualification_level as qualificationLevel,
qualification_criteria as qualificationCriteria
FROM
t_qualification_standards
WHERE
del_flag = '0'
AND org_code = #{orgCode}
</select>
<select id="selectByCondition" resultType="cn.wepact.dfm.training.dto.entity.TQualificationStandards"
parameterType="cn.wepact.dfm.training.dto.InternalInfoParam">
SELECT
id,
position_name as positionName,
qualification_level as qualificationLevel,
qualification_criteria as qualificationCriteria
FROM
t_qualification_standards
WHERE
del_flag = '0'
<if test="orgCode != null">
AND org_code = #{orgCode}
</if>
<if test="positionName != null">
AND position_name like CONCAT('%',#{positionName},'%')
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_qualification_standards
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TQualificationStandards" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TQualificationStandards" useGeneratedKeys="true">
insert into t_qualification_standards
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="positionName != null">
position_name,
</if>
<if test="qualificationLevel != null">
qualification_level,
</if>
<if test="orgCode != null">
org_code,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="qualificationCriteria != null">
qualification_criteria,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="positionName != null">
#{positionName,jdbcType=VARCHAR},
</if>
<if test="qualificationLevel != null">
#{qualificationLevel,jdbcType=VARCHAR},
</if>
<if test="orgCode != null">
#{orgCode,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
<if test="qualificationCriteria != null">
#{qualificationCriteria,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TQualificationStandards">
update t_qualification_standards
<set>
<if test="positionName != null">
position_name = #{positionName,jdbcType=VARCHAR},
</if>
<if test="qualificationLevel != null">
qualification_level = #{qualificationLevel,jdbcType=VARCHAR},
</if>
<if test="orgCode != null">
org_code = #{orgCode,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
<if test="qualificationCriteria != null">
qualification_criteria = #{qualificationCriteria,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<!-- <update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TQualificationStandards">-->
<!-- 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},-->
<!-- qualification_criteria = #{qualificationCriteria,jdbcType=LONGVARCHAR}-->
<!-- where id = #{id,jdbcType=BIGINT}-->
<!-- </update>-->
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TQualificationStandards">
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}
</update>
<select id="findById" resultMap="BaseResultMap">
SELECT
id,
position_name,
qualification_level,
org_code,
qualification_criteria,
created_at,
created_by,
updated_at,
updated_by,
del_flag
FROM
t_qualification_standards
WHERE
id = #{id}
AND
del_flag = '0'
</select>
<select id="findByIdAndOrgCode" resultMap="BaseResultMap">
SELECT
id,
position_name,
qualification_level,
org_code,
qualification_criteria,
created_at,
created_by,
updated_at,
updated_by,
del_flag
FROM
t_qualification_standards
WHERE
id = #{qualificationStandardsId}
AND org_code = #{orgCode}
AND del_flag = '0'
</select>
</mapper>

View File

@@ -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<TUser, Long> {
// 根据用户名查询用户信息
List<TUser> selectByConditions(TUser tUser);
TUser selectByUserNo(String userNo);
/**
* 根据 username 查询用户的 id
* @param username 用户名
* @return 用户 ID
*/
Long findUserIdByUsername(@Param("username") String username);
}

View File

@@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.TUserMapper">
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TUser">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="user_avatar" jdbcType="VARCHAR" property="userAvatar" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="user_no" jdbcType="INTEGER" property="userNo" />
<result column="show_tip" jdbcType="VARCHAR" property="showTip" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
id, username, `password`, user_avatar, user_no, show_tip, updated_at, updated_by, created_at,
created_by, del_flag, email
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_user
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_user
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TUser" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TUser" useGeneratedKeys="true">
insert into t_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="username != null">
username,
</if>
<if test="password != null">
`password`,
</if>
<if test="userAvatar != null">
user_avatar,
</if>
<if test="userNo != null">
user_no,
</if>
<if test="email != null">
email,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="userAvatar != null">
#{userAvatar,jdbcType=VARCHAR},
</if>
<if test="userNo != null">
#{userNo,jdbcType=INTEGER},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TUser">
update t_user
<set>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
`password` = #{password,jdbcType=VARCHAR},
</if>
<if test="userAvatar != null">
user_avatar = #{userAvatar,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="userNo != null">
user_no = #{userNo,jdbcType=INTEGER},
</if>
<if test="showTip != null">
show_tip = #{showTip,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TUser">
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}
</update>
<!-- 根据用户名查询用户信息 -->
<select id="selectByUserNo" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM t_user
WHERE user_no = #{userNo}
and del_flag='0'
</select>
<select id="selectByConditions" resultType="cn.wepact.dfm.training.dto.entity.TUser">
SELECT
a.user_no as userNo,
a.show_tip as showTip,
a.username,
a.`password`,
a.id,
b.user_type as userType,
b.pre_type as preType,
b.org_code as `orgCode`,
a.email
FROM t_user a,
t_user_permission b
WHERE
a.id = b.user_id
and a.user_no = #{userNo}
and b.org_code = #{orgCode}
and a.del_flag = '0'
and b.del_flag ='0'
</select>
<select id="findUserIdByUsername" resultType="java.lang.Long">
SELECT id FROM t_user WHERE user_no = #{username}
</select>
</mapper>

View File

@@ -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<TUserPermission, Long> {
List<TUserPermission> selectByUserId(@Param("userId") Long userId);
}

View File

@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wepact.dfm.training.mapper.TUserPermissionMapper">
<resultMap id="BaseResultMap" type="cn.wepact.dfm.training.dto.entity.TUserPermission">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="user_type" jdbcType="VARCHAR" property="userType" />
<result column="org_code" jdbcType="VARCHAR" property="orgCode" />
<result column="pre_type" jdbcType="VARCHAR" property="preType" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
id, user_id, user_type, org_code, pre_type, updated_at, updated_by, created_at,
created_by, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_user_permission
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectByUserId" resultMap="BaseResultMap"
parameterType="java.lang.Long">
select
<include refid="Base_Column_List" />
from t_user_permission
where user_id = #{userId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_user_permission
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TUserPermission" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.wepact.dfm.training.dto.entity.TUserPermission" useGeneratedKeys="true">
insert into t_user_permission
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="userType != null">
user_type,
</if>
<if test="orgCode != null">
org_code,
</if>
<if test="preType != null">
pre_type,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="userType != null">
#{userType,jdbcType=VARCHAR},
</if>
<if test="orgCode != null">
#{orgCode,jdbcType=BIGINT},
</if>
<if test="preType != null">
#{preType,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.wepact.dfm.training.dto.entity.TUserPermission">
update t_user_permission
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="userType != null">
user_type = #{userType,jdbcType=VARCHAR},
</if>
<if test="orgCode != null">
org_code = #{orgCode,jdbcType=VARCHAR},
</if>
<if test="preType != null">
pre_type = #{preType,jdbcType=VARCHAR},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.wepact.dfm.training.dto.entity.TUserPermission">
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}
</update>
</mapper>

View File

@@ -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<TEvidenceSubmission> getPersonalBehaviorEvidenceList(PageParam<TEvidenceSubmission> param){
PageHelper.startPage(param.getPageNo(),param.getPageSize());
List<TEvidenceSubmission> tProfessionalFeedbacks = tEvidenceSubmissionMapper.selectByCondition(param.getCondition());
PageInfo<TEvidenceSubmission> 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);
}
}

View File

@@ -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<TDictionary> getDictionaryList(TDictionary tDictionary) {
return tDictionaryMapper.selectByCondition(tDictionary);
}
// 新增字典
public Integer addDictionary(TDictionary tDictionary) {
return tDictionaryMapper.insertSelective(tDictionary);
}
}

View File

@@ -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<TQualificationStandards> getInternalInformationList(PageParam<InternalInfoParam> internalInfoParam){
PageHelper.startPage(internalInfoParam.getPageNo(),internalInfoParam.getPageSize());
List<TQualificationStandards> tQualificationStandards = tQualificationStandardsMapper.selectByCondition(internalInfoParam.getCondition());
PageInfo<TQualificationStandards> 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<TDictionary> 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<TDictionary> tDictionaries = dictionaryService.getDictionaryList(param);
if(!CollectionUtils.isEmpty(tDictionaries)){
return tDictionaries.stream().max((o1, o2) -> o1.getVersion() - o2.getVersion()).get();
}
return null;
}
}

View File

@@ -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<String> getQualificationLevelList() {
// return tDictionaryMapper.selectAllByType("qualification_level");
// }
//任职申请基本信息查询
public void queryBasicInformation(){
return;
}
//任职资格序列列表
public List<TQualificationStandards> 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<TProfessionalStdRule> tProfessionalStdRules = tProfessionalStdRuleMapper.selectByCondition(tProfessionalStdRule);
List<TProfessionalStdRule> professionalFeedbackCategoryList = professionalFeedbackService.getProfessionalFeedbackCategoryStruct(user);
Map<String, String> 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<TProfessionalFeedback> scores = tProfessionalFeedbackMapper.selectByCondition(tProfessionalFeedback);
Float totalScore = 0f;
Map<String,Float> 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<TProfessionalStdRule> 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<String, CourseListResponse> isLearningExamInProgress(TUser userInfo){
AppliedParam param = new AppliedParam();
param.setUserId(userInfo.getId());
List<String> 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<TQualificationReview> tQualificationReviews = tQualificationReviewMapper.selectByCondition(param);
if(CollectionUtil.isEmpty(tQualificationReviews)){
return null;
}
Map<String, CourseListResponse> 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<TQualificationReview> getDeclaredQualificationList(PageParam<AppliedParam> appliedParam){
PageHelper.startPage(appliedParam.getPageNo(), appliedParam.getPageSize());
List<TQualificationReview> tQualificationReviews = tQualificationReviewMapper.selectByCondition(appliedParam.getCondition());
PageInfo<TQualificationReview> pageInfo = new PageInfo<>(tQualificationReviews);
return pageInfo;
}
//获取两年内的通过的任职资格列表
public List<TQualificationReview> 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<String> statusList = new ArrayList<>();
statusList.add("5");
statusList.add("7");
param.setStatusList(statusList);
List<TQualificationReview> data = tQualificationReviewMapper.selectByCondition(param);
AtomicReference<Boolean> 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<TQualificationReview> getQualificationAuditList(PageParam<AppliedParam> appliedParam, TUser tUser){
PageHelper.startPage(appliedParam.getPageNo(), appliedParam.getPageSize());
List<TUserPermission> 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<TQualificationReview> tQualificationReviews = tQualificationReviewMapper.selectWithUserInfoByCondition(appliedParam.getCondition());
PageInfo<TQualificationReview> 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<TPerformanceRule> getPerformanceRuleList(String orgCode) {
TPerformanceRule param = new TPerformanceRule();
param.setOrgCode(orgCode);
return tPerformanceRuleMapper.selectByConditions(param);
}
public TAppCheck getAppCheck(TAppCheck param) {
List<TAppCheck> 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);
}
}

View File

@@ -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<TProfessionalFeedback> getProfessionalFeedbackList(PageParam<TProfessionalFeedback> tProfessionalFeedback){
PageHelper.startPage(tProfessionalFeedback.getPageNo(),tProfessionalFeedback.getPageSize());
List<TProfessionalFeedback> tProfessionalFeedbacks = tProfessionalFeedbackMapper.selectByCondition(tProfessionalFeedback.getCondition());
PageInfo<TProfessionalFeedback> pageInfo = new PageInfo<>(tProfessionalFeedbacks);
return pageInfo;
}
public PageInfo<TProfessionalFeedback> getProfessionalFeedbackByRoleList(PageParam<TProfessionalFeedback> tProfessionalFeedback, TUser tUser){
PageHelper.startPage(tProfessionalFeedback.getPageNo(),tProfessionalFeedback.getPageSize());
List<TUserPermission> 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<TProfessionalFeedback> tProfessionalFeedbacks = tProfessionalFeedbackMapper.selectWithUserInfoByCondition(tProfessionalFeedback.getCondition());
PageInfo<TProfessionalFeedback> 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<TDictionary> getProfessionalFeedbackCategoryList(TUser userInfo){
TDictionary tDictionary = TDictionary.builder().type("professional_type")
.orgCode(userInfo.getOrgCode()).build();
return dictionaryService.getDictionaryList(tDictionary);
}
public List<TProfessionalStdRule> getProfessionalFeedbackCategoryStruct(TUser userInfo){
TDictionary tDictionary = TDictionary.builder().orgCode(userInfo.getOrgCode()).build();
List<TDictionary> dicts = dictionaryService.getDictionaryList(tDictionary);
Map<String, TDictionary> typeDictMap = new HashMap<>();
Map<String, TDictionary> defineDictMap = new HashMap<>();
Map<String, TDictionary> roleDictMap = new HashMap<>();
Map<String, TDictionary> 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<TProfessionalStdRule> tProfessionalStdRules = tProfessionalStdRuleMapper.selectByCondition(param);
Map<Long, TProfessionalStdRule> 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<TDictionary> getProfessionalFeedbackUnitList(TUser userInfo){
TDictionary tDictionary = TDictionary.builder().type("professional_unit")
.orgCode(userInfo.getOrgCode()).build();
return dictionaryService.getDictionaryList(tDictionary);
}
//获取专业回馈角色列表
public List<TDictionary> getProfessionalFeedbackRoleList(TUser userInfo){
TDictionary tDictionary = TDictionary.builder().type("professional_role")
.orgCode(userInfo.getOrgCode()).build();
return dictionaryService.getDictionaryList(tDictionary);
}
//获取专业回馈层级列表
public List<TDictionary> 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<TQualificationReview> 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<TDictionary> getProfessionalFeedbackDefineList(TUser userInfo){
TDictionary tDictionary = TDictionary.builder().type("professional_define")
.orgCode(userInfo.getOrgCode()).build();
return dictionaryService.getDictionaryList(tDictionary);
}
//查看专业回馈信息(废弃)
// public void viewProfessionalFeedbackInfo(){
// return;
// }
}

View File

@@ -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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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;
}
}

View File

@@ -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<String> 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<String, Object> 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<String, Object> 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<TaskScoreSummary> 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<String, Object> 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<String, Object> 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<TaskScoreSummary> 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);
}
}

View File

@@ -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<String> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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;
}
}

View File

@@ -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<TUser> 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<TUserPermission> 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<String, String> 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<TUser> 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<TOrg> 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<Boolean> updatePwd(TUser tUser) {
GeneralRespBean<Boolean> 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;
}
}

View File

@@ -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<String> getUserRoleList() {
//
// List<String> roleList = new ArrayList<>();
//
// List<MoreUser> 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<Integer> getUserDataRangeAll(String userAccount) {
// log.info("获取登录人有哪些组织的权限");
// String menuCode = getRequest().getHeader("menuCode");
// Map<String,Object> paramMap = new HashMap<>();
// paramMap.put("menuCode",menuCode);
// paramMap.put("userAccount",userAccount);
// GeneralRespBean<List<Map>> respBean = orgFeignClient.getOrgAuthorityByMenuCodeTwo(paramMap);
// if (respBean.getCode().equals("200")){
// if (respBean.getData()!=null){
// List<Integer> 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<>();
// }
//}

View File

@@ -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()+"%";
}
}

View File

@@ -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";//专项附加扣除项
}

View File

@@ -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);
//
// }
}

View File

@@ -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密文
*
* <pre>
* org.apache.commons.codec.digest.DigestUtils
* </pre>
*
* @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));
}
}

View File

@@ -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();
* <p>
* return Date
*
* @return
*/
public static Date getSystemDate() {
return new Date();
}
/**
* Example: getSystemDate("yyyyMMdd");
* <p>
* return 20110820
*
* @param format
* @return
*/
public static String getSystemDateString(String format) {
return formatDate(new Date(), format);
}
/**
* Example: getCurrentTime();
* <p>
* return 20110820101010222
*
* @param
* @return
*/
public static String getCurrentTime() {
return getSystemDateString(YYYYMMDDHHMMSSSSS);
}
/**
* Example: formatDate(date, "yyyyMMdd");
* <p>
* 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");
* <p>
* 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<String> 返回类型
* @author gaod
* @date 2017年12月8日 上午11:07:50
*/
public static List<String> getBeforeMonth(int n){
List<String> monthList=new ArrayList<String>();
//获取当前时间的前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<String> getDates(Date d1,Date d2){
List<String> dates = new ArrayList<String>();
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;
}
}

View File

@@ -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 字符串
}
}

View File

@@ -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<String, Object> 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<String, Object> 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;
}
}

View File

@@ -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;
}
}

View File

@@ -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<T> {
/**
* 将集合按len数量分成若干个list
* @param list
* @param len 每个集合的数量
* @return
*/
public List<List<T>> splitList(List<T> list, int len) {
if (list == null || list.size() == 0 || len < 1) {
return null;
}
List<List<T>> result = new ArrayList<>();
int size = list.size();
int count = (size + len - 1) / len;
for (int i = 0; i < count; i++) {
List<T> subList = list.subList(i * len, ((i + 1) * len > size ? size : len * (i + 1)));
result.add(subList);
}
return result;
}
}

View File

@@ -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;
}
}

View File

@@ -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();
}
}

View File

@@ -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<String, Object> 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<String> 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<String> 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<String, String> map) {
stringRedisTemplate.opsForValue().multiSet(map);
}
public void multiSetObject(Map<String, Object> map) {
redisTemplate.opsForValue().multiSet(map);
}
/**
* 批量查询value
*
* @param keys 键集合
* @return 值集合
*/
public List<String> multiGetString(Set<String> keys) {
return stringRedisTemplate.opsForValue().multiGet(keys);
}
public List<Object> multiGetObject(Set<String> 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<String> getStringValues(String patternKey) {
return multiGetString((Set<String>) keys(patternKey));
}
public List<Object> getObjectValues(String patternKey) {
return multiGetObject((Set<String>) 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<Object> allElementsOfList(final String key) {
return rangeElementsOfList(key, 0L, -1L);
}
/**
* 获取指定key的指定范围的list
*
* @param key 键
* @param strIndex 开始角标
* @param endIndex 结束角标
* @return 指定范围的list
*/
public List<Object> 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<Object> 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<Object> 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<Object> 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<String> geoLocation) {
return stringRedisTemplate.opsForGeo().add(key, geoLocation);
}
/**
* 从键里面返回所有给定位置元素的位置(经度和纬度)
*
* @param key 键
* @param members 名称
* @return 经纬度封装对象列表
*/
public List<Point> 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<RedisGeoCommands.GeoLocation<String>> geoRadius(final String key, Circle circle) {
return stringRedisTemplate.opsForGeo().radius(key, circle);
}
/**
* 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。
*
* @param key 键
* @param circle 给定的经纬度,以及半径
* @param geoRadiusCommandArgs 额外命令
* @return 所有符合距离的位置元素
*/
public GeoResults<RedisGeoCommands.GeoLocation<String>> 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<RedisGeoCommands.GeoLocation<String>> geoRadius(final String key, String member, double radius) {
return stringRedisTemplate.opsForGeo().radius(key, member, radius);
}
/**
* 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。
*
* @param key 键
* @param member 存储的位置名称
* @param distance 半径
* @return 所有符合距离的位置元素
*/
public GeoResults<RedisGeoCommands.GeoLocation<String>> geoRadius(final String key, String member, Distance distance) {
return stringRedisTemplate.opsForGeo().radius(key, member, distance);
}
/**
* 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。
*
* @param key 键
* @param member 存储的位置名称
* @param distance 半径
* @return 所有符合距离的位置元素
*/
public GeoResults<RedisGeoCommands.GeoLocation<String>> 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<String> geoHash(final String key, String... members) {
return stringRedisTemplate.opsForGeo().hash(key, members);
}
}

View File

@@ -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<bytes.length;i++){
temp = Integer.toHexString(bytes[i] & 0xFF);
if (temp.length()==1){
//1得到一位的进行补0操作
stringBuffer.append("0");
}
stringBuffer.append(temp);
}
return stringBuffer.toString();
}
}

View File

@@ -0,0 +1,57 @@
package cn.wepact.dfm.training.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.io.UnsupportedEncodingException;
import java.util.Base64;
/**
* Created by liuye on 2019/7/24.
*/
@Component
@RefreshScope
public class SignUtil {
private static Logger logger = LoggerFactory.getLogger(SignUtil.class);
private static String apiUser;
private static String apiPassword;
@Value("${api.user}")
public void setApiUser(String val) {
apiUser = val;
}
@Value("${api.password}")
public void setApiPassword(String val) {
apiPassword = val;
}
public static String makeBasicAuth() {
final Base64.Encoder encoder = Base64.getEncoder();
String text = apiUser + ':' + apiPassword;
String encodedText = null;
try {
final byte[] textByte = text.getBytes("UTF-8");
encodedText = encoder.encodeToString(textByte);
} catch (UnsupportedEncodingException e) {
logger.error("", e);
}
return "Basic " + encodedText;
}
public static String getPcToken() {
final Base64.Encoder encoder = Base64.getEncoder();
String text = apiUser + ':' + apiPassword;
String encodedText = null;
try {
final byte[] textByte = text.getBytes("UTF-8");
encodedText = encoder.encodeToString(textByte);
} catch (UnsupportedEncodingException e) {
logger.error("", e);
}
return "Basic " + encodedText;
}
}

View File

@@ -0,0 +1,88 @@
package cn.wepact.dfm.training.util;
import java.util.ArrayList;
import java.util.List;
public class StringSplitsUtil {
/**
* 把原始字符串分割成指定长度的字符串列表
*
* @param inputString
* 原始字符串
* @param length
* 指定长度
* @return
*/
public static List<String> 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<String> getStrList(String inputString, int length,
int size) {
List<String> list = new ArrayList<String>();
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;
}
}

View File

@@ -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;
}
}

View File

@@ -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<String> days) {
long days1 = getDays(date);
return getWorkingDays(days1, days);
}
/**
* 获取经过了几个工作日
*
* @param dayCount 天数
* @param days 工作日数组
* @return 工作日
*/
private static long getWorkingDays(long dayCount, String[] days) {
List<String> strings = Arrays.asList(days);
return getWorkingDays(dayCount, strings);
}
private static long getWorkingDays(long dayCount, List<String> days) {
Date date = new Date();
List<String> 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<String> days, int day,String today) throws ParseException {
if (days.size() < day + 1) {
return null;
}
Date current = new Date();
List<String> 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<String> days, int day) throws ParseException {
if (days.size() < day + 1) {
return null;
}
Date current = new Date();
List<String> 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);
}
}

Some files were not shown because too many files have changed in this diff Show More