Merge branch 'refs/heads/dev-local'

# Conflicts:
#	src/other/temp.js
main
cs 3 months ago
commit 55510d34f7

@ -1,10 +0,0 @@
//
//
//
//
//
//
//
//
//
//

@ -0,0 +1,17 @@
package edu.ahbvc.recruit;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author c215
*/
@SpringBootApplication
@MapperScan(basePackages = "edu.ahbvc.recruit.mapper")
public class RecruitApplication {
public static void main(String[] args) {
SpringApplication.run(RecruitApplication.class, args);
}
}

@ -0,0 +1,24 @@
package edu.ahbvc.recruit.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
*
* value
* @SwitchMethod("register")
* @author c215
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
// 该注解可以用于方法上,
// 表示该方法可以被用于切换功能启用或禁用的方法
// 该注解的value属性用于指定功能类型的字符串值
// 例如:@SwitchMethod("register")
public @interface SwitchMethod {
// 用于指定功能类型的字符串值
String value() default "";
}

@ -0,0 +1,78 @@
package edu.ahbvc.recruit.aspect;
import edu.ahbvc.recruit.annotation.SwitchMethod;
import edu.ahbvc.recruit.model.ApiResponseData;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author c215
*/
@Aspect
@Component
public class MethodSwitch {
// 使用常量定义功能类型
// 注册
public static final String REGISTER = "register";
// 提交简历
public static final String SUBMIT = "submit";
// 尝试重新提交
public static final String TRY_SUBMIT = "trySubmit";
// 放弃投递
public static final String ABANDON = "abandon";
// 使用带有默认值的线程安全的Map存储开关状态
private static final Map<String, Boolean> METHOD_SWITCHES = new ConcurrentHashMap<>();
// 静态代码块,在类加载时执行,用于初始化开关状态
static {
// 默认情况下,所有功能都启用
METHOD_SWITCHES.put(REGISTER, true);
METHOD_SWITCHES.put(SUBMIT, true);
METHOD_SWITCHES.put(TRY_SUBMIT, true);
METHOD_SWITCHES.put(ABANDON, true);
}
// 统一设置方法
// 通过此方法可以动态地设置功能的开关状态
public static void setSwitch(String methodType, boolean enabled) {
// 检查方法类型是否存在
if (!METHOD_SWITCHES.containsKey(methodType)) {
throw new IllegalArgumentException("Invalid method type: " + methodType);
}
// 设置功能的开关状态
METHOD_SWITCHES.put(methodType, enabled);
}
// 统一获取方法
// 通过此方法可以获取功能的开关状态
public static boolean isEnabled(String methodType) {
// 检查方法类型是否存在
if (!METHOD_SWITCHES.containsKey(methodType)) {
throw new IllegalArgumentException("Invalid method type: " + methodType);
}
// 返回功能的开关状态
return METHOD_SWITCHES.getOrDefault(methodType, false);
}
// 统一切面处理
@Around("@annotation(switchMethod)")
public Object controlMethod(ProceedingJoinPoint joinPoint, SwitchMethod switchMethod) throws Throwable {
// 获取方法的功能类型
String methodType = switchMethod.value();
// 检查功能是否启用
if (!METHOD_SWITCHES.getOrDefault(methodType, false)) {
// 如果功能未启用,则返回错误信息
return new ApiResponseData<>("500", null, "此功能已关闭");
}
// 如果功能已启用,则执行原方法
return joinPoint.proceed();
}
}

@ -0,0 +1,80 @@
package edu.ahbvc.recruit.config;
import edu.ahbvc.recruit.util.JwtUtil;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import java.io.IOException;
/**
* JWT
* JWT
* OncePerRequestFilter,
* doFilterInternal,
* JWT,
* , SecurityContextHolder, 便
* ,
* JWT,
* ,, , ,
* @author c215
*/
// * JWT请求过滤器
// * 用于处理JWT认证请求
// * 继承自OncePerRequestFilter, 确保每个请求只被过滤一次
// * 实现了doFilterInternal方法, 用于处理请求的认证逻辑
// * 从请求头中获取JWT令牌, 并验证令牌的有效性
// * 如果令牌有效, 则将用户信息设置到SecurityContextHolder中, 以便后续的认证和授权操作
// * 如果令牌无效, 则不做任何操作
// * 因为JWT相关代码暂未更新, 所以此类用不到
// * 更新了之后代码量更少了,所以屎山了, 但是功能是有的, 所以就先这样了, 以后再优化
@Component
public class JwtRequestFilter {
// extends OncePerRequestFilter
// @Autowired
// private UserDetailsService userDetailsService;
//
// @Autowired
// private JwtUtil jwtUtil;
//
// @Override
// protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
// throws ServletException, IOException {
//
// final String authorizationHeader = request.getHeader("Authorization");
//
// String username = null;
// String jwt = null;
//
// if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
// jwt = authorizationHeader.substring(7);
// username = jwtUtil.extractUsername(jwt);
// }
//
// if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
//
// UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
//
// if (jwtUtil.validateToken(jwt, userDetails)) {
//
// UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken(
// userDetails, null, userDetails.getAuthorities());
// usernamePasswordAuthenticationToken
// .setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
// SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);
// }
// }
// chain.doFilter(request, response);
// }
}

@ -0,0 +1,89 @@
package edu.ahbvc.recruit.config;
import edu.ahbvc.recruit.mapper.UserInter;
import edu.ahbvc.recruit.model.token.CustomUserDetailsService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.CachingUserDetailsService;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import static org.springframework.security.config.Customizer.withDefaults;
import java.util.Arrays;
import java.util.Collections;
/**
* Spring Security
* @author c215
*/
// @Configuration 表示这是一个配置类
@Configuration
// @EnableWebSecurity 表示启用Spring Security的Web安全支持
@EnableWebSecurity
public class Security {
// SecurityFilterChain 用于配置安全过滤器链
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.csrf(AbstractHttpConfigurer::disable)
.cors(withDefaults())
.authorizeHttpRequests((requests)->requests
.requestMatchers("/","/login","/favicon.ico","/**").permitAll()
.anyRequest().authenticated()
)
.formLogin((form)-> form
.loginPage("/login.html")
.permitAll()
);
return http.build();
}
// CORS 配置源 用于配置跨域请求的CORS配置
// 正式上线后需要修改为允许指定的域名和端口
@Bean
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
// 允许所有本地地址和端口
configuration.setAllowedOriginPatterns(Arrays.asList(
"http://localhost:*",
"http://127.0.0.1:*"
));
// 允许所有请求方法
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS"));
// 允许所有请求头
configuration.setAllowedHeaders(Collections.singletonList("*"));
// 允许携带凭证
configuration.setAllowCredentials(true);
// 注册CORS配置源
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
// 注册CORS配置源
source.registerCorsConfiguration("/**", configuration);
return source;
}
// UserDetailsService 用于加载用户信息
// 因为JWT相关代码暂未更新, 所以此方法用不到
@Bean
public UserDetailsService userDetailsService(UserInter userRepository){
return new CustomUserDetailsService(userRepository);
}
@Bean
public PasswordEncoder passwordEncoder(){
return new BCryptPasswordEncoder();
}
}

@ -0,0 +1,41 @@
package edu.ahbvc.recruit.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Web
* @author c215
*/
@Configuration
public class WebConfig implements WebMvcConfigurer {
// 配置跨域请求的CORS配置
// 正式上线后需要修改为允许指定的域名和端口
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
// 允许所有本地地址和端口
.allowedOrigins("http://localhost:3333")
// 允许的请求方法
.allowedMethods("GET", "POST", "PUT", "DELETE")
// 允许的请求头
.allowedHeaders("*")
// 允许凭证
.allowCredentials(true)
// 预检请求的缓存时间
.maxAge(3600);
}
// 配置静态资源的处理
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// 配置静态资源的处理
// 允许访问的路径
registry.addResourceHandler("/**")
// 允许访问的路径
.addResourceLocations("classpath:/static/");
}
}

@ -0,0 +1,30 @@
package edu.ahbvc.recruit.config.jwt;
/**
*
* JWT使
*
*
* JWT,
* @author c215
*/
public class AuthenticationRequest {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}

@ -0,0 +1,21 @@
package edu.ahbvc.recruit.config.jwt;
/**
*
* JWT使
* JWT
*
* JWT,
* @author c215
*/
public class AuthenticationResponse {
private final String jwt;
public AuthenticationResponse(String jwt) {
this.jwt = jwt;
}
public String getJwt() {
return jwt;
}
}

@ -0,0 +1,510 @@
package edu.ahbvc.recruit.controller;
// 导入必要的类和接口
// 自定义注解,用于方法开关控制
import edu.ahbvc.recruit.annotation.SwitchMethod;
// 方法开关枚举类
import edu.ahbvc.recruit.aspect.MethodSwitch;
// 管理员模型类
import edu.ahbvc.recruit.model.Admin;
// API响应数据封装类
import edu.ahbvc.recruit.model.ApiResponseData;
// 用户模型类
import edu.ahbvc.recruit.model.User;
// 图片验证码API响应类
import edu.ahbvc.recruit.model.api.ImageCaptchaResponse;
import edu.ahbvc.recruit.model.api.SMApiResponse;
// JWT令牌模型类
import edu.ahbvc.recruit.model.token.Token;
// 管理员服务实现类
import edu.ahbvc.recruit.service.AdminServiceImpl;
// 用户服务实现类
import edu.ahbvc.recruit.service.UserServiceImpl;
// 第三方API服务接口
import edu.ahbvc.recruit.service.api.ApiService;
// JWT工具类
import edu.ahbvc.recruit.util.JwtUtil;
// HTTP会话对象
import jakarta.servlet.http.HttpSession;
// 日志接口
import org.slf4j.Logger;
// 日志工厂类
import org.slf4j.LoggerFactory;
// Spring依赖注入注解
import org.springframework.beans.factory.annotation.Autowired;
// Spring MVC注解
import org.springframework.web.bind.annotation.*;
// 导入Java标准库类
// 动态数组实现
import java.util.ArrayList;
// HashMap实现
import java.util.HashMap;
// Map接口
import java.util.Map;
/**
*
*
* 使@RestControllerRESTful
* 使@RequestMapping"/api"
*
* @author c215
*/
@RestController
@RequestMapping("api")
public class AuthenticationController {
// 日志记录器实例,用于记录调试和错误信息
private static final Logger log = LoggerFactory.getLogger(AuthenticationController.class);
// 定义角色常量
// 超级管理员角色标识
private static final int SUPER_ADMIN = 2;
// 普通管理员角色标识
private static final int ADMIN = 1;
/**
*
* API
* publicprivategetter
*/
public String imgVerifyCode;
// API服务实例用于调用第三方API
private ApiService api;
// 用户服务实现类实例
private UserServiceImpl userServiceImpl;
// 管理员服务实现类实例
private AdminServiceImpl adminServiceImpl;
// 使用@Autowired实现依赖注入
// 注入AdminServiceImpl实例
@Autowired
public void setAdminServiceImpl(AdminServiceImpl adminServiceImpl) {
this.adminServiceImpl = adminServiceImpl;
}
// 使用@Autowired实现依赖注入
// 注入UserServiceImpl实例
@Autowired
public void setUserServiceImpl(UserServiceImpl userServiceImpl) {
this.userServiceImpl = userServiceImpl;
}
// 使用@Autowired实现依赖注入
// 注入ApiService实例
@Autowired
public void setApi(ApiService api) {
this.api = api;
}
/**
* API
* GET/api/login/code
*
* @return ApiResponseData
*/
@GetMapping("login/code")
public ApiResponseData<String> getLoginCode() {
// 创建API响应对象
ApiResponseData<String> apiResponseData = new ApiResponseData<>();
// 调用API获取图片验证码
ImageCaptchaResponse imgCode = api.getImgCode();
// 获取API返回状态码
String imgCodeApiResponseCode = imgCode.getDesc();
// 验证API调用是否成功
if (!"000000".equals(imgCodeApiResponseCode)) {
// API调用失败记录错误日志并返回错误响应
log.error("api异常");
apiResponseData.setMessage("图片验证码api异常");
apiResponseData.setCode("500");
return apiResponseData;
} else {
// API调用成功处理返回数据
// 获取验证码
String code = imgCode.getResult().getVerifyCode();
// 设置成功消息
apiResponseData.setMessage("获取验证码成功");
// 设置成功状态码
apiResponseData.setCode("0");
// 设置返回数据
apiResponseData.setData(imgCode.getResult().getFileName());
// 记录验证码日志
log.info("当前验证码" + code);
// 存储验证码
imgVerifyCode = code;
// 返回响应
return apiResponseData;
}
}
/**
*
* POST/api/admin/login
*
* @param session HTTP
* @param requestData
* @return ApiResponseData
*/
@PostMapping("admin/login")
public ApiResponseData<Map<String, String>> adlogin(HttpSession session,
@RequestBody Map<String, String> requestData) {
// 创建响应对象
ApiResponseData<Map<String, String>> responseData = new ApiResponseData<>();
// String code = requestData.get("code");
// if (code.equals(imgVerifyCode)) {
// 从请求数据中获取用户名和密码
String username = requestData.get("username");
String password = requestData.get("password");
// 检查用户是否为管理员
String isadmin = adminServiceImpl.isAdmin(username);
if (isadmin == null || isadmin.isEmpty()) {
// 普通用户登录逻辑
User userlogin = userServiceImpl.login(username, password);
if (userlogin != null && userlogin.getName() != null) {
// 登录成功生成JWT令牌
int userId = userlogin.getId();
// 创建普通用户令牌
Token ut = new Token(userId, 0);
// 生成JWT
String token = JwtUtil.createJWT(ut);
// 记录调试日志
log.debug("用户登录生成token= " + token);
// 设置会话属性
session.setAttribute("ROLE", "editor");
// userRole是动态获取的用户角色
session.setAttribute("USERNAME", userlogin.getName());
// 构建响应数据
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("token", token);
responseData.setCode("0");
responseData.setMessage("登录成功");
responseData.setData(hashMap);
} else {
// 登录失败
responseData.setCode("500");
responseData.setMessage("账号或密码错误");
}
} else {
// 管理员登录逻辑
Admin admin = adminServiceImpl.login(username, password);
if (admin != null && admin.getAccount() != null) {
// 根据管理员权限级别生成不同令牌
String token;
if (admin.getPromise() == 1) {
// 超级管理员
Token token2 = new Token(admin.getId(), 2);
token = JwtUtil.createJWT(token2);
session.setAttribute("ROLE", "superadmin");
} else {
// 普通管理员
token = JwtUtil.createJWT(new Token(admin.getId(), 1));
session.setAttribute("ROLE", "admin");
}
// 设置会话属性
session.setAttribute("USERNAME", admin.getName());
// 构建响应数据
HashMap<String, String> hashMap = new HashMap<>();
// 将令牌添加到响应数据中
hashMap.put("token", token);
// 设置响应状态码和消息
responseData.setCode("0");
responseData.setMessage("登录成功");
// 设置响应数据
responseData.setData(hashMap);
} else {
// 管理员登录失败
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("账号或密码错误");
}
}
// } else {
// // 验证码错误
// responseData.setCode("500");
// responseData.setMessage("验证码错误");
// }
// 返回响应
return responseData;
}
/**
* @return , token
*/
@PostMapping("login")
public ApiResponseData<Map<String, String>> login(HttpSession session,
@RequestBody Map<String, String> requestData) {
ApiResponseData<Map<String, String>> responseData = new ApiResponseData<>();
// String code = requestData.get("code");
// if (code.equals(imgVerifyCode)) {
// 从请求数据中获取用户名和密码
String username = requestData.get("username");
String password = requestData.get("password");
// 检查用户是否为管理员
String isAdmin = adminServiceImpl.isAdmin(username);
if (isAdmin == null || isAdmin.isEmpty()) {
// 普通用户登录逻辑
User userLogin = userServiceImpl.login(username, password);
if (userLogin != null && userLogin.getName() != null) {
int userId = userLogin.getId();
Token ut = new Token(userId, 0);
String token = JwtUtil.createJWT(ut);
log.debug("用户登录生成token= " + token);
// 记录调试日志
responseData.setCode("0");
// 设置响应状态码和消息
responseData.setMessage("登录成功");
// 设置会话属性
session.setAttribute("ROLE", "editor");
// userRole是动态获取的用户角色
session.setAttribute("USERNAME", userLogin.getName());
// 构建响应数据
HashMap<String, String> hashMap = new HashMap<>();
// 将令牌添加到响应数据中
hashMap.put("token", token);
// 设置响应数据
responseData.setData(hashMap);
} else {
// 用户账号密码错误
// 设置响应消息
responseData.setCode("500");
// 设置响应状态码
responseData.setMessage("账号或密码错误");
}
} else {
// 管理员登录逻辑
Admin admin = adminServiceImpl.login(username, password);
if (admin != null && admin.getAccount() != null) {
// 根据管理员权限级别生成不同令牌
String token;
if (admin.getPromise() == 1) {
// 超级管理员
Token token2 = new Token(admin.getId(), 2);
// 生成JWT
token = JwtUtil.createJWT(token2);
// 设置会话属性
session.setAttribute("ROLE", "superadmin");
} else {
// 普通管理员
token = JwtUtil.createJWT(new Token(admin.getId(), 1));
// 设置会话属性
session.setAttribute("ROLE", "admin");
}
// 设置会话属性
session.setAttribute("USERNAME", admin.getName());
// 构建响应数据
HashMap<String, String> hashMap = new HashMap<>();
// 将令牌添加到响应数据中
hashMap.put("token", token);
// 设置响应状态码和消息
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("登录成功");
// 设置响应数据
responseData.setData(hashMap);
} else {
// 管理员账号密码错误
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("账号或密码错误");
}
}
// } else {
// // 验证码错误
// responseData.setCode("500");
// responseData.setMessage("验证码错误");
// }
// 返回响应
return responseData;
}
// * 注册短信验证码API(登录前发送验证码时调用)
// * 暂时使用mock验证码, 后续需要替换为真实验证码
// * 处理GET请求路径为/api/register/code
// * @param phone 手机号
// * @return 包含验证码信息的ApiResponseData对象
/**
* API()
* 使mock,
* GET/api/register/code
*
* @param phone
* @return ApiResponseData
*/
@PostMapping("register/code")
public ApiResponseData<HashMap<String, String>> registerCode(@RequestBody String phone) {
ApiResponseData<HashMap<String, String>> responseData = new ApiResponseData<>();
// 调用API获取图片验证码
SMApiResponse smApiResponse = api.sendSM(ApiService.MOCK_CAPTCHA, phone);
try {
// 获取API返回状态码
log.info("sendsms" + smApiResponse);
} catch (Exception e) {
// 处理异常
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("短信验证码API异常");
// 设置响应数据
responseData.setData(null);
return responseData;
}
// 验证API调用是否成功
if (smApiResponse.getCode() != null && "0".equals(smApiResponse.getCode())) {
// 构建响应数据
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("验证码发送成功");
// 设置响应数据
responseData.setData(null);
} else {
// 处理异常
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("短信验证码API异常");
// 设置响应数据
responseData.setData(null);
// 记录错误日志
log.error("短信验证码API异常,手机号" + phone + "注册失败");
}
// 返回响应
return responseData;
}
// * 注册接口
// * 处理POST请求路径为/api/user/register
// * @param requestData 包含手机号、密码和验证码的请求数据
// * @return 包含注册结果的ApiResponseData对象
/**
*
* POST/api/user/register
*
* @param requestData
* @return ApiResponseData
*/
@SwitchMethod(MethodSwitch.REGISTER)
@PostMapping("user/register")
public ApiResponseData<HashMap<String, String>> register(@RequestBody HashMap<String, String> requestData) {
ApiResponseData<HashMap<String, String>> responseData = new ApiResponseData<>();
// 从请求数据中获取手机号、密码和验证码
String phone = requestData.get("phone");
String pwd = requestData.get("password");
// String userVerifyCode = requestData.get("code");
// 检查手机号是否已注册
int exists = userServiceImpl.existsByPhone(phone);
if (exists == 0) {
// if (captcha.equals(userVerifyCode)) {
// 注册用户
User newUser = userServiceImpl.registerByPhone(phone, pwd);
if (newUser != null) {
// 注册成功生成JWT令牌
HashMap<String, String> hashMap = new HashMap<>();
// 创建普通用户令牌
String token = JwtUtil.createJWT(new Token(newUser.getId(), 0));
// 记录调试日志
hashMap.put("token", token);
// 设置会话属性
responseData.setCode("0");
// 设置响应状态码和消息
responseData.setData(hashMap);
// 设置响应数据
responseData.setMessage("注册成功,请在个人信息页面完成实名认证");
// 设置响应消息
log.info("手机号" + phone + "注册成功");
} else {
// 注册失败
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("注册失败");
// 设置响应数据
responseData.setData(null);
// 记录错误日志
log.info("手机号" + phone + "注册失败");
}
// } else {
// responseData.setCode("500");
// responseData.setMessage("验证码错误");
// responseData.setData(null);
// logger.info("验证码错误,手机号" + phone + "注册失败");
// }
} else {
// 手机号已注册
responseData.setCode("500");
// 设置响应消息
responseData.setData(null);
// 设置响应状态码
responseData.setMessage("该手机号已经注册");
// 记录错误日志
log.info("手机号已经存在");
}
// 返回响应
return responseData;
}
// * 获取用户信息接口
// * 处理GET请求路径为/api/users/info
// * @param authorizationHeader 包含JWT令牌的请求头
// * @return 包含用户信息的ApiResponseData对象
/**
*
* GET/api/users/info
*
* @param authorizationHeader JWT
* @return ApiResponseData
*/
@GetMapping("users/info")
public ApiResponseData<Map<String, Object>> userInfoRoles(@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
ApiResponseData<Map<String, Object>> responseData = new ApiResponseData<>();
HashMap<String, Object> map = new HashMap<>();
ArrayList<String> list = new ArrayList<>();
if (authorizationHeader != null) {
// 响应数据封装
responseData.setCode("0");
responseData.setMessage("获取信息成功");
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
Integer userRole;
String username = "访客";
if (token != null) {
// 检查用户角色,添加角色到列表
userRole = token.getUserRole();
if (userRole == SUPER_ADMIN) {
// 超级管理员角色
list.add("superadmin");
} else if (userRole == ADMIN) {
// 普通管理员角色
list.add("admin");
} else {
// 普通用户角色
list.add("editor");
}
// 设置用户名
username = token.getUsername();
}
// 将用户名和角色列表添加到响应数据中
map.put("username", username);
map.put("roles", list);
} else {
// 处理未提供JWT令牌的情况
responseData.setCode("500");
responseData.setMessage("获取信息失败");
}
// 设置响应数据
responseData.setData(map);
// 返回响应
return responseData;
}
}

@ -0,0 +1,232 @@
package edu.ahbvc.recruit.controller;
import edu.ahbvc.recruit.aspect.MethodSwitch;
import edu.ahbvc.recruit.model.*;
import edu.ahbvc.recruit.model.page.*;
import edu.ahbvc.recruit.model.token.Token;
import edu.ahbvc.recruit.service.ThingServiceImpl;
import edu.ahbvc.recruit.service.UserServiceImpl;
import edu.ahbvc.recruit.util.JwtUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
/**
* Restful API
* <p>
*
* </p>
* @author c215
*/
@RestController
@RequestMapping("api")
public class RestFulController {
/**
* true, false
* , 便,
* ,
* , , , ,
* : isDevfalse
*/
private final boolean isDev = false;
/**
* UserServiceThingService
*
*/
private UserServiceImpl userService;
/**
* ThingService
*
*/
private ThingServiceImpl thingService;
/**
* UserService
*
*
* @param userService
*/
@Autowired
public void setUserService(UserServiceImpl userService) {
this.userService = userService;
}
/**
* ThingService
*
*
* @param thingService
*/
@Autowired
public void setThingService(ThingServiceImpl thingService) {
this.thingService = thingService;
}
/**
* {-id}使
*
* @return {-id}
*/
@GetMapping("tableBatchOption")
public ApiResponseData<HashMap<String, Object>> getBatcheOption() {
// 获取所有批次信息
List<Batch> batches = thingService.getBatchOption();
// 封装返回数据
HashMap<String, Object> map = new HashMap<>();
// 将批次信息存入map中
map.put("list", batches);
// 创建ApiResponseData对象, 用于封装返回数据
ApiResponseData<HashMap<String, Object>> responseData = new ApiResponseData<>();
// 设置返回数据的状态码和消息
responseData.setCode("0");
// 设置返回数据的消息
responseData.setMessage("获取批次数据");
// 设置返回数据
responseData.setData(map);
// 返回ApiResponseData对象
return responseData;
}
/**
*
*
* @return {-id}
*/
@GetMapping("getPositionOption")
public ApiResponseData<HashMap<String, Object>> getPositionOption() {
// 获取所有岗位信息
List<Position> list = thingService.getPositionOption();
// 封装返回数据
ApiResponseData<HashMap<String, Object>> responseData = new ApiResponseData<>();
// 设置返回数据的状态码和消息
HashMap<String, Object> map = new HashMap<>();
// 将岗位信息存入map中
map.put("list", list);
if (list != null) {
// 设置返回数据的状态码和消息
responseData.setCode("0");
// 设置返回数据的消息
responseData.setMessage("获取信息成功");
// 设置返回数据
responseData.setData(map);
} else {
// 设置返回数据的状态码和消息
responseData.setCode("500");
// 设置返回数据的消息
responseData.setMessage("获取信息失败");
}
// 返回ApiResponseData对象
return responseData;
}
/**
* @param authorizationHeader Token
* @return
*/
@GetMapping("batchs")
public ApiResponseData<HashMap<String, Object>> getBatches(
@RequestHeader("Authorization") String authorizationHeader) {
// 解析Token
Token user;
// 判断Token是否为空
user = JwtUtil.parseJWT(authorizationHeader);
if (user == null) {
// 返回ApiResponseData对象
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
}
// 获取当前批次信息
int infoIntegrity = 0;
// 获取当前批次信息
Batch batch = thingService.getCurrentBatches();
// 获取当前用户信息
User one = userService.getOne(user.getUserId());
// 判断当前用户是否已经报名
boolean alreadyRecruit = userService.alreadyRecruit(String.valueOf(user.getUserId()));
if (one.getIdNum() != null) {
// 判断当前用户是否已经填写过信息
infoIntegrity = 1;
}
// 判断当前批次是否已经结束
boolean disableSubmit = !MethodSwitch.isEnabled(MethodSwitch.SUBMIT);
// 封装返回数据
HashMap<String, Object> map = new HashMap<>(10);
// 将批次信息存入map中
map.put("oneBatch", batch);
// 将信息完整性存入map中
map.put("infoIntegrity", infoIntegrity);
// 将是否已经报名存入map中
map.put("disableRecruit", disableSubmit);
// 将是否已经报名存入map中
map.put("alreadyRecruit", alreadyRecruit);
// 创建ApiResponseData对象, 用于封装返回数据
ApiResponseData<HashMap<String, Object>> responseData = new ApiResponseData<>();
// 设置返回数据的状态码和消息
responseData.setCode("0");
// 设置返回数据的消息
responseData.setMessage("获取批次数据");
// 设置返回数据
responseData.setData(map);
// 返回ApiResponseData对象
return responseData;
}
/**
*
*
* @param authorizationHeader Token
* @param requestBody
* @return
*/
@PostMapping("searchPositions")
public ApiResponseData<HashMap<String, Object>> getPositions(@RequestBody SearchAndPageOfPositionByUser requestBody,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析Token
Token token;
token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 返回ApiResponseData对象
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
}
// 获取当前批次信息
int batchId = requestBody.getBatchId();
// 获取当前批次信息
int offset = 0;
// 获取当前批次信息
int size = Integer.MAX_VALUE;
// String code = requestBody.getCode();
// 获取当前批次信息
int positionsNum = thingService.getPositionsNum();
// 判断当前批次是否已经结束
if (requestBody.getCurrentPage() >= positionsNum) {
// 返回ApiResponseData对象
return new ApiResponseData<>("500", null, "参数异常");
}
// 获取当前批次信息
List<Position> positionList = thingService.getSomePosition(batchId, offset, size);
// 封装返回数据
HashMap<String, Object> map = new HashMap<>();
// 将批次信息存入map中
map.put("list", positionList);
// 创建ApiResponseData对象, 用于封装返回数据
ApiResponseData<HashMap<String, Object>> responseData = new ApiResponseData<>();
// 设置返回数据的状态码和消息
responseData.setCode("0");
// 设置返回数据的消息
responseData.setMessage("获取部门数据");
// 设置返回数据
responseData.setData(map);
// 返回ApiResponseData对象
return responseData;
}
}

@ -0,0 +1,898 @@
package edu.ahbvc.recruit.controller;
// 导入各种必要的类和接口
// 方法开关切面类,用于控制功能开关
import edu.ahbvc.recruit.aspect.MethodSwitch;
// 导入所有模型类包括Admin、User等
import edu.ahbvc.recruit.model.*;
// 管理员搜索和分页参数封装类
import edu.ahbvc.recruit.model.page.SearchAndPageOfAdmin;
// 结果搜索和分页参数封装类
import edu.ahbvc.recruit.model.page.SearchAndPageOfResult;
// JWT令牌模型类用于用户认证
import edu.ahbvc.recruit.model.token.Token;
// 管理员服务实现类
import edu.ahbvc.recruit.service.AdminServiceImpl;
// 事项服务实现类
import edu.ahbvc.recruit.service.ThingServiceImpl;
// 用户服务实现类
import edu.ahbvc.recruit.service.UserServiceImpl;
// JWT工具类用于生成和解析JWT令牌
import edu.ahbvc.recruit.util.JwtUtil;
// HTTP响应对象用于文件下载等操作
import jakarta.servlet.http.HttpServletResponse;
// 日志接口
import org.slf4j.Logger;
// 日志工厂类
import org.slf4j.LoggerFactory;
// Spring依赖注入注解
import org.springframework.beans.factory.annotation.Autowired;
// Spring MVC注解用于定义RESTful接口
import org.springframework.web.bind.annotation.*;
// 导入Java标准库类
// IO异常类
import java.io.IOException;
// HashMap实现类
import java.util.HashMap;
// List接口
import java.util.List;
// Map接口
import java.util.Map;
/**
*
*
* @author c215
*
* ()
* 使@RestControllerRESTful
* 使@RequestMapping"/api/superAdmin"
* (role >= 2)
* @author c215
*/
@RestController
@RequestMapping("/api/superAdmin")
public class SuperAdminController {
// 日志记录器实例,用于记录调试和错误信息
// 使用LoggerFactory.getLogger获取指定类的日志记录器
private static final Logger log = LoggerFactory.getLogger(SuperAdminController.class);
// 用户服务实现类实例,用于操作用户相关业务
// 通过@Autowired注解实现依赖注入
private UserServiceImpl userServiceImpl;
// 管理员服务实现类实例,用于操作管理员相关业务
// 通过@Autowired注解实现依赖注入
private AdminServiceImpl adminServiceImpl;
// 事项服务实现类实例,用于操作事项相关业务
// 通过@Autowired注解实现依赖注入
private ThingServiceImpl thingServiceImpl;
/**
*
* 使@Autowired
*
* @param adminServiceImpl
*/
@Autowired
public void setAdminServiceImpl(AdminServiceImpl adminServiceImpl) {
// 将传入的adminServiceImpl实例赋值给当前类的adminServiceImpl字段
this.adminServiceImpl = adminServiceImpl;
}
/**
*
* 使@Autowired
*
* @param userServiceImpl
*/
@Autowired
public void setUserServiceImpl(UserServiceImpl userServiceImpl) {
// 将传入的userServiceImpl实例赋值给当前类的userServiceImpl字段
this.userServiceImpl = userServiceImpl;
}
/**
*
* 使@Autowired
*
* @param thingServiceImpl
*/
@Autowired
public void setThingServiceImpl(ThingServiceImpl thingServiceImpl) {
// 将传入的thingServiceImpl实例赋值给当前类的thingServiceImpl字段
this.thingServiceImpl = thingServiceImpl;
}
// * 获取管理员列表接口
// * 处理POST请求路径为/api/superAdmin/tableAdmins
// * 需要超级管理员权限(role >= 2)
// * @param requestBody 包含搜索和分页参数的请求体
// * @param authorizationHeader 请求头中的JWT令牌
// * @return 包含管理员列表和总数的ApiResponseData对象
/**
*
* POST/api/superAdmin/tableAdmins
* (role >= 2)
*
* @param requestBody
* @param authorizationHeader JWT
* @return ApiResponseData
*/
@PostMapping("tableAdmins")
public ApiResponseData<Map<String, Object>> getAdmins(
@RequestBody SearchAndPageOfAdmin requestBody,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
// 检查令牌有效性
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 1) {
// 用户权限不足返回500错误
// 缺陷这里应该检查role >= 2而不是1
return new ApiResponseData<>("500", null, "用户无权操作");
}
// 获取分页参数
int size = requestBody.getSize();
// 每页记录数
int beginIndex = (requestBody.getCurrentPage() - 1) * size;
// 起始索引
// 获取搜索条件
String name = requestBody.getName();
// 管理员姓名
String phone = requestBody.getPhone();
// 管理员电话
// 调用服务层获取管理员列表
List<Admin> admins = adminServiceImpl.getAdmins(beginIndex, size, name, phone);
// 调用服务层获取管理员总数
int total = adminServiceImpl.getAdminsNum(name, phone);
// 创建响应对象
ApiResponseData<Map<String, Object>> response = new ApiResponseData<>();
// 设置成功状态码
response.setCode("0");
// 设置响应消息
response.setMessage("信息");
// 创建数据Map包含列表和总数
Map<String, Object> data = new HashMap<>();
// 管理员列表
data.put("list", admins);
// 管理员总数
data.put("total", total);
// 将数据设置到响应对象中
response.setData(data);
// 返回响应对象
return response;
}
// * 添加管理员接口
// * 处理POST请求路径为/api/superAdmin/tableAdmin
// * 需要超级管理员权限(role >= 2)
// * @param admin 要添加的管理员信息
// * @param authorizationHeader 请求头中的JWT令牌
// * @return 包含操作结果的ApiResponseData对象
/**
*
* POST/api/superAdmin/tableAdmin
* (role >= 2)
*
* @param admin
* @param authorizationHeader JWT
* @return ApiResponseData
*/
@PostMapping("tableAdmin")
public ApiResponseData<String> addAdmin(@RequestBody Admin admin,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "用户无权操作");
}
// 调用服务层添加管理员
ApiResponseData<String> responseData = new ApiResponseData<>();
// 调用服务层添加管理员
int i = adminServiceImpl.addAdmin(admin);
if (i == 1) {
// 添加成功,设置成功状态码和消息
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("修改成功");
} else {
// 添加失败,设置错误状态码和消息
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("修改失败");
}
// 返回响应对象
return responseData;
}
// * 删除管理员接口
// * 处理DELETE请求路径为/api/superAdmin/tableAdmin/{id}
// * 需要超级管理员权限(role >= 2)
// * @param id 要删除的管理员ID
// * @param authorizationHeader 请求头中的JWT令牌
// * @return 包含操作结果的ApiResponseData对象
/**
*
* DELETE/api/superAdmin/tableAdmin/{id}
* (role >= 2)
*
* @param id ID
* @param authorizationHeader JWT
* @return ApiResponseData
*/
@DeleteMapping("tableAdmin/{id}")
public ApiResponseData<String> deleteAdmin(@PathVariable("id") Integer id,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "用户无权操作");
}
// 调用服务层删除管理员
int i = adminServiceImpl.delAdmin(id);
// 创建响应对象
ApiResponseData<String> data = new ApiResponseData<>();
if (i != 1) {
// 删除失败,设置错误状态码和消息
data.setCode("500");
data.setMessage("删除管理员失败");
} else {
// 删除成功,设置成功状态码和消息
data.setCode("0");
data.setMessage("删除管理员成功");
}
// 返回响应对象
return data;
}
// * 修改管理员信息
// * 处理PUT请求路径为/api/superAdmin/tableAdmin
// * 需要超级管理员权限(role >= 2)
// * @param ad 管理员信息
// * @param authorizationHeader 请求头中的JWT令牌
// * @return 包含操作结果的ApiResponseData对象
/**
*
* PUT/api/superAdmin/tableAdmin
* (role >= 2)
*
* @param ad
* @param authorizationHeader JWT
* @return ApiResponseData
*/
@PutMapping("tableAdmin")
public ApiResponseData<String> updateAdmin(@RequestBody Admin ad,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "用户无权操作");
}
// 调用服务层修改管理员信息
int i = adminServiceImpl.updateAdmin(ad);
// 创建响应对象
ApiResponseData<String> responseData = new ApiResponseData<>();
if (i == 1) {
// 修改成功,设置成功状态码
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("修改成功");
} else {
// 修改失败,设置错误状态码
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("修改失败");
}
// 返回响应对象
return responseData;
}
// * 获取用户列表
// * 处理POST请求路径为/api/superAdmin/tableUsers
// * 需要超级管理员权限(role >= 2)
// * @param id 用户ID
// * @param authorizationHeader 请求头中的JWT令牌
// * @return 包含用户列表和总数的ApiResponseData对象
/**
*
* POST/api/superAdmin/tableUsers
* (role >= 2)
*
* @param id ID
* @param authorizationHeader JWT
* @return ApiResponseData
*/
@GetMapping("tableBatch/open")
public ApiResponseData<String> batchesOpenSwitch(@RequestParam("id") Integer id,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "用户无权操作");
}
// 调用服务层获取用户列表
ApiResponseData<String> responseData = new ApiResponseData<>();
// 调用服务层获取用户列表
int batches = thingServiceImpl.switchBatchOpen(id);
if (batches != 1) {
// 获取用户列表失败,设置错误状态码和消息
return new ApiResponseData<>("500", null, "切换失败");
}
// 设置成功状态码
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("修改成功");
// 返回响应对象
return responseData;
}
/**
* @param requestBody
* @return ()
*/
@PostMapping("tableAudit")
public ApiResponseData<HashMap<String, Object>> getAuditDataBySearch(@RequestBody SearchAndPageOfResult requestBody,
@RequestHeader("Authorization") String authorizationHeader) {
// @TODO 未开发完成的端点
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "用户无权操作");
}
// 获取分页参数
int size = requestBody.getSize();
int beginIndex = (requestBody.getCurrentPage() - 1) * size;
// 获取搜索条件
List<Integer> batchs = requestBody.getBatches();
// 获取搜索条件
List<Integer> jobTitles = requestBody.getJobTitles();
// 获取搜索条件
List<Integer> status = requestBody.getStatus();
// 调用服务层获取用户列表
List<ThingWithUser> things = thingServiceImpl.getAuditThings(beginIndex, size, jobTitles, batchs);
// int total = thingServiceImpl.getThingsNum(jobTitles, batchs, status);
// 创建响应对象
HashMap<String, Object> map = new HashMap<>();
// 将用户列表和总数存入响应对象中
map.put("list", things);
// 将用户列表和总数存入响应对象中
map.put("total", 99);
// 创建响应对象
ApiResponseData<HashMap<String, Object>> responseData = new ApiResponseData<>();
if (things != null) {
// 设置成功状态码
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("获取招聘信息成功");
// 将用户列表和总数存入响应对象中
responseData.setData(map);
} else {
// 获取用户列表失败,设置错误状态码
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("获取招聘信息失败");
}
// 返回响应对象
return responseData;
}
// * 超级管理员复审不通过
// * @param requestBody 请求体
// * @param authorizationHeader 请求头中的JWT令牌
// * @return 包含响应信息的 ApiResponseData对象
/**
*
*
* @param requestBody
* @param authorizationHeader JWT
* @return ApiResponseData
*/
@PostMapping("refuse2")
public ApiResponseData<String> refuse2(@RequestBody RefuseDataMap requestBody,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "无权操作");
}
// 调用服务层获取用户列表
int i = thingServiceImpl.refuseThing(requestBody.getThingId(), -2, requestBody.getQualificationResult());
// 创建响应对象
ApiResponseData<String> responseData = new ApiResponseData<>();
if (i == 1) {
// 设置成功状态码
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("操作成功");
} else {
// 获取用户列表失败,设置错误状态码
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("操作失败");
}
// 返回响应对象
return responseData;
}
// * 超级管理员复审通过
// * @param requestBody 请求体
// * @param authorizationHeader 请求头中的JWT令牌
// * @return 包含响应信息的 ApiResponseData对象
/**
*
*
* @param map
* @param authorizationHeader JWT
* @return ApiResponseData
*/
@PostMapping("accept2")
public ApiResponseData<String> agree2(@RequestBody HashMap<String, String> map,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "无权操作");
}
// 调用服务层获取用户列表
int i = thingServiceImpl.updateThingStatus(Integer.parseInt(map.get("thingId")), 2);
// 创建响应对象
thingServiceImpl.updateThingInfo(Integer.parseInt(map.get("thingId")), map.get("qualificationResult"));
// 创建响应对象
ApiResponseData<String> responseData = new ApiResponseData<>();
if (i == 1) {
// 设置成功状态码
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("批准成功");
} else {
// 获取用户列表失败,设置错误状态码
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("批准失败");
}
// 返回响应对象
return responseData;
}
// * 管理员修改用户密码
// * @param id 要修改的用户的id
// * @param authorizationHeader 用户权限(token)
// * @return 管理员修改用户密码
/**
*
*
* @param id id
* @param authorizationHeader (token)
* @return
*/
@GetMapping("userNewPwd")
public ApiResponseData<Integer> setUserPwd(@RequestParam Integer id,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "接口权限异常");
}
// 调用服务层获取用户列表
int num = userServiceImpl.updateUserPwd(id, "12345678");
// 创建响应对象
ApiResponseData<Integer> responseData = new ApiResponseData<>();
if (num == 1) {
// 设置成功状态码
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("用户密码修改成功");
} else {
// 获取用户列表失败,设置错误状态码
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("用户密码修改异常");
}
// 返回响应对象
return responseData;
}
// * 获取批次列表
// * @param data 请求体
// * @param authorizationHeader 用户权限(token)
// * @return 批次列表
/**
*
*
* @param data
* @param authorizationHeader (token)
* @return
*/
@PostMapping("switch/register")
public ApiResponseData<String> switchRegister(@RequestBody SwitchMethodStatus data,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
}
if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "用户权限异常");
}
// 创建响应对象
ApiResponseData<String> responseData = new ApiResponseData<>();
// 1是启用,0是禁用
if (data.getOpen() == 0) {
// 调用服务层设置开关
log.warn("关闭注册功能");
MethodSwitch.setSwitch(MethodSwitch.REGISTER, false);
} else {
// 调用服务层设置开关
log.warn("启用注册功能");
MethodSwitch.setSwitch(MethodSwitch.REGISTER, true);
}
// 设置成功状态码
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("操作成功");
// 返回响应对象
return responseData;
}
// * 修改投递功能开关状态
// * @param data 请求体
// * @param authorizationHeader 用户权限(token)
// * @return 包含响应信息的 ApiResponseData对象
/**
*
*
* @param data
* @param authorizationHeader (token)
* @return ApiResponseData
*/
@PostMapping("switch/submit")
public ApiResponseData<String> switchSubmit(@RequestBody SwitchMethodStatus data,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
}
if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "用户权限异常");
}
// 创建响应对象
ApiResponseData<String> responseData = new ApiResponseData<>();
if (data.getOpen() == 0) {
// 调用服务层设置开关
log.warn("关闭用户投递功能");
MethodSwitch.setSwitch(MethodSwitch.SUBMIT, false);
} else {
// 调用服务层设置开关
log.warn("启用用户投递功能");
MethodSwitch.setSwitch(MethodSwitch.SUBMIT, true);
}
// 设置成功状态码
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("操作成功");
// 返回响应对象
return responseData;
}
// * 修改重新投递功能开关状态
// * @param data 请求体
// * @param authorizationHeader 用户权限(token)
// * @return 包含响应信息的 ApiResponseData对象
/**
*
*
* @param data
* @param authorizationHeader (token)
* @return ApiResponseData
*/
@PostMapping("switch/resubmit")
public ApiResponseData<String> switchReSubmit(@RequestBody SwitchMethodStatus data,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
}
if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "用户权限异常");
}
// 创建响应对象
ApiResponseData<String> responseData = new ApiResponseData<>();
if (data.getOpen() == 0) {
// 调用服务层设置开关
log.warn("关闭重新投递功能");
MethodSwitch.setSwitch(MethodSwitch.TRY_SUBMIT, false);
} else {
// 调用服务层设置开关
log.warn("启用重新投递功能");
MethodSwitch.setSwitch(MethodSwitch.TRY_SUBMIT, true);
}
// 设置成功状态码
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("操作成功");
// 返回响应对象
return responseData;
}
// * 设置放弃功能开关状态
// * @param data 请求体
// * @param authorizationHeader 用户权限(token)
// * @return 包含响应信息的 ApiResponseData对象
/**
*
*
* @param data
* @param authorizationHeader (token)
* @return ApiResponseData
*/
@PostMapping("switch/abandon")
public ApiResponseData<String> switchAbandon(@RequestBody SwitchMethodStatus data,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
}
if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "用户权限异常");
}
// 创建响应对象
ApiResponseData<String> responseData = new ApiResponseData<>();
// 0是关闭,1是启用
if (data.getOpen() == 0) {
// 调用服务层设置开关
log.warn("关闭放弃功能");
MethodSwitch.setSwitch(MethodSwitch.ABANDON, false);
} else {
// 调用服务层设置开关
log.warn("启用放弃功能");
MethodSwitch.setSwitch(MethodSwitch.ABANDON, true);
}
// 设置成功状态码
responseData.setCode("0");
// 设置响应消息
responseData.setMessage("操作成功");
// 返回响应对象
return responseData;
}
// * 判断是否已经打印过准考证
// * @param id 投递的idthing-user表的主键
// * @param authorizationHeader 请求头token,jwt
// * @return 包含响应信息的 ApiResponseData对象
/**
*
*
* @param id idthing-user
* @param authorizationHeader token,jwt
* @return ApiResponseData
*/
@GetMapping("isPrinted")
public ApiResponseData<HashMap<String, Integer>> canPreviewAdmissionTicket(
@RequestParam("id") Integer id,
@RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "用户无权操作");
}
// 创建响应对象
ApiResponseData<HashMap<String, Integer>> responseData = new ApiResponseData<>();
// 判断是否已经打印过准考证
boolean printed = thingServiceImpl.isPrintedTicket(id);
if (printed) {
// 设置成功状态码
responseData.setCode("200");
// 设置响应消息
responseData.setMessage("已经打印过此准考证");
// 设置响应数据
responseData.setData(null);
// 返回响应对象
return responseData;
} else {
// 设置成功状态码
responseData.setCode("0");
// 设置响应消息
responseData.setData(null);
// 设置响应数据
return responseData;
}
}
// * 预览准考证
// * @param thingId 投递的岗位的idthing表的主键
// * @param recruitId 投递的idthing-user表的主键
// * @param response 写入响应文件
// * @param authorizationHeader 请求头token,jwt
// * @return 响应体
/**
*
*
* @param thingId idthing
* @param recruitId idthing-user
* @param response
* @param authorizationHeader token,jwt
* @return
*/
@GetMapping("previewTicket")
public ApiResponseData<HashMap<String, Integer>> previewAdmissionTicket(
@RequestParam Integer thingId, @RequestParam Integer recruitId,
HttpServletResponse response, @RequestHeader("Authorization") String authorizationHeader) {
// 解析JWT令牌获取用户信息
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "用户无权操作");
}
// 声明响应对象
ApiResponseData<HashMap<String, Integer>> responseData = new ApiResponseData<>();
if (thingId == null) {
// 设置成功状态码
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("参数异常");
// 设置响应数据
responseData.setData(null);
// 返回响应对象
return responseData;
}
// 获取在服务器端生成准考证文件地址
String path = thingServiceImpl.previewTicket(thingId, recruitId);
try {
// 将文件写入响应
UserServiceImpl.writeFileToResponse(false, path, response);
} catch (IOException e) {
log.error("保存准考证时发生IO异常");
}
// 文件直接写入响应流中,无需返回数据
return null;
}
// * 导出总表
// * @param authorizationHeader 请求头token
// * @param response 响应
// * @return 用户导出资格审查表 导出总表
/**
*
*
* @param authorizationHeader token
* @param response
* @return
*/
@GetMapping("excel")
public ApiResponseData<?> adminExportExcel(
@RequestHeader("Authorization") String authorizationHeader,
HttpServletResponse response) {
// 解析JWT令牌获取用户信息
ApiResponseData<?> responseData = new ApiResponseData<>();
Token token = JwtUtil.parseJWT(authorizationHeader);
if (token == null) {
// 令牌无效或过期返回401未授权错误
return new ApiResponseData<>("401", null, "登录失效,请重新登录");
} else if (token.getUserRole() < 2) {
// 用户权限不足返回500错误
return new ApiResponseData<>("500", null, "接口权限异常");
}
// 调用服务层获取文件地址
String outPutExcel = thingServiceImpl.outPutExcel();
// 检查文件路径和文件是否存在
if (outPutExcel == null) {
// 文件不存在,返回错误信息或跳转到错误页面
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("导出失败");
// 设置响应数据
return responseData;
}
try {
// 将文件写入响应
UserServiceImpl.writeFileToResponse(true, outPutExcel, response);
} catch (IOException e) {
// 处理文件写入异常
log.error("导出总表时出现IO异常");
// 返回错误信息或跳转到错误页面
responseData.setCode("500");
// 设置响应消息
responseData.setMessage("导出总表时出现IO异常");
// 设置响应数据
return responseData;
}
// 文件直接写入响应流中,无需返回数据
return responseData;
}
}

@ -0,0 +1,124 @@
package edu.ahbvc.recruit.mapper;
import edu.ahbvc.recruit.model.Admin;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author c215
*/
@Repository
@Mapper
public interface AdminInter {
// * 根据id查询管理员
// * @param id: 管理员id
// * @return 管理员(Admin)
/**
* id
* @param id: id
* @return (Admin)
*/
@Select("select * from admin where id = #{id}")
Admin getOne(int id);
// * 根据账号查询管理员
// * @param account: 管理员账号(手机号)
// * @return 管理员(Admin)
/**
*
* @param account: ()
* @return (Admin)
*/
@Select("select phone from admin where phone = #{account}")
String isAdmin(String account);
// * 管理员登录
// * @param account: 管理员账号(手机号)
// * @param pwd: 管理员密码
// * @return 管理员(Admin)
/**
*
* @param account: ()
* @param pwd:
* @return (Admin)
*/
@Select("select * from admin where phone = #{account} and pwd = #{pwd}")
Admin login(@Param("account") String account, @Param("pwd") String pwd);
// * 管理员分页查询
// * @param offset: 偏移量
// * @param size: 每页大小
// * @param name: 管理员姓名
// * @param phone: 管理员手机号
// * @return 管理员列表(List<Admin>)
/**
*
* @param offset:
* @param size:
* @param name:
* @param phone:
* @return (List<Admin>)
*/
@Select("select * from `admin`"
+ " WHERE `admin`.`name` LIKE CONCAT('%',IFNULL(#{name}, ''),'%')"
+ " AND `admin`.`phone` LIKE CONCAT('%',IFNULL(#{phone}, ''),'%')"
+ " LIMIT #{offset}, #{size}")
List<Admin> getAdmins(@Param("offset")int offset, @Param("size")int size, @Param("name")String name, @Param("phone")String phone);
// * 管理员数量查询(配合分页查询)
// * @param name: 管理员姓名
// * @param phone: 管理员手机号
// * @return 符合条件的管理员数量(Integer)
// * @see edu.ahbvc.recruit.mapper.AdminInter#getAdmins
/**
*
* @param name:
* @param phone:
* @return (Integer)
* @see edu.ahbvc.recruit.mapper.AdminInter#getAdmins
*/
@Select("select count(id) from `admin`"
+ " WHERE `admin`.`name` LIKE CONCAT('%',IFNULL(#{name}, ''),'%')"
+ " AND `admin`.`phone` LIKE CONCAT('%',IFNULL(#{phone}, ''),'%')")
Integer getAdminsNum(@Param("name")String name, @Param("phone")String phone);
// * 添加管理员
// * @param admin: 管理员(Admin)
// * @return 添加成功返回1否则返回0
/**
*
* @param admin: (Admin)
* @return 10
*/
@Insert("INSERT INTO `admin` (`name`, `account`, `pwd`, `phone`, `promise`)"
+ " VALUES(#{name}, #{account}, #{pwd}, #{phone}, #{viewOnly})")
@Options(useGeneratedKeys = true, keyProperty = "id")
int addAdmin(Admin admin);
// * 删除管理员
// * @param id: 管理员id
// * @return 删除成功返回1否则返回0
/**
*
* @param id: id
* @return 10
*/
@Delete("delete from `admin` where id = #{id}")
int delAdmin(int id);
// * 更新管理员信息
// * @param ad: 管理员(Admin)
// * @return 更新成功返回1否则返回0
/**
*
* @param ad: (Admin)
* @return 10
*/
@Update("update `admin` set name=#{name}, account=#{account}, "
+ "pwd=#{pwd}, phone=#{phone}, promise=#{viewOnly} where id = #{id}")
int updateAdmin(Admin ad);
}

@ -0,0 +1,435 @@
package edu.ahbvc.recruit.mapper;
import edu.ahbvc.recruit.model.Batch;
import edu.ahbvc.recruit.model.Position;
import edu.ahbvc.recruit.model.Thing;
import edu.ahbvc.recruit.model.ThingWithUser;
import edu.ahbvc.recruit.model.export.Excel;
import edu.ahbvc.recruit.model.export.Ticket;
import org.apache.ibatis.annotations.*;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
package edu.ahbvc.recruit.mapper;
// 导入必要的模型类和注解
import edu.ahbvc.recruit.model.Batch;
import edu.ahbvc.recruit.model.Position;
import edu.ahbvc.recruit.model.Thing;
import edu.ahbvc.recruit.model.ThingWithUser;
import edu.ahbvc.recruit.model.export.Excel;
import edu.ahbvc.recruit.model.export.Ticket;
import org.apache.ibatis.annotations.*;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
/**
* @author c215
*
* ThingInter -
* CRUD
*/
@Repository // 标识为Spring的Repository组件
@Mapper // MyBatis的Mapper接口
public interface ThingInter {
/**
*
* @param recruitId ID
* @param id ID
* @return Ticket
*/
@Select("SELECT `u`.idnum, `u`.`name`, `u`.phone tel, p.`code`, "
+ "CASE WHEN p.jobTitle LIKE '管%' THEN "
+ "'行政部门' " + "WHEN p.jobTitle LIKE '专业%' THEN "
+ "'二级学院' ELSE '其他部门'" + " END AS department ,"
+ "(CASE WHEN ut.ticket_num = 0 THEN "
+ "(SELECT MAX(ut2.ticket_num)+1 FROM `USER-thing` AS ut2 WHERE `thingid` = #{recruitId}) "
+ "ELSE ut.ticket_num END) AS ticketNumber "
+ "FROM "
+ "`USER-thing` AS ut " + "LEFT JOIN `batch-position` AS `bp` ON `bp`.id = ut.thingid "
+ "LEFT JOIN `positions` AS p ON `p`.id = bp.positionid "
+ "LEFT JOIN `USER` AS u ON ut.userid = u.id "
+ "LEFT JOIN batchs ON batchs.id = bp.batchid" + " WHERE "
+ "ut.id = #{id}")
Ticket getTicketData(@Param("recruitId")Integer recruitId, @Param("id")Integer id);
/**
*
* @param recruitId ID
* @return
*/
@Select("SELECT MAX(ticket_num) FROM `user-thing` WHERE `thingid` = #{recruitId}")
int getTicketNum(Integer recruitId);
/**
*
* @param thingid ID
* @return (0)
*/
@Select("SELECT `ticket_num` FROM `user-thing` where `id`=#{thingid}")
int isPrintedTicket(Integer thingid);
/**
*
* @param ticketNum
* @param thingId ID
* @return
*/
@Update("UPDATE `user-thing` "
+ "SET `ticket_num` = #{arg0} WHERE `id` = #{arg1}")
int setTicketPrinted(Integer ticketNum, Integer thingId);
/**
*
* @param userid ID
* @param batch ID(0)
* @return
*/
List<Batch> getthingForuser(@Param("userid") int userid, @Param("batch") int batch);
/**
*
* @param userid ID
* @return
*/
List<Thing> getThingAboutUser(@Param("userid") int userid);
/**
* ()
* @param currentPage
* @param size
* @param jobTitles
* @param batches
* @param status
* @param name
* @return
*/
List<ThingWithUser> getThings(@Param("currentPage") int currentPage, @Param("size") int size,
@Param("jobTitles") List<Integer> jobTitles, @Param("batches") List<Integer> batches,
@Param("status") List<Integer> status, @Param("name") String name);
/**
* ()
* @param currentPage
* @param size
* @param jobTitles
* @param batches
* @return
*/
List<ThingWithUser> getAuditThings(@Param("currentPage") int currentPage, @Param("size") int size,
@Param("jobTitles") List<Integer> jobTitles, @Param("batches") List<Integer> batches);
/**
* ID
* @param id ID
* @return
*/
List<ThingWithUser> getThingsById(@Param("thingId") List<Integer> id);
/**
*
* @param thingId ID
* @return
*/
@Select("SELECT `ut`.`id` thingId, `ut`.`status`,bp.id recruitId,"
+ "`ut`.`awardsAndPunishments`, `ut`.`note`, `ut`.`qualificationResult`,"
+ "batchs.id batchid,batchs.`name` batchname,p.id positionId, p.code, p.jobTitle,"
+ "u.id userId, u.`name` username" + " FROM `user-thing` AS ut"
+ " LEFT JOIN `batch-position` AS `bp` ON `bp`.id = ut.thingid "
+ " LEFT JOIN `positions` AS p ON `p`.id = bp.positionid" + " LEFT JOIN `user` AS u ON ut.userid = u.id "
+ " LEFT JOIN batchs ON batchs.id=bp.batchid" + " WHERE ut.id = #{id}")
ThingWithUser getOneThing(@Param("id") int thingId);
/**
*
* @return
*/
@Select("SELECT count(id) FROM `user-thing` WHERE `status` = '0' LIMIT 0,1000")
int getUnsettledThingsNum();
/**
*
* @param jobTitles
* @param batches
* @param status
* @param name
* @return
*/
Integer getThingsNum(@Param("jobTitles") List<Integer> jobTitles, @Param("batches") List<Integer> batches,
@Param("status") List<Integer> status, @Param("name") String name);
/**
*
* @param thingid ID
* @param status
* @return
*/
@Update("UPDATE `user-thing` SET `user-thing`.`status`= ${status} WHERE `user-thing`.id=${thingid}")
int updateThingStatus(@Param("thingid") int thingid, @Param("status") int status);
/**
*
* @param thingid ID
* @param status
* @param qualificationResult
* @return
*/
@Update("UPDATE `user-thing` SET `user-thing`.`status`= ${status},`user-thing`.`qualificationResult` = #{qualificationResult} WHERE `user-thing`.id=${thingid}")
int refuseThing(@Param("thingid") int thingid, @Param("status") int status,
@Param("qualificationResult") String qualificationResult);
/**
*
* @param thingid ID
* @param awardsAndPunishments
* @param note
* @param qualificationResult
* @return
*/
@Update("UPDATE `user-thing` SET " + "`user-thing`.`awardsAndPunishments`= IFNULL(#{awardsAndPunishments}, ''),"
+ "`user-thing`.`note`= IFNULL(#{note}, ''),"
+ "`user-thing`.`qualificationResult`= IFNULL(#{qualificationResult}, '')"
+ "WHERE `user-thing`.id = #{thingid}")
int updateThingInfo(@Param("thingid") int thingid,
@Param("awardsAndPunishments") String awardsAndPunishments, @Param("note") String note,
@Param("qualificationResult") String qualificationResult);
/**
*
* @param thingid ID
* @param qualificationResult
* @return
*/
@Update("UPDATE `user-thing` SET "
+ "`user-thing`.`qualificationResult`= IFNULL(#{qualificationResult}, '')"
+ "WHERE `user-thing`.id = #{thingid}")
int updateThingQualification(@Param("thingid") int thingid,
@Param("qualificationResult") String qualificationResult);
// 批次相关操作
/**
*
* @return
*/
@Select("SELECT batchs.id,batchs.name FROM `batchs`")
List<Batch> getBatchOption();
/**
*
* @param id ID
* @return
*/
@Select("SELECT batchs.*, COUNT(positions.id) num " + "FROM `batchs` "
+ "LEFT JOIN `batch-position` ON `batch-position`.batchid = batchs.id "
+ "LEFT JOIN positions ON positions.id=`batch-position`.positionid "
+ "GROUP BY batchs.id having batchs.id=#{id}")
Batch getBatch(int id);
/**
*
* @param currentPage
* @param size
* @param key
* @param state
* @return
*/
List<Batch> getBatches(@Param("currentPage") int currentPage, @Param("size") int size,
@Param("key") String key, @Param("state") Integer state);
/**
*
* @return
*/
@Select("SELECT batchs.*, COUNT(positions.id) positionNum " + "FROM `batchs` "
+ "LEFT JOIN `batch-position` ON `batch-position`.batchid = batchs.id "
+ "LEFT JOIN positions ON positions.id=`batch-position`.positionid "
+ "GROUP BY batchs.id having batchs.open=1 LIMIT 1")
Batch getCurrentBatch();
/**
*
* @param key
* @param state
* @return
*/
int getBatchesNum(@Param("key") String key, @Param("state") Integer state);
/**
*
* @param batch
* @return
*/
@Update("UPDATE batchs SET name = #{name},startime = #{startime},"
+ "deadline = #{deadline},open = #{open}, `disableAutoUpdate`=#{disableAutoUpdate} where id = #{id}")
int updateBatch(Batch batch);
/**
*
* @param id ID
* @return
*/
@Update("UPDATE batchs SET open = 1 where id = #{id}")
int updateBatchOpen(int id);
/**
*
* @return
*/
@Update("UPDATE batchs SET open = 0")
int updateBatchClose();
/**
*
* @param batch
* @return
*/
@Insert("INSERT INTO `batchs` (`open`, `name`, `disableAutoUpdate`) VALUES (#{open}, #{name}, #{disableAutoUpdate})")
int addBatch(Batch batch);
/**
*
* @param id ID
* @return
*/
@Delete("DELETE FROM `batchs` WHERE `id` = #{id}")
int delBatch(int id);
// 岗位相关操作
/**
*
* @param currentPage
* @param size
* @return
*/
List<Position> getPositions(@Param("currentPage") int currentPage, @Param("size") int size);
/**
*
* @return
*/
int getPositionsNum();
/**
*
* @return
*/
@Select("SELECT positions.id, CONCAT(positions.code, ' - ', positions.jobTitle) AS jobTitle FROM positions")
List<Position> getPositionOption();
/**
*
* @param batchid ID
* @param offset
* @param size
* @return
*/
List<Position> getSomePosition(@Param("batchid") int batchid, @Param("offset") int offset,
@Param("size") int size);
/**
*
* @param id ID
* @return
*/
@Select("SELECT positions.*, COUNT(`user-thing`.userid) toll,"
+ " batchs.id bid,batchs.`open`, batchs.`name`, batchs.startime bstart"
+ " FROM positions "
+ " LEFT JOIN `user-thing` ON `user-thing`.thingid = positions.id"
+ " LEFT JOIN batchs ON batchs.id = positions.batch WHERE positions.id = ${id}"
+ " GROUP BY positions.id")
Position getOnePosition(int id);
/**
*
* @param p
* @return
*/
@Insert("INSERT INTO positions (`jobTitle`, `code`, `type`, `specialty`, `education`, `degree`, `maxAge`, `sex`, `zzmm`, `info`, `toll`, `require`) "
+ "VALUES (#{jobTitle}, #{code}, #{type}, #{specialty}, #{education}, #{degree}, #{maxAge}, #{sex}, #{zzmm}, #{info}, #{toll}, #{require})")
int addPosition(Position p);
/**
*
* @param id ID
* @return
*/
@Delete("DELETE FROM `positions` WHERE `id` = #{id}")
int delPosition(int id);
/**
*
* @param id ID
* @return
*/
int delPositions(@Param("id") List<Integer> id);
/**
*
* @param p
* @return
*/
@Update("UPDATE `positions` SET `jobTitle` = #{jobTitle}, `code` = #{code}, `type` = #{type}, `specialty` = #{specialty}, `education` = #{education}, `degree` = #{degree}, `maxAge` = #{maxAge}, `sex` = #{sex}, `zzmm` = #{zzmm}, `info` = #{info}, `toll` = #{toll}, `require` = #{require} WHERE `id` = #{id}")
int updatePosition(Position p);
// 招聘岗位相关操作
/**
*
* @param currentPage
* @param size
* @param jobTitle
* @param batchs
* @return
*/
List<Thing> getRecruits(@Param("currentPage") int currentPage, @Param("size") int size,
@Param("jobTitle") List<Integer> jobTitle, @Param("batch") List<Integer> batchs);
/**
*
* @param jobTitle
* @param batch
* @return
*/
int getRecruitNum(@Param("jobTitle") List<Integer> jobTitle, @Param("batch") List<Integer> batch);
/**
*
* @param batchid ID
* @param positionid ID
* @return
*/
@Insert("INSERT INTO `batch-position` (`batchid`, `positionid`) VALUES (#{batchid}, #{positionid})")
int addRecruit(@Param("batchid") Integer batchid, @Param("positionid") Integer positionid);
/**
*
* @param id IDm
* @param batchid ID
* @param positionid ID
* @return
*/
@Update("UPDATE `batch-position` SET `batchid` = #{batchid}, `positionid` = #{positionid} WHERE id = #{id}")
int updateRecruit(@Param("id") Integer id, @Param("batchid") Integer batchid,
@Param("positionid") Integer positionid);
/**
*
* @param id ID
* @return
*/
@Delete("DELETE FROM `batch-position` WHERE id = #{id}")
int deleteRecruit(int id);
/**
*
* @return Excel
*/
ArrayList<Excel> getPrintData();
}

@ -0,0 +1,204 @@
// 定义包路径
package edu.ahbvc.recruit.mapper;
// 导入所需的类
import edu.ahbvc.recruit.model.User;
import edu.ahbvc.recruit.model.resume.*;
import org.apache.ibatis.annotations.*;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
/**
* 访
*
* @author c215
*/
// 标识这是一个Spring数据访问组件
@Repository
// MyBatis注解标识这是一个Mapper接口
@Mapper
public interface UserInter {
// 根据ID查询单个用户信息
@Select("select * from `user` where id = #{id}")
User getOne(int id);
// 根据ID查询单个用户的基本信息
@Select("select * from `user` where id = #{id}")
UserInfo getOneInfo(int id);
// 分页查询用户列表,支持按姓名、身份证号、手机号模糊查询
@Select("SELECT * FROM `user`" + " WHERE (`name` LIKE CONCAT('%', IFNULL(#{name}, ''), '%') )"
+ " AND (`idnum` LIKE CONCAT('%', IFNULL(#{idnum}, ''), '%') )"
+ " AND (`phone` LIKE CONCAT('%', IFNULL(#{phone}, ''), '%') )"
+ " LIMIT #{offset}, #{size}")
List<User> getUsers(@Param("offset") int offset, @Param("size") int size, @Param("name") String name,
@Param("phone") String phone, @Param("idnum") String idnum);
// 获取符合条件的用户总数
@Select("select COUNT(id) from `user`" + " WHERE (`name` LIKE CONCAT('%', IFNULL(#{name}, ''), '%') )"
+ " AND (`idnum` LIKE CONCAT('%', IFNULL(#{idnum}, ''), '%') )"
+ " AND (`phone` LIKE CONCAT('%', IFNULL(#{phone}, ''), '%') )")
int getUsersNum(@Param("name") String name, @Param("phone") String phone, @Param("idnum") String idnum,
@Param("degree") Integer degree);
// 根据事项ID查询参与该事项的用户列表
@Select("SELECT `user`.* FROM `user-thing` LEFT JOIN `user` ON `user`.id = `user-thing`.userid where `user-thing`.thingid = #{thingId}")
List<User> getThingUsers(int thingId);
// 用户登录验证,支持身份证号或手机号登录
@Select("SELECT * FROM `user` WHERE (idnum = #{idnum} OR phone = #{idnum}) AND pwd = #{pwd}")
User login(@Param("idnum") String account, @Param("pwd") String pwd);
// 通过手机号注册用户
@Insert("INSERT INTO `user` (`name`, `phone`, `pwd`)" + " VALUES ('访客', #{phone}, #{pwd})")
int registerByPhone(@Param("phone") String phone, @Param("pwd") String pwd);
// 检查身份证号是否已存在
@Select("SELECT count(`id`) FROM `user` WHERE `user`.idnum=#{idnum}")
int exists(String idnum);
// 检查用户是否已经参与过招聘
@Select("SELECT count(id) FROM `user-thing` WHERE `userid` = #{arg0} AND `status` !=-2")
int alreadyRecruit(String userId);
// 检查手机号是否已存在
@Select("SELECT count(*) FROM `user` WHERE `user`.phone=#{phone}")
int existsByPhone(String phone);
// 获取最新创建的用户
@Select("SELECT * FROM `user` ORDER BY `id` DESC LIMIT 1;")
User getNewUser();
// 检查用户是否已申请某个招聘事项
@Select("SELECT COUNT(id) FROM `user-thing` WHERE `userid`=#{userid} and `thingid`=#{recruitId}")
int thingExist(int userid, int recruitId);
// 检查事项是否存在
@Select("SELECT COUNT(id) FROM `user-thing` WHERE `id`= #{arg0}")
int thingExist2(int thingId);
// 申请职位
@Insert("INSERT INTO `user-thing` (`userid`, `thingid`, `time`)"
+ " VALUES (#{arg0}, #{arg1}, NOW())")
int applyJob(int userid, int recruitId);
// 申请职位(带奖惩情况和备注)
@Insert("INSERT INTO `user-thing` (`userid`, `thingid`, `time`, `awardsAndPunishments`, `note`)"
+ " VALUES (#{userid}, #{recruitId}, NOW(), #{awardsAndPunishments}, #{note})")
int applyJob2(int userid, int recruitId, String awardsAndPunishments, String note);
// 重新尝试申请职位
@Insert("UPDATE `user-thing` set `status`=0, `qualificationResult` = NULL WHERE `id` = #{arg0}")
int reTryJob(int thingid);
// 放弃申请
@Delete("Delete FROM `user-thing` WHERE id = #{thingid} and userid = #{userid}")
int abandon(int thingid, int userid);
// 添加新用户
@Insert("INSERT INTO `user` (`name`, `sex`, `phone`, `birthPlace`, `nation`, `zzmm`, `email`,"
+ " `birthday`, `idnum`, `married`, `nativePlace`, `address`, `specialtiesCertificates`, `pwd`)"
+ " VALUES (#{name}, #{sex}, #{phone}, #{birthPlace}, #{nation}, #{zzmm}, #{email}"
+ ", #{birthday}, #{idnum}, #{married}, #{nativePlace}, #{address}, #{specialtiesCertificates}, #{pwd})")
int addUser(User u);
// 删除用户
@Delete("DELETE FROM `user` WHERE id = #{id}")
int delUser(int id);
/**
*
* @param u
* @return user
* <p>(idnum)(name)</p>
*/
@Update("UPDATE user SET name = #{u.name}, idnum = #{u.idnum} " + "WHERE id = #{u.id}")
int updateUserName(@Param("u") User u);
/**
*
* @param u
* @return user
*/
@Update("UPDATE user SET sex = #{u.sex}, birthPlace = #{u.birthPlace}, "
+ "nation = #{u.nation}, zzmm = #{u.zzmm}, email = #{u.email}, birthday = #{u.birthday}, "
+ "married = #{u.married}, nativePlace = #{u.nativePlace}, "
+ "address = #{u.address}, specialtiesCertificates = #{u.specialtiesCertificates} " + "WHERE id = #{u.id}")
int updateUser2(@Param("u") User u);
// 更新用户密码
@Update("UPDATE user SET `pwd` = #{arg1} " + "WHERE id = #{arg0}")
int updateUserPwd(int id, String pwd);
// 使用旧密码验证后更新密码
@Update("UPDATE user SET `pwd` = #{arg1} " + "WHERE id = #{arg0} AND `pwd` = #{arg2}")
int updateUserPwdByOld(int id, String pwd, String oldpwd);
/**
*
* @param u
* @return
*/
@Update("UPDATE user SET sex = #{u.sex}, birthPlace = #{u.birthPlace}, "
+ "nation = #{u.nation}, zzmm = #{u.politicalStatus}, email = #{u.email}, birthday = #{u.birthday}, "
+ "married = #{u.married}, nativePlace = #{u.nativePlace}, "
+ "address = #{u.address}, specialtiesCertificates = #{u.specialtiesCertificates} " + "WHERE id = #{u.id}")
int updateUser(@Param("u") UserInfo u);
// 更新用户实名信息
@Update("UPDATE `user` SET `name` = #{name}, `idnum` = #{idnum} WHERE `id` = #{id}")
int updateRealName(@Param("id") int id, @Param("idnum") String idnum, @Param("name") String name);
// 获取用户教育经历
@Select("SELECT * FROM `education` WHERE id = #{userId};")
ArrayList<Education> getEducation(@Param("userId") int processedUserid);
// 添加教育经历
int addEducation(@Param("e")ArrayList<Education> e);
// 获取用户工作经历
@Select("SELECT * FROM `workexperience` WHERE id = #{userId}")
ArrayList<WorkExperience> getWorkExperience(@Param("userId") int processedUserid);
// 添加工作经历
int addWorkExperience(@Param("w")ArrayList<WorkExperience> w);
// 获取用户论文信息
@Select("SELECT * FROM Paper WHERE id = #{userId}")
ArrayList<Paper> getPaper(@Param("userId") int processedUserid);
// 添加论文信息
int addPaper(@Param("p") ArrayList<Paper> p);
// 获取用户项目经历
@Select("SELECT * FROM Project WHERE id = #{userId}")
ArrayList<Project> getProject(@Param("userId") int processedUserid);
// 添加项目经历
int addProject(@Param("p")ArrayList<Project> p);
// 获取用户科研经历
@Select("SELECT * FROM Research WHERE id = #{userId}")
ArrayList<Research> getResearch(@Param("userId") int processedUserid);
// 添加科研经历
int addResearch(@Param("r")ArrayList<Research> r);
// 获取用户家庭成员信息
@Select("SELECT * FROM FamilyConnections WHERE id = #{userId}")
ArrayList<FamilyConnections> getFamilyConnections(@Param("userId") int processedUserid);
// 添加家庭成员信息
int addFamilyConnections(@Param("f")ArrayList<FamilyConnections> f);
// 删除用户所有简历相关数据
void delUserResumeAllData(@Param("userid") int processedUserid);
// 根据用户名加载用户详情用于Spring Security
@Select("SELECT * FROM `user-thing` WHERE `userid` = #{arg0}")
UserDetails loadUserByUsername(String username);
}

@ -0,0 +1,67 @@
package edu.ahbvc.recruit.model;
/**
* @author c215
*/
public class Admin {
private int id;
private String name;
private String account;
private String pwd;
private String phone;
private Integer promise;
public Admin() {
super();
}
public Admin(int id, String name, String num, String pwd, String tel, Integer viewOnly) {
super();
this.id = id;
this.name = name;
this.account = num;
this.pwd = pwd;
this.phone = tel;
this.promise = viewOnly;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAccount() {
return account;
}
public void setAccount(String num) {
this.account = num;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public String getPhone() {
return phone;
}
public void setPhone(String tel) {
this.phone = tel;
}
public Integer getPromise() {
return promise;
}
public void setPromise(Integer viewOnly) {
this.promise = viewOnly;
}
@Override
public String toString() {
return "Admin [id=" + id + ", name=" + name + ", account=" + account + ", pwd=" + pwd + ", phone=" + phone + "]";
}
}

@ -0,0 +1,54 @@
package edu.ahbvc.recruit.model;
/**
* @author c215
*
*
*/
public class ApiResponseData<T> {
public String code;
public T data;
public String message;
public ApiResponseData() {
super();
}
public ApiResponseData(String code, T data, String message) {
super();
this.code = code;
this.data = data;
this.message = message;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
return "ApiResponseData [code=" + code + ", data=" + data + ", message=" + message + "]";
}
}

@ -0,0 +1,102 @@
package edu.ahbvc.recruit.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class Batch {
private int id;
@JsonIgnore
private int index;
private String name;
private String startTime;
private String deadline;
private int open;
private int disableAutoUpdate;
private int positionNum;
public Batch() {
super();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getDeadline() {
return deadline;
}
public void setDeadline(String deadline) {
this.deadline = deadline;
}
public int getPositionNum() {
return positionNum;
}
public void setPositionNum(int positionNum) {
this.positionNum = positionNum;
}
public int getOpen() {
return open;
}
public void setOpen(int canuse) {
this.open = canuse;
}
public int getDisableAutoUpdate() {
return disableAutoUpdate;
}
public void setDisableAutoUpdate(int disableAutoUPDATE) {
this.disableAutoUpdate = disableAutoUPDATE;
}
public int getNum() {
return positionNum;
}
public void setNum(int num) {
this.positionNum = num;
}
@Override
public String toString() {
return "Batch [id=" + id + ", index=" + index + ", name=" + name + ", startime=" + startTime + ", deadline="
+ deadline + ", open=" + open + ", disableAutoUpdate=" + disableAutoUpdate + ", positionNum="
+ positionNum + "]";
}
}

@ -0,0 +1,164 @@
package edu.ahbvc.recruit.model;
/**
*
*
* @author c215
*/
public class Position {
private int id;
/**
* () 2003 01 001
*/
private int recruitId;
private String code;
private String jobTitle;
private int toll;
private String type;
private String specialty;
private int education;
private int degree;
/**
* 0 1 2
* tinyint
* 0
*/
private int sex;
/**
*
*/
private String politicalStatus;
private int maxAge;
private String info;
private String require;
public Position() {
super();
}
public Position(int id, int recruitId, String code, String jobTitle, int toll,
int education, int degree, int maxAge, String info, String require) {
super();
this.id = id;
this.recruitId = recruitId;
this.code = code;
this.jobTitle = jobTitle;
this.toll = toll;
this.education = education;
this.degree = degree;
this.maxAge = maxAge;
this.info = info;
this.require = require;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getRecruitId() {
return recruitId;
}
public void setRecruitId(int recruitId) {
this.recruitId = recruitId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getJobTitle() {
return jobTitle;
}
public void setJobTitle(String jobTitle) {
this.jobTitle = jobTitle;
}
public int getEducation() {
return education;
}
public void setEducation(int degree) {
this.education = degree;
}
public int getMaxAge() {
return maxAge;
}
public void setMaxAge(int maxAge) {
this.maxAge = maxAge;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public int getDegree() {
return degree;
}
public void setDegree(int degree) {
this.degree = degree;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSpecialty() {
return specialty;
}
public void setSpecialty(String specialty) {
this.specialty = specialty;
}
public String getPoliticalStatus() {
return politicalStatus;
}
public void setPoliticalStatus(String politicalStatus) {
this.politicalStatus = politicalStatus;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public int getToll() {
return toll;
}
public void setToll(int toll) {
this.toll = toll;
}
public String getRequire() {
return require;
}
public void setRequire(String require) {
this.require = require;
}
@Override
public String toString() {
return "Position [id=" + id + ", recruitId=" + recruitId + ", code=" + code + ", jobTitle=" + jobTitle
+ ", toll=" + toll + ", maxAge=" + maxAge + ", education="
+ education + ", info=" + info + ", require=" + require + "]";
}
}

@ -0,0 +1,34 @@
package edu.ahbvc.recruit.model;
/**
*
* @author c215
*/
public class RefuseDataMap {
private Integer thingId;
private String qualificationResult;
public Integer getThingId() {
return thingId;
}
public void setThingId(Integer thingId) {
this.thingId = thingId;
}
public String getQualificationResult() {
return qualificationResult;
}
public void setQualificationResult(String qualificationResult) {
this.qualificationResult = qualificationResult;
}
@Override
public String toString() {
return "RefuseDataMap{" +
"thingId=" + thingId +
", qualificationResult='" + qualificationResult + '\'' +
'}';
}
}

@ -0,0 +1,27 @@
package edu.ahbvc.recruit.model;
/**
* @author c215
*/
public class SwitchMethodStatus {
private Integer open;
public SwitchMethodStatus() {
super();
}
public SwitchMethodStatus(Integer open) {
super();
this.open = open;
}
public Integer getOpen() {
return open;
}
public void setOpen(Integer open) {
this.open = open;
}
}

@ -0,0 +1,177 @@
package edu.ahbvc.recruit.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class Thing {
/** 岗位id */
private int positionId;
/** 岗位与批次关系表的主键id */
private int recruitId;
/** 用户与<岗位批次>关系表的主键id */
private int thingId;
private String jobTitle;
private String code;
private Integer ticketNum;
private int batchId;
private String batchname;
private int degree;
private int status;
private String awardsAndPunishments;
private String note;
private String qualificationResult;
/**
*
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd,HH-mm-ss")
private Date time;
/**
* ,
*/
private int ok;
public Thing() {
super();
}
public Thing(int id, int recruitId, String batch, int batchid, int degree, int status,
String jobTitle, int ok) {
super();
this.positionId = id;
this.recruitId = recruitId;
this.batchname = batch;
this.batchId = batchid;
this.degree = degree;
this.status = status;
this.jobTitle = jobTitle;
this.ok = ok;
}
public int getPositionId() {
return positionId;
}
public void setPositionId(int id) {
this.positionId = id;
}
public int getRecruitId() {
return recruitId;
}
public void setRecruitId(int recruitId) {
this.recruitId = recruitId;
}
public int getThingId() {
return thingId;
}
public void setThingId(int thingId) {
this.thingId = thingId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getTicketNum() {
return ticketNum;
}
public void setTicketNum(Integer ticketNum) {
this.ticketNum = ticketNum;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getBatchname() {
return batchname;
}
public void setBatchname(String batch) {
this.batchname = batch;
}
public int getDegree() {
return degree;
}
public void setDegree(int degree) {
this.degree = degree;
}
public String getJobTitle() {
return jobTitle;
}
public void setJobTitle(String jobTitle) {
this.jobTitle = jobTitle;
}
public int getOk() {
return ok;
}
public void setOk(int ok) {
this.ok = ok;
}
public int getBatchId() {
return batchId;
}
public void setBatchId(int batchid) {
this.batchId = batchid;
}
public String getAwardsAndPunishments() {
return awardsAndPunishments;
}
public void setAwardsAndPunishments(String awardsAndPunishments) {
this.awardsAndPunishments = awardsAndPunishments;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getQualificationResult() {
return qualificationResult;
}
public void setQualificationResult(String qualificationResult) {
this.qualificationResult = qualificationResult;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
@Override
public String toString() {
return "TableDataThing [positionId=" + positionId + "," + jobTitle + ", batchname=" + batchname + ", degree=" + degree
+ ", status=" + status + ", ok=" + ok + "]";
}
}

@ -0,0 +1,46 @@
package edu.ahbvc.recruit.model;
public class ThingWithUser extends Thing{
private String username;
private int userId;
public ThingWithUser() {
super();
}
public ThingWithUser(int id, int recruitId, String batch, int batchId, int degree, int status,
String department, String jobTitle, int ok) {
super(id, recruitId, batch, batchId, degree, status, jobTitle, ok);
}
public ThingWithUser(String username, int userId) {
super();
this.username = username;
this.userId = userId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
@Override
public String toString() {
return "TableDataThingWithUser [username=" + username + ", userId=" + userId + "]";
}
}

@ -0,0 +1,212 @@
package edu.ahbvc.recruit.model;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection;
import java.util.List;
/**
* Authorization (like 'Token')
* {@link edu.ahbvc.recruit.model.resume.UserInfo}
* @author c215
*/
public class User implements UserDetails {
private int id;
private String name;
private int sex;
private String phone;
private String birthPlace;
private String nation;
private String politicalStatus;
private String email;
private String birthday;
private String idNum;
private String married;
/**
*
*/
private String nativePlace;
/**
*
*/
private String address;
/**
* ,
*/
private String specialtiesCertificates;
public User() {
super();
}
public User(int id, String name, int sex, String phone, String birthPlace, String nation, String politicalStatus, String email,
String birthday, String idNum, String married, String nativePlace, String address,
String specialtiesCertificates) {
super();
this.id = id;
this.name = name;
this.sex = sex;
this.phone = phone;
this.birthPlace = birthPlace;
this.nation = nation;
this.politicalStatus = politicalStatus;
this.email = email;
this.birthday = birthday;
this.idNum = idNum;
this.married = married;
this.nativePlace = nativePlace;
this.address = address;
this.specialtiesCertificates = specialtiesCertificates;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getBirthPlace() {
return birthPlace;
}
public void setBirthPlace(String birthPlace) {
this.birthPlace = birthPlace;
}
public String getNation() {
return nation;
}
public void setNation(String nation) {
this.nation = nation;
}
public String getPoliticalStatus() {
return politicalStatus;
}
public void setPoliticalStatus(String politicalStatus) {
this.politicalStatus = politicalStatus;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getIdNum() {
return idNum;
}
public void setIdNum(String idNum) {
this.idNum = idNum;
}
public String getMarried() {
return married;
}
public void setMarried(String married) {
this.married = married;
}
public String getNativePlace() {
return nativePlace;
}
public void setNativePlace(String nativePlace) {
this.nativePlace = nativePlace;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getSpecialtiesCertificates() {
return specialtiesCertificates;
}
public void setSpecialtiesCertificates(String specialtiesCertificates) {
this.specialtiesCertificates = specialtiesCertificates;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", name='" + name + '\'' +
", sex=" + sex +
", phone='" + phone + '\'' +
", birthPlace='" + birthPlace + '\'' +
", nation='" + nation + '\'' +
", politicalStatus='" + politicalStatus + '\'' +
", email='" + email + '\'' +
", birthday='" + birthday + '\'' +
", idNum='" + idNum + '\'' +
", married='" + married + '\'' +
", nativePlace='" + nativePlace + '\'' +
", address='" + address + '\'' +
", specialtiesCertificates='" + specialtiesCertificates + '\'' +
'}';
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return List.of();
}
@Override
public String getPassword() {
return "";
}
@Override
public String getUsername() {
return "";
}
}

@ -0,0 +1,40 @@
package edu.ahbvc.recruit.model.api;
public class ImageCaptchaResponse {
/**
* API
*/
public String statusCode;
/**
*
*/
public String desc;
/**
*
*/
public VerifyCodeResponse result;
public String getStatusCode() {
return statusCode;
}
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public VerifyCodeResponse getResult() {
return result;
}
public void setResult(VerifyCodeResponse result) {
this.result = result;
}
}

@ -0,0 +1,49 @@
package edu.ahbvc.recruit.model.api;
// 导入Jackson库用于JSON处理
import com.fasterxml.jackson.databind.ObjectMapper;
// 导入日志相关类
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author c215
*
* JsonReader - APIJSON
* @param <T>
*/
public class JsonReader<T> {
// 使用SLF4J日志框架
private static final Logger log = LoggerFactory.getLogger(JsonReader.class);
/**
* APIJSON
*
* @param apiResponse APIJSON
* @param clazz Class
* @return null
*/
public T processApiResponse(String apiResponse, Class<T> clazz) {
// 初始化返回对象
// 问题建议添加null检查或者抛出特定异常而不是返回null
// 返回转换结果
T temp = null;
try {
// 解析JSON响应
ObjectMapper objectMapper = new ObjectMapper();
temp = objectMapper.readValue(apiResponse, clazz);
} catch (Exception e) {
// 处理解析异常
// 捕获并记录JSON解析异常
// 问题这里可以添加更详细的错误信息如原始JSON内容
// 将JSON字符串转换为指定类型的对象
// 创建Jackson ObjectMapper实例
log.error("解析JSON失败",e);
}
return temp;
}
}

@ -0,0 +1,63 @@
package edu.ahbvc.recruit.model.api;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* API
* API
* 使API
*
* @author c215
*/
public class SMApiResponse {
// 响应状态码
public String code;
// 响应消息
@JsonProperty("msg")
public String message;
// 短信验证码UUID
@JsonProperty("smUuid")
public String smUuid;
// 构造函数
public SMApiResponse() {
super();
}
// getter方法
public String getCode() {
return code;
}
// setter方法
public void setCode(String code) {
this.code = code;
}
// getter方法
public String getMessage() {
return message;
}
// setter方法
public void setMessage(String message) {
this.message = message;
}
// getter方法
public String getSmUuid() {
return smUuid;
}
// setter方法
public void setSmUuid(String smUuid) {
this.smUuid = smUuid;
}
// 重写toString方法
@Override
public String toString() {
return "APIVerifyCodeResponse [code=" + code + ", message=" + message + ", data=" + smUuid + "]";
}
}

@ -0,0 +1,42 @@
package edu.ahbvc.recruit.model.api;
/**
* @author c215
* <p>
*
*
*
*/
public class VerifyCodeResponse {
/**
*
*/
private String fileName;
/**
* (6
*/
private String verifyCode;
// getter方法
public String getFileName() {
return fileName;
}
// setter方法
public void setFileName(String fileName) {
this.fileName = fileName;
}
/**
*
* @return
*/
public String getVerifyCode() {
return verifyCode;
}
// setter方法
public void setVerifyCode(String verifyCode) {
this.verifyCode = verifyCode;
}
}

@ -0,0 +1,209 @@
package edu.ahbvc.recruit.model.export;
import edu.ahbvc.recruit.model.resume.Education;
import java.util.ArrayList;
/**
* Excel
* @author c215
*/
public class Excel {
/**
*
*/
protected int no;
/**
* id
*/
protected int userid;
/**
*
*/
protected String code;
/**
*
*/
protected String name;
/**
*
*/
protected int sex;
/**
*
*/
protected String birthday;
/**
*
*/
protected String idnum;
/**
*
*/
protected ArrayList<Education> education;
/**
*
*/
protected String zzmm;
/**
*
*/
protected String nation;
/**
*
*/
protected String phone;
/**
*
*/
protected int status;
/**
*
*/
protected String note;
public Excel() {
super();
}
public Excel(int no, String code, String name, int sex, String birthday, String idnum,
ArrayList<Education> education, String zzmm, String nation, String phone, int status, String note) {
super();
this.no = no;
this.code = code;
this.name = name;
this.sex = sex;
this.birthday = birthday;
this.idnum = idnum;
this.education = education;
this.zzmm = zzmm;
this.nation = nation;
this.phone = phone;
this.status = status;
this.note = note;
}
public int getNo() {
return no;
}
public void setNo(int no) {
this.no = no;
}
public int getUserid() {
return userid;
}
public void setUserid(int userid) {
this.userid = userid;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getIdnum() {
return idnum;
}
public void setIdnum(String idnum) {
this.idnum = idnum;
}
public ArrayList<Education> getEducation() {
return education;
}
public void setEducation(ArrayList<Education> education) {
this.education = education;
}
public String getZzmm() {
return zzmm;
}
public void setZzmm(String zzmm) {
this.zzmm = zzmm;
}
public String getNation() {
return nation;
}
public void setNation(String nation) {
this.nation = nation;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
@Override
public String toString() {
return "Excel{" +
"no=" + no +
", userid=" + userid +
", code='" + code + '\'' +
", name='" + name + '\'' +
", sex=" + sex +
", birthday='" + birthday + '\'' +
", idnum='" + idnum + '\'' +
", education=" + education +
", zzmm='" + zzmm + '\'' +
", nation='" + nation + '\'' +
", phone='" + phone + '\'' +
", status=" + status +
", note='" + note + '\'' +
'}';
}
}

@ -0,0 +1,88 @@
package edu.ahbvc.recruit.model.export;
/**
*
*
* @author c215
*/
public class Ticket {
/**
*
*/
protected String code;
/**
*
*/
protected String ticketNumber;
protected String name;
protected String tel;
protected String idnum;
protected String department;
protected String batch;
public Ticket() {
super();
}
public Ticket(String myindex, String myindexWithUser, String name, String tel, String idnum,
String department, String batch) {
super();
this.code = myindex;
this.ticketNumber = myindexWithUser;
this.name = name;
this.tel = tel;
this.idnum = idnum;
this.department = department;
this.batch = batch;
}
public String getCode() {
return code;
}
public void setCode(String myindex) {
this.code = myindex;
}
public String getTicketNumber() {
return ticketNumber;
}
public void setTicketNumber(String myindexWithUser) {
this.ticketNumber = myindexWithUser;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getIdnum() {
return idnum;
}
public void setIdnum(String idnum) {
this.idnum = idnum;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getBatch() {
return batch;
}
public void setBatch(String batch) {
this.batch = batch;
}
@Override
public String toString() {
return "PrintCertificate [code=" + code + ", ticketNumber=" + ticketNumber + ", name=" + name
+ ", tel=" + tel + ", idnum=" + idnum + ", department=" + department + ", batch=" + batch + "]";
}
}

@ -0,0 +1,56 @@
package edu.ahbvc.recruit.model.page;
/**
*
* @author c215
*/
public class Page {
/**
*
*/
protected int currentPage;
/**
*
*/
protected int size;
/**
*
*/
public Page() {
super();
}
/**
*
* @param currentPage
* @param size
*/
public Page(int currentPage, int size) {
super();
this.currentPage = currentPage;
this.size = size;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
@Override
public String toString() {
return "PageUtil [currentPage=" + currentPage + ", size=" + size + "]";
}
}

@ -0,0 +1,51 @@
package edu.ahbvc.recruit.model.page;
/**
* @author c215
*/
public class SearchAndPageOfAdmin extends Page {
/**
*
*/
protected String name;
/**
*
*/
protected String phone;
public SearchAndPageOfAdmin() {
super();
}
public SearchAndPageOfAdmin(int currentPage, int size) {
super(currentPage, size);
}
public SearchAndPageOfAdmin(String name, String phone) {
super();
this.name = name;
this.phone = phone;
}
public String getName() {
return name;
}
public void setName(String key) {
this.name = key;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Override
public String toString() {
return "SearchAndPageOfAdmin [name=" + name + ", phone=" + phone + "]";
}
}

@ -0,0 +1,52 @@
package edu.ahbvc.recruit.model.page;
/**
*
* @author c215
*/
public class SearchAndPageOfBatches extends Page {
/**
*
*/
protected String key;
/**
*
*/
protected Integer state;
public SearchAndPageOfBatches() {
super();
}
public SearchAndPageOfBatches(int currentPage, int size) {
super(currentPage, size);
}
public SearchAndPageOfBatches(String key, Integer state) {
super();
this.key = key;
this.state = state;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
@Override
public String toString() {
return "SearchAndPageOfBatches [key=" + key + ", state=" + state + "]";
}
}

@ -0,0 +1,39 @@
package edu.ahbvc.recruit.model.page;
/**
*
* @author c215
*/
public class SearchAndPageOfDepartment extends Page {
/**
*
*/
protected String key;
public SearchAndPageOfDepartment() {
super();
}
public SearchAndPageOfDepartment(int currentPage, int size) {
super(currentPage, size);
}
public SearchAndPageOfDepartment(String key) {
super();
this.key = key;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
@Override
public String toString() {
return "SearchAndPageOfDepartment [key=" + key + "]";
}
}

@ -0,0 +1,31 @@
package edu.ahbvc.recruit.model.page;
import java.util.List;
/**
*
* @author c215
*/
public class SearchAndPageOfPosition extends Page {
/**
*
*/
private List<Integer> departments;
public SearchAndPageOfPosition() {
super();
}
public SearchAndPageOfPosition(int currentPage, int size) {
super(currentPage, size);
}
public List<Integer> getDepartments() {
return departments;
}
public void setDepartments(List<Integer> departments) {
this.departments = departments;
}
}

@ -0,0 +1,40 @@
package edu.ahbvc.recruit.model.page;
/**
*
* @author c215
*/
public class SearchAndPageOfPositionByUser extends Page {
public String code;
public int batchId;
public SearchAndPageOfPositionByUser() {
super();
}
public SearchAndPageOfPositionByUser(int currentPage, int size) {
super(currentPage, size);
}
public SearchAndPageOfPositionByUser(String code, int batchId) {
super();
this.code = code;
this.batchId = batchId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public int getBatchId() {
return batchId;
}
public void setBatchId(int batchId) {
this.batchId = batchId;
}
@Override
public String toString() {
return "SearchAndPageOfPositionByUser [code=" + code + ", batchId=" + batchId + "]";
}
}

@ -0,0 +1,102 @@
package edu.ahbvc.recruit.model.page;
import java.util.List;
/**
*
* @author c215
*/
public class SearchAndPageOfResult extends Page {
/**
*
*/
private List<Integer> batches;
/**
*
*/
private List<Integer> jobTitles;
/**
*
*/
private List<Integer> status;
/**
*
*/
private String name;
public SearchAndPageOfResult() {
super();
}
public SearchAndPageOfResult(int currentPage, int size, List<Integer> batches, List<Integer> jobTitles,
List<Integer> departments) {
super();
super.currentPage = currentPage;
super.size = size;
this.batches = batches;
this.jobTitles = jobTitles;
this.status = departments;
}
@Override
public int getCurrentPage() {
return super.getCurrentPage();
}
@Override
public void setCurrentPage(int currentPage) {
super.setCurrentPage(currentPage);
}
@Override
public int getSize() {
return super.getSize();
}
@Override
public void setSize(int size) {
super.setSize(size);
}
public List<Integer> getBatches() {
return batches;
}
public void setBatches(List<Integer> batches) {
this.batches = batches;
}
public List<Integer> getJobTitles() {
return jobTitles;
}
public void setJobTitles(List<Integer> jobTitles) {
this.jobTitles = jobTitles;
}
public List<Integer> getStatus() {
return status;
}
public void setStatus(List<Integer> departments) {
this.status = departments;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
final int maxLen = 10;
return "SearchAndPageOfResult [batches="
+ (batches != null ? batches.subList(0, Math.min(batches.size(), maxLen)) : null) + ", jobTitles="
+ (jobTitles != null ? jobTitles.subList(0, Math.min(jobTitles.size(), maxLen)) : null)
+ ", status="
+ (status != null ? status.subList(0, Math.min(status.size(), maxLen)) : null) + "]";
}
}

@ -0,0 +1,79 @@
package edu.ahbvc.recruit.model.page;
/**
*
* @author c215
*/
public class SearchAndPageOfUsers extends Page {
/**
*
*/
protected String name;
/**
*
*/
protected String phone;
/**
*
*/
protected String idnum;
/**
*
*/
protected Integer degree;
public SearchAndPageOfUsers() {
super();
}
public SearchAndPageOfUsers(int currentPage, int size) {
super(currentPage, size);
}
public SearchAndPageOfUsers(String name, String tel, String idnum, Integer degree) {
super();
this.name = name;
this.phone = tel;
this.idnum = idnum;
this.degree = degree;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getIdnum() {
return idnum;
}
public void setIdnum(String idnum) {
this.idnum = idnum;
}
public Integer getDegree() {
return degree;
}
public void setDegree(Integer degree) {
this.degree = degree;
}
@Override
public String toString() {
return "SearchAndPageOfUsers [name=" + name + ", phone=" + phone + ", idnum=" + idnum + ", degree=" + degree
+ "]";
}
}

@ -0,0 +1,70 @@
package edu.ahbvc.recruit.model.resume;
public class Education {
private int id;
private String school;
private String graduationTime;
private int degree;
private int education;
private String specialty;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSchool() {
return school;
}
public void setSchool(String school) {
this.school = school;
}
public String getGraduationTime() {
return graduationTime;
}
public void setGraduationTime(String graduationTime) {
this.graduationTime = graduationTime;
}
public int getDegree() {
return degree;
}
public void setDegree(int degree) {
this.degree = degree;
}
public int getEducation() {
return education;
}
public void setEducation(int education) {
this.education = education;
}
public String getSpecialty() {
return specialty;
}
public void setSpecialty(String specialty) {
this.specialty = specialty;
}
@Override
public String toString() {
return "Education{" +
"id=" + id +
", school='" + school + '\'' +
", graduationTime='" + graduationTime + '\'' +
", degree=" + degree +
", education=" + education +
", specialty='" + specialty + '\'' +
'}';
}
}

@ -0,0 +1,54 @@
package edu.ahbvc.recruit.model.resume;
/**
* @author c215
*/
public class FamilyConnections {
private int id;
private String name;
private String connection;
private String work;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getConnection() {
return connection;
}
public void setConnection(String connection) {
this.connection = connection;
}
public String getWork() {
return work;
}
public void setWork(String work) {
this.work = work;
}
@Override
public String toString() {
return "FamilyConnections{" +
"id=" + id +
", name='" + name + '\'' +
", connection='" + connection + '\'' +
", work='" + work + '\'' +
'}';
}
}

@ -0,0 +1,73 @@
package edu.ahbvc.recruit.model.resume;
/**
* @author c215
*/
public class Paper {
private int id;
private String journal;
private String title;
private String time;
private String journalNum;
public Paper() {
}
public Paper(int id, String journal, String title, String time, String journalNum) {
this.id = id;
this.journal = journal;
this.title = title;
this.time = time;
this.journalNum = journalNum;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getJournal() {
return journal;
}
public void setJournal(String journal) {
this.journal = journal;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getJournalNum() {
return journalNum;
}
public void setJournalNum(String journalNum) {
this.journalNum = journalNum;
}
@Override
public String toString() {
return "Paper{" +
"id=" + id +
", journal='" + journal + '\'' +
", title='" + title + '\'' +
", time='" + time + '\'' +
", journalNum='" + journalNum + '\'' +
'}';
}
}

@ -0,0 +1,73 @@
package edu.ahbvc.recruit.model.resume;
/**
* @author c215
*/
public class Project {
private int id;
private int type;
private String time;
private String title;
private String level;
private String rank;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank;
}
@Override
public String toString() {
return "Project{" +
"id=" + id +
", type=" + type +
", time='" + time + '\'' +
", title='" + title + '\'' +
", level='" + level + '\'' +
", rank='" + rank + '\'' +
'}';
}
}

@ -0,0 +1,33 @@
package edu.ahbvc.recruit.model.resume;
/**
* @author c215
*/
public class Research {
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Research{" +
"id=" + id +
", name='" + name + '\'' +
'}';
}
}

@ -0,0 +1,162 @@
package edu.ahbvc.recruit.model.resume;
/**
* @author c215
*/
public class UserInfo {
private int id;
private String name;
private int sex;
private String phone;
private String birthPlace;
private String nation;
private String politicalStatus;
private String email;
private String birthday;
private String idNum;
private String married;
/**
*
*/
private String nativePlace;
/**
*
*/
private String address;
/**
* ,
*/
private String specialtiesCertificates;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getBirthPlace() {
return birthPlace;
}
public void setBirthPlace(String birthPlace) {
this.birthPlace = birthPlace;
}
public String getNation() {
return nation;
}
public void setNation(String nation) {
this.nation = nation;
}
public String getPoliticalStatus() {
return politicalStatus;
}
public void setPoliticalStatus(String politicalStatus) {
this.politicalStatus = politicalStatus;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getIdNum() {
return idNum;
}
public void setIdNum(String idNum) {
this.idNum = idNum;
}
public String getMarried() {
return married;
}
public void setMarried(String married) {
this.married = married;
}
public String getNativePlace() {
return nativePlace;
}
public void setNativePlace(String nativePlace) {
this.nativePlace = nativePlace;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getSpecialtiesCertificates() {
return specialtiesCertificates;
}
public void setSpecialtiesCertificates(String specialtiesCertificates) {
this.specialtiesCertificates = specialtiesCertificates;
}
@Override
public String toString() {
return "UserInfo{" +
"id=" + id +
", name='" + name + '\'' +
", sex=" + sex +
", phone='" + phone + '\'' +
", birthPlace='" + birthPlace + '\'' +
", nation='" + nation + '\'' +
", zzmm='" + politicalStatus + '\'' +
", email='" + email + '\'' +
", birthday='" + birthday + '\'' +
", idNum='" + idNum + '\'' +
", married='" + married + '\'' +
", nativePlace='" + nativePlace + '\'' +
", address='" + address + '\'' +
", specialtiesCertificates='" + specialtiesCertificates + '\'' +
'}';
}
}

@ -0,0 +1,165 @@
package edu.ahbvc.recruit.model.resume;
import java.util.ArrayList;
/**
*
* @author c215
*/
public class UserResume {
private UserInfo info;
private String code;
private ArrayList<Education> education;
private ArrayList<WorkExperience> workExperience;
private ArrayList<Paper> paper;
private ArrayList<Project> project;
private ArrayList<Research> research;
private String awardsAndPunishments;
private ArrayList<FamilyConnections> family;
private String note;
private String qualificationResult;
private int thingId;
private int recruitId;
public UserResume() {
}
public UserResume(UserInfo info, String code, ArrayList<Education> education, ArrayList<WorkExperience> workExperience, ArrayList<Paper> paper, ArrayList<Project> project, ArrayList<Research> research, String awardsAndPunishments, ArrayList<FamilyConnections> family, String note, String qualificationResult, int thingId, int recruitId) {
this.info = info;
this.code = code;
this.education = education;
this.workExperience = workExperience;
this.paper = paper;
this.project = project;
this.research = research;
this.awardsAndPunishments = awardsAndPunishments;
this.family = family;
this.note = note;
this.qualificationResult = qualificationResult;
this.thingId = thingId;
this.recruitId = recruitId;
}
public UserInfo getInfo() {
return info;
}
public void setInfo(UserInfo info) {
this.info = info;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public ArrayList<Education> getEducation() {
return education;
}
public void setEducation(ArrayList<Education> education) {
this.education = education;
}
public ArrayList<WorkExperience> getWorkExperience() {
return workExperience;
}
public void setWorkExperience(ArrayList<WorkExperience> workExperience) {
this.workExperience = workExperience;
}
public ArrayList<Paper> getPaper() {
return paper;
}
public void setPaper(ArrayList<Paper> paper) {
this.paper = paper;
}
public ArrayList<Project> getProject() {
return project;
}
public void setProject(ArrayList<Project> project) {
this.project = project;
}
public ArrayList<Research> getResearch() {
return research;
}
public void setResearch(ArrayList<Research> research) {
this.research = research;
}
public String getAwardsAndPunishments() {
return awardsAndPunishments;
}
public void setAwardsAndPunishments(String awardsAndPunishments) {
this.awardsAndPunishments = awardsAndPunishments;
}
public ArrayList<FamilyConnections> getFamily() {
return family;
}
public void setFamily(ArrayList<FamilyConnections> family) {
this.family = family;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getQualificationResult() {
return qualificationResult;
}
public void setQualificationResult(String qualificationResult) {
this.qualificationResult = qualificationResult;
}
public int getThingId() {
return thingId;
}
public void setThingId(int thingId) {
this.thingId = thingId;
}
public int getRecruitId() {
return recruitId;
}
public void setRecruitId(int recruitId) {
this.recruitId = recruitId;
}
@Override
public String toString() {
return "UserResume{" +
"info=" + info +
", code='" + code + '\'' +
", education=" + education +
", workExperience=" + workExperience +
", paper=" + paper +
", project=" + project +
", research=" + research +
", awardsAndPunishments='" + awardsAndPunishments + '\'' +
", family=" + family +
", note='" + note + '\'' +
", qualificationResult='" + qualificationResult + '\'' +
", thingId=" + thingId +
", recruitId=" + recruitId +
'}';
}
}

@ -0,0 +1,62 @@
package edu.ahbvc.recruit.model.resume;
/**
* @author c215
*/
public class WorkExperience {
private int id;
private String company;
private String workTimeStart;
private String workTimeEnd;
private String position;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getWorkTimeStart() {
return workTimeStart;
}
public void setWorkTimeStart(String workTimeStart) {
this.workTimeStart = workTimeStart;
}
public String getWorkTimeEnd() {
return workTimeEnd;
}
public void setWorkTimeEnd(String workTimeEnd) {
this.workTimeEnd = workTimeEnd;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
@Override
public String toString() {
return "WorkExperience{" +
"id=" + id +
", company='" + company + '\'' +
", workTimeStart='" + workTimeStart + '\'' +
", workTimeEnd='" + workTimeEnd + '\'' +
", position='" + position + '\'' +
'}';
}
}

@ -0,0 +1,35 @@
package edu.ahbvc.recruit.model.token;
import edu.ahbvc.recruit.mapper.UserInter;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
/**
* UserInterUserDetailsService
* @author c215
*/
@Service
public class CustomUserDetailsService implements UserDetailsService {
// 这个类被注解为Service, 所以会被Spring容器管理
// 控制翻转!!!
// 依赖注入!!!
//
// 所以可以自动通过构造函数注入UserInter
final UserInter userInter;
public CustomUserDetailsService(UserInter userInter) {
this.userInter = userInter;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException{
// UserInter中实现了根据名字找用户的方法
// 因为JWT认证和更规范的权限管理暂暂未实现,所以此处用不到
// SELECT * FROM `user-thing` WHERE `userid` = #{arg0}
UserDetails userDetails = userInter.loadUserByUsername(username);
return userDetails;
}
}

@ -0,0 +1,151 @@
package edu.ahbvc.recruit.model.token;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
/**
*
* @author c215
*/
public class Token implements UserDetails {
private Integer userId;
/**
* Token,
*/
private Integer userRole;
/**
*
*/
private Date expiration;
/**
*
*/
private Date issuedAt;
public Token() {
super();
// 当前时间
this.issuedAt = new Date();
Calendar c = Calendar.getInstance();
c.setTime(this.issuedAt);
// 添加一天
c.add(Calendar.DATE, 1);
// 过期时间为一天后
this.expiration = c.getTime();
}
public Token(Integer userId, Integer userRole) {
super();
this.userId = userId;
this.userRole = userRole;
// 当前时间
this.issuedAt = new Date();
Calendar c = Calendar.getInstance();
c.setTime(this.issuedAt);
// 添加一天
c.add(Calendar.DATE, 1);
// 过期时间为一天后
this.expiration = c.getTime();
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getUserRole() {
return userRole;
}
public void setUserRole(Integer userRole) {
this.userRole = userRole;
}
public Date getExpiration() {
return expiration;
}
public void setExpiration(Date expiration) {
this.expiration = expiration;
}
public Date getIssuedAt() {
return issuedAt;
}
public void setIssuedAt(Date issuedAt) {
this.issuedAt = issuedAt;
}
@Override
public String toString() {
return "Token{" +
"userId=" + userId +
", userRole=" + userRole +
", expiration=" + expiration +
", issuedAt=" + issuedAt +
'}';
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return null;
}
@Override
public String getPassword() {
return null;
}
@Override
public String getUsername() {
return null;
}
/**
*
* @return booleantrue?normal:forbid
*/
@SuppressWarnings("OverridingMethodOnlyCallsSuper")
@Override
public boolean isAccountNonExpired() {
return UserDetails.super.isAccountNonExpired();
}
/**
*
* @return booleantrue?normal:forbid
*/
@Override
public boolean isAccountNonLocked() {
return UserDetails.super.isAccountNonLocked();
}
/**
*
* @return booleantrue?normal:forbid
*/
@Override
public boolean isCredentialsNonExpired() {
return UserDetails.super.isCredentialsNonExpired();
}
/**
*
* @return booleantrue?normal:forbid
*/
@Override
public boolean isEnabled() {
return UserDetails.super.isEnabled();
}
}

@ -0,0 +1,54 @@
package edu.ahbvc.recruit.service;
import java.util.List;
import edu.ahbvc.recruit.mapper.AdminInter;
import org.springframework.stereotype.Service;
import edu.ahbvc.recruit.model.Admin;
/**
* @author c215
*/
@Service
public class AdminServiceImpl {
private final AdminInter mapper;
public AdminServiceImpl(AdminInter mapper) {
this.mapper = mapper;
}
public Admin getOne(int id) {
return mapper.getOne(id);
}
public String isAdmin(String phone) {
return mapper.isAdmin(phone);
}
public Integer getAdminsNum(String name,String phone) {
return mapper.getAdminsNum(name, phone);
}
public Admin login(String num, String pwd) {
return mapper.login(num, pwd);
}
public List<Admin> getAdmins(int offset, int size, String name, String phone) {
return mapper.getAdmins(offset, size, name, phone);
}
public int addAdmin(Admin admin) {
return mapper.addAdmin(admin);
}
public int delAdmin(int id) {
return mapper.delAdmin(id);
}
public int updateAdmin(Admin ad) {
return mapper.updateAdmin(ad);
}
}

@ -0,0 +1,251 @@
package edu.ahbvc.recruit.service;
import edu.ahbvc.recruit.mapper.ThingInter;
import edu.ahbvc.recruit.model.Batch;
import edu.ahbvc.recruit.model.Position;
import edu.ahbvc.recruit.model.Thing;
import edu.ahbvc.recruit.model.ThingWithUser;
import edu.ahbvc.recruit.model.export.Excel;
import edu.ahbvc.recruit.model.export.Ticket;
import edu.ahbvc.recruit.util.AdmissionTicketCreater;
import edu.ahbvc.recruit.util.ExcelExporter;
import edu.ahbvc.recruit.util.file.FilePatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author c215
*/
@Service
public class ThingServiceImpl {
private static final Logger log = LoggerFactory.getLogger(ThingServiceImpl.class);
private final ThingInter mapper;
@Autowired
public ThingServiceImpl(ThingInter mapper) {
this.mapper = mapper;
}
public List<ThingWithUser> getThings(List<Integer> id) {
return mapper.getThingsById(id);
}
public List<ThingWithUser> getThings(int currentPage, int size, List<Integer> jobTitles,
List<Integer> batch, List<Integer> status, String name) {
List<ThingWithUser> list = mapper.getThings(currentPage, size, jobTitles, batch, status, name);
if(!list.isEmpty()) {
System.out.println(list.get(list.size()-1).getTime());
}
return list;
}
public List<ThingWithUser> getAuditThings(int currentPage, int size, List<Integer> jobTitles,
List<Integer> batch) {
return mapper.getAuditThings(currentPage, size, jobTitles, batch);
}
public Integer getThingsNum(List<Integer> jobTitles, List<Integer> batch, List<Integer> status, String name) {
return mapper.getThingsNum(jobTitles, batch, status, name);
}
public int getUnsettledThingsNum() {
return mapper.getUnsettledThingsNum();
}
public List<Batch> getBatchOption() {
return mapper.getBatchOption();
}
public Batch getBatch(int id) {
return mapper.getBatch(id);
}
public int updateBatch(Batch batch) {
return mapper.updateBatch(batch);
}
public int switchBatchOpen(int id) {
mapper.updateBatchClose();
return mapper.updateBatchOpen(id);
}
public int addBatch(Batch batch) {
return mapper.addBatch(batch);
}
public int delBatch(int id) {
return mapper.delBatch(id);
}
public List<Batch> getBatches(int currentPage, int size, String key, Integer state) {
return mapper.getBatches(currentPage, size, key, state);
}
public Batch getCurrentBatches() {
return mapper.getCurrentBatch();
}
public List<Batch> getOpenBatches() {
return mapper.getBatches(0, Integer.MAX_VALUE, null, 1);
}
public int getBatchesNum(String key, Integer state) {
return mapper.getBatchesNum(key, state);
}
public List<Position> getPositionOption() {
return mapper.getPositionOption();
}
public List<Position> getPositions(int currentPage, int size) {
return mapper.getPositions(currentPage, size);
}
public int getPositionsNum() {
return mapper.getPositionsNum();
}
public List<Position> getSomePosition(int batchId, int offset, int size) {
return mapper.getSomePosition(batchId, offset, size);
}
public Position getOnePosition(int id) {
return mapper.getOnePosition(id);
}
public int addPosition(Position p) {
return mapper.addPosition(p);
}
public int delPosition(int id) {
return mapper.delPosition(id);
}
public int delPositions(List<Integer> id) {
int i;
try {
i = mapper.delPositions(id);
} catch (DataIntegrityViolationException e) {
// 记录异常信息
log.error(e.getMessage());
// 返回一个错误标志
return -1;
}
return i;
}
public int updatePosition(Position p) {
return mapper.updatePosition(p);
}
public List<Batch> getthingForuser(int userid, int batch) {
return mapper.getthingForuser(userid, batch);
}
public int refuseThing(int thingid, int status, String qualificationResult) {
return mapper.refuseThing(thingid, status, qualificationResult);
}
public int updateThingStatus(int thingid, int status) {
return mapper.updateThingStatus(thingid, status);
}
public int updateThingInfo(int thingid, String awardsAndPunishments, String note, String qualificationResult) {
return mapper.updateThingInfo(thingid, awardsAndPunishments, note, qualificationResult);
}
public int updateThingInfo(int thingid, String qualificationResult) {
return mapper.updateThingQualification(thingid, qualificationResult);
}
public ThingWithUser getOneThing(int thingid) {
return mapper.getOneThing(thingid);
}
public List<Thing> getThingAboutUser(int userid) {
return mapper.getThingAboutUser(userid);
}
public List<Thing> getRecruits(int currentPage, int size, List<Integer> jobTitles, List<Integer> batch) {
return mapper.getRecruits(currentPage, size, jobTitles, batch);
}
public int getRecruitNum(List<Integer> jobTitles, List<Integer> batch) {
return mapper.getRecruitNum(jobTitles, batch);
}
public int addRecruit(Integer batchid, Integer positionid) {
return mapper.addRecruit(batchid, positionid);
}
public int updateRecruit(Integer id, Integer batchid, Integer positionid) {
return mapper.updateRecruit(id, batchid, positionid);
}
public int deleteRecruit(int id) {
try {
return mapper.deleteRecruit(id);
} catch (DataIntegrityViolationException e) {
// 捕获外键约束违反异常
log.error(e.getMessage());
// 返回一个错误标志
return -1;
}
}
public String outPutExcel() {
String saveExcelFilePath = FilePatch.SaveExcelFilePath;
ArrayList<Excel> printData = mapper.getPrintData();
int excelFile = ExcelExporter.getExcelFile(saveExcelFilePath);
int excel = ExcelExporter.exportToExcel(printData,saveExcelFilePath);
if(excel!=0) {
return null;
}
return saveExcelFilePath + "招聘总表.xlsx";
}
public String previewTicket(Integer id, Integer recruitid) {
Ticket ticketData = mapper.getTicketData(recruitid, id);
return AdmissionTicketCreater.generateUserDocument(ticketData);
}
public int conformPrintTicket(Integer thingid, Integer recruitid) {
int ticketNum = mapper.getTicketNum(recruitid);
int printedTicket = mapper.isPrintedTicket(thingid);
int ticketData;
if(printedTicket==0)
// 如果是没有打印过准考证的,就去当前岗位中的最大值加一
{
ticketData = mapper.setTicketPrinted(ticketNum+1, thingid);
} else
// 否则就使用原来的准考证序号
{
ticketData = mapper.setTicketPrinted(printedTicket, thingid);
}
return ticketData;
}
public int getOldTicketNum(Integer thingid, Integer recruitid) {
return mapper.isPrintedTicket(thingid);
}
public boolean isPrintedTicket(Integer thingid) {
int ticketData = mapper.isPrintedTicket(thingid);
return ticketData!=0;
}
}

@ -0,0 +1,356 @@
package edu.ahbvc.recruit.service;
import ch.qos.logback.classic.Logger;
import edu.ahbvc.recruit.mapper.UserInter;
import edu.ahbvc.recruit.model.ThingWithUser;
import edu.ahbvc.recruit.model.User;
import edu.ahbvc.recruit.model.resume.*;
import edu.ahbvc.recruit.util.file.FilePatch;
import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* @author c215
*/
@Service
public class UserServiceImpl {
private static final org.slf4j.Logger log = LoggerFactory.getLogger(UserServiceImpl.class);
private final UserInter mapper;
private boolean isDev;
@Autowired
public UserServiceImpl(UserInter mapper) {
this.mapper = mapper;
}
public User getOne(int id) {
return mapper.getOne(id);
}
public UserInfo getOneInfo(int id) {
return mapper.getOneInfo(id);
}
public List<User> getUsers(int offset, int size, String name, String tel, String idNum, Integer degree) {
return mapper.getUsers(offset, size, name, tel, idNum);
}
public int getUsersNum(String name, String tel, String idNum, Integer degree) {
return mapper.getUsersNum(name, tel, idNum, degree);
}
public int getUsersNum() {
return mapper.getUsersNum(null, null, null, null);
}
public User login(String account, String pwd) {
return mapper.login(account, pwd);
}
/**
* @param phone
* @param pwd
* @return ,newUser,
*
*/
public User registerByPhone(String phone, String pwd) {
int i = mapper.registerByPhone(phone, pwd);
if (i == 1) {
return getNewUser();
}
return null;
}
public int abandon(int userid, int thingId) {
return mapper.abandon(thingId, userid);
}
public int applyJob(int userid, int recruitId) {
int thingExist = mapper.thingExist(userid, recruitId);
if (thingExist == 1) {
return 2;
}
return mapper.applyJob(userid, recruitId);
}
public int applyJob2(int userid, int recruitId, String awardsAndPunishments, String note) {
int thingExist = mapper.thingExist(userid, recruitId);
if (thingExist == 1) {
return 2;
}
return mapper.applyJob2(userid, recruitId, awardsAndPunishments, note);
}
public int reTryJob(int userid, int thingId) {
int thingExist = mapper.thingExist2(thingId);
System.out.println(thingExist + "thingExist");
if (thingExist == 1) {
return mapper.reTryJob(thingId);
}
return thingExist;
}
public List<User> getThingUsers(int thingId) {
return mapper.getThingUsers(thingId);
}
/**
* @param idNum
* @return ,01
*/
public int exists(String idNum) {
return mapper.exists(idNum);
}
/**
* @param userId id
* @return boolean:
*/
public boolean alreadyRecruit(String userId) {
int i = mapper.alreadyRecruit(userId);
return i != 0;
}
public int existsByPhone(String phone) {
return mapper.existsByPhone(phone);
}
public User getNewUser() {
return mapper.getNewUser();
}
public int addUser(User u) {
return mapper.addUser(u);
}
public int delUser(int id) {
try {
return mapper.delUser(id);
} catch (DataIntegrityViolationException e) {
// 捕获外键约束违反异常
log.error(e.getMessage());
// 返回一个错误标志
return -1;
}
}
public int updateUserName(User user) {
return mapper.updateUserName(user);
}
public int updateUserPwd(int id, String pwd) {
return mapper.updateUserPwd(id, pwd);
}
public int updateUserPwdByOld(int id, String oldPwd, String pwd) {
return mapper.updateUserPwdByOld(id, pwd, oldPwd);
}
public int updateUser2(User user) {
return mapper.updateUser2(user);
}
public int updateUser(UserInfo user) {
return mapper.updateUser(user);
}
public int updateRealName(int id, String idNum, String name) {
int exist = mapper.exists(idNum);
if (exist != 0) {
return 2;
}
return mapper.updateRealName(id, idNum, name);
}
public void delUserResumeAllData(int processedUserid) {
mapper.delUserResumeAllData(processedUserid);
}
public int addEducation(int userId, ArrayList<Education> e) {
if (e.isEmpty()) {
return 0;
}
for (Education education : e) {
education.setId(userId);
}
return mapper.addEducation(e);
}
public ArrayList<Education> getEducation(int userId) {
return mapper.getEducation(userId);
}
public int addWorkExperience(int userId, ArrayList<WorkExperience> e) {
if (e.isEmpty()) {
return 0;
}
for (WorkExperience workExperience : e) {
workExperience.setId(userId);
}
return mapper.addWorkExperience(e);
}
public ArrayList<WorkExperience> getWorkExperience(int userId) {
return mapper.getWorkExperience(userId);
}
public int addPaper(int userId, ArrayList<Paper> e) {
if (e.isEmpty()) {
return 0;
}
for (Paper paper : e) {
paper.setId(userId);
}
return mapper.addPaper(e);
}
public ArrayList<Paper> getPaper(int userId) {
return mapper.getPaper(userId);
}
public int addProject(int userId, ArrayList<Project> e) {
if (e.isEmpty()) {
return 0;
}
for (Project project : e) {
project.setId(userId);
}
return mapper.addProject(e);
}
public ArrayList<Project> getProject(int userId) {
return mapper.getProject(userId);
}
public int addResearch(int userId, ArrayList<Research> e) {
if (e.isEmpty()) {
return 0;
}
for (Research research : e) {
research.setId(userId);
}
return mapper.addResearch(e);
}
public ArrayList<Research> getResearch(int userId) {
return mapper.getResearch(userId);
}
public int addFamilyConnections(int userId, ArrayList<FamilyConnections> e) {
if (e.isEmpty()) {
return 0;
}
for (FamilyConnections familyConnections : e) {
familyConnections.setId(userId);
}
return mapper.addFamilyConnections(e);
}
/**
*
*
* @return
*/
public User getCurrentUser() {
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (principal == null) {
return null;
}
if (principal instanceof User) {
return (User) principal;
} else {
log.warn("当前用户不是 User 类型");
throw new IllegalStateException("用户状态异常:非User类型");
}
}
public ArrayList<FamilyConnections> getFamilyConnections(int userId) {
return mapper.getFamilyConnections(userId);
}
public static void writeFileToResponse(boolean isExcel,String filePath, HttpServletResponse response) throws IOException {
System.out.println(filePath);
filePath = filePath.replaceAll("\\\\", "/");
// 设置响应类型(根据实际情况调整)
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename=\""
+ filePath.substring(filePath.lastIndexOf('/') + 1) + "\"");
OutputStream outputStream = response.getOutputStream();
try (FileInputStream fileInputStream = new FileInputStream(filePath)) {
byte[] buffer;
if (isExcel) {
// 针对excel文件缓冲区大小设置为1.6kb
buffer = new byte[4096 * 4];
} else {
// 针对其他文件缓冲区大小设置为4K
buffer = new byte[4096];
}
int bytesRead;
while ((bytesRead = fileInputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
} finally {
// 刷新缓冲区
outputStream.flush();
}
}
/**
* ,,,url
* @param thingInfo
* @return ,,url
*/
public HashMap<String, Object> getThingAndResume(ThingWithUser thingInfo) {
Integer userId = thingInfo.getUserId();
String code = thingInfo.getCode();
User user = this.getOne(userId);
ArrayList<Education> education = this.getEducation(userId);
ArrayList<WorkExperience> workExperience = this.getWorkExperience(userId);
ArrayList<Paper> paper = this.getPaper(userId);
ArrayList<Project> project = this.getProject(userId);
ArrayList<Research> research = this.getResearch(userId);
ArrayList<FamilyConnections> familyConnections = this.getFamilyConnections(userId);
HashMap<String, Object> map = new HashMap<>();
for (int i = 0; i < 7; i++) {
List<String> fileUrl = FilePatch.getFileUrl(code, userId, i, isDev, false);
map.put("file" + i, fileUrl);
}
List<String> IDPhotos = FilePatch.getFileUrl(code, userId, 0, isDev, true);
String onePhoto = null;
if (IDPhotos != null && !IDPhotos.isEmpty()) {
onePhoto = IDPhotos.get(IDPhotos.size() - 1);
}
map.put("userinfo", user);
map.put("education", education);
map.put("workExperience", workExperience);
map.put("paper", paper);
map.put("project", project);
map.put("research", research);
map.put("family", familyConnections);
map.put("note", thingInfo.getNote());
map.put("qualificationResult", thingInfo.getQualificationResult());
map.put("awardsAndPunishments", thingInfo.getAwardsAndPunishments());
map.put("IDPhoto", onePhoto);
return map;
}
}

@ -0,0 +1,29 @@
package edu.ahbvc.recruit.service.api;
import edu.ahbvc.recruit.model.api.ImageCaptchaResponse;
import edu.ahbvc.recruit.model.api.SMApiResponse;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
/**
* API
* @author c215
*/
@Service
public interface ApiService {
String MOCK_CAPTCHA = "1";
/**
*
* @return
*/
ImageCaptchaResponse getImgCode();
/**
*
* @param captcha
* @param tel
* @return
*/
SMApiResponse sendSM(String captcha, String tel);
}

@ -0,0 +1,59 @@
package edu.ahbvc.recruit.service.api;
import edu.ahbvc.recruit.model.api.ImageCaptchaResponse;
import edu.ahbvc.recruit.model.api.JsonReader;
import edu.ahbvc.recruit.model.api.SMApiResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Repository;
/**
* @author c215
*/
@Profile("dev")
//上方注解表示该类在开发环境下才会被加载
@Repository
//上方注解表示该类是一个Repository, 用于数据访问
public class MockApiServiceImpl implements ApiService {
/**
* 使Log4j2 LogManagerLogger
*
*/
private static final Logger logger = LogManager.getLogger(MockApiServiceImpl.class);
/**
*
* Image verification code
* @return ,
* @see <a href="https://www.apispace.com/eolink/api/lwtpyzmsc/apiDocument"></a>
*/
@Override
public ImageCaptchaResponse getImgCode() {
JsonReader<ImageCaptchaResponse> jsonReader = new JsonReader<>();
String json = "{\"statusCode\":\"000000\",\"desc\":\"请求成功\",\"result\":{\"fileName\":\"https://data.apishop.net/checkcode/ar4wb9us16f5ezn3.png\",\"verifyCode\":\"1\"}}";
// 输出api返回的结果
logger.debug("开发模式图片验证码api返回模拟数据");
return jsonReader.processApiResponse(json, ImageCaptchaResponse.class);
}
@Override
public SMApiResponse sendSM(String captcha, String tel){
// 开发环境下直接返回
// String json = "{\"code\":\"0\",\"msg\":\"SUCCESS\",\"smUuid\":\"38801_1_0_17756800661_1_4lDRlmcSyW_1\"}";
SMApiResponse processApiResponse = new SMApiResponse();
processApiResponse.setCode("0");
processApiResponse.setMessage("SUCCESS");
processApiResponse.setSmUuid("38801_1_0_17756800661_1_4lDRlmcSyW_1");
return processApiResponse;
}
}

@ -0,0 +1,140 @@
package edu.ahbvc.recruit.service.api;
import edu.ahbvc.recruit.model.api.ImageCaptchaResponse;
import edu.ahbvc.recruit.model.api.JsonReader;
import edu.ahbvc.recruit.model.api.SMApiResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.annotation.Profile;
import org.springframework.http.*;
import org.springframework.stereotype.Repository;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
/**
* @author c215
*/
@Profile("prod")
@Repository
public class RealApiServiceImpl implements ApiService {
/**
* 使Log4j2 LogManagerLogger
*
*/
private static final Logger logger = LogManager.getLogger(RealApiServiceImpl.class);
/**
*
* Image verification code
* @return ,
* @see <a href="https://www.apispace.com/eolink/api/lwtpyzmsc/apiDocument"></a>
*/
@Override
public ImageCaptchaResponse getImgCode() {
URI url = null;
try {
url = new URI("https://eolink.o.apispace.com/lwtpyzmsc/common/verify/getComplicateVerifyImage");
} catch (URISyntaxException e) {
logger.error("图片验证码URI异常");
logger.error(e);
}
// 准备调用api的请求头
HttpHeaders headers = new HttpHeaders();
String MyKey = "p4jb13padiv8g31wdaqlva6xoeoygdnw";
headers.add("X-APISpace-Token", MyKey);
headers.add("Authorization-Type", "apikey");
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
JsonReader<ImageCaptchaResponse> jsonReader = new JsonReader<>();
// 准备调用api的请求体
MultiValueMap<String, String> requestBody = new LinkedMultiValueMap<>();
//验证码类型
// (1:纯数字,2:小写字母,3:大写字母,4:数字+小写字母,5:数字+大写字母,6:数字+大小写字母,7:大小写字母)
requestBody.add("codeType", "1");
RestTemplate restTemplate = new RestTemplate();
// 发送调用api请求
RequestEntity<MultiValueMap<String, String>> requestEntity = new RequestEntity<>(
requestBody, headers, HttpMethod.POST, url);
// 返回结果是JSON,转换成字符串
ResponseEntity<String> responseEntity = restTemplate.exchange(requestEntity, String.class);
// api返回的内容是JSON
String responseData = responseEntity.getBody();
// 输出api返回的结果
logger.debug("图片验证码api返回结果" + responseData);
ImageCaptchaResponse processApiResponse;
processApiResponse = jsonReader.processApiResponse(responseData, ImageCaptchaResponse.class);
return processApiResponse;
}
@Override
public SMApiResponse sendSM(String captcha, String tel){
URI url = null;
try {
url = new URI("http://api.1cloudsp.com/api/v2/single_send");
} catch (URISyntaxException e) {
logger.info("短信验证码URI异常");
logger.error(e);
}
// 准备调用api的请求头
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization-Type", "apikey");
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// 用户开发key
String accesskey = "nBWSTPoSwKmBbP81";
// 用户开发秘钥
String accessSecret = "Tp5u0ff4K3qpzoqDcxtHaDgcTYGphSQw";
// 准备调用api的请求体
MultiValueMap<String, String> requestBody = new LinkedMultiValueMap<>();
requestBody.add("accesskey", accesskey);
requestBody.add("secret", accessSecret);
requestBody.add("sign", "299439");
requestBody.add("templateId", "277804");
requestBody.add("mobile", tel);
requestBody.add("content", URLEncoder.encode(captcha, StandardCharsets.UTF_8));
RestTemplate restTemplate = new RestTemplate();
JsonReader<SMApiResponse> jsonReader = new JsonReader<>();
// 发送调用api请求
RequestEntity<MultiValueMap<String, String>> requestEntity = new RequestEntity<>(
requestBody, headers, HttpMethod.POST, url);
// 返回结果是JSON,转换成字符串
ResponseEntity<String> responseEntity = restTemplate.exchange(requestEntity, String.class);
// api返回的内容是JSON
String responseData = responseEntity.getBody();
// 输出api返回的结果
logger.info("短信验证码api返回结果" + responseData);
SMApiResponse processApiResponse;
processApiResponse = jsonReader.processApiResponse(responseData, SMApiResponse.class);
return processApiResponse;
}
}

@ -0,0 +1,147 @@
package edu.ahbvc.recruit.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import edu.ahbvc.recruit.model.export.Ticket;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
/**
* @author c215
*/
public class AdmissionTicketCreater {
private static final Logger logger = LogManager.getLogger(AdmissionTicketCreater.class);
/**
*
*/
public static final String templatePath
= "C:/ahbvcSystem/Recruit/template/template.docx";
/**
*
*/
public static final String outputBasePath
= "C:/ahbvcSystem/Recruit/admission_ticket";
/**
* @param data
* @return docx
*/
public static String generateUserDocument(Ticket data) {
if (data == null) {
throw new IllegalArgumentException("data cannot be null");
}
XWPFDocument document = null;
String result;
try {
// 读取模板文件
FileInputStream templateFile = new FileInputStream(templatePath);
document = new XWPFDocument(templateFile);
String ticketNum = null;
// 处理模板中的表格
for (XWPFTable table : document.getTables()) {
for (XWPFTableRow row : table.getRows()) {
for (XWPFTableCell cell : row.getTableCells()) {
String text = cell.getText();
if (!text.startsWith("{{")) {
continue;
}
List<XWPFParagraph> paragraphs = cell.getParagraphs();
XWPFParagraph paragraph = paragraphs.get(0);
List<XWPFRun> runs = paragraph.getRuns();
XWPFRun templateXwpfRun = runs.get(0);
// 保存文本对齐方式
ParagraphAlignment alignment = paragraph.getAlignment();
// 添加新段落
XWPFParagraph addParagraph = cell.addParagraph();
// 重新应用文本对齐方式
addParagraph.setAlignment(alignment);
if (data.getTicketNumber().length() == 1) {
ticketNum = data.getCode() + "000" + data.getTicketNumber();
} else if (data.getTicketNumber().length() == 2) {
ticketNum = data.getCode() + "00" + data.getTicketNumber();
} else if (data.getTicketNumber().length() == 3) {
ticketNum = data.getCode() + "0" + data.getTicketNumber();
}
if (ticketNum != null) {
text = text.replace("{{ticketNum}}", ticketNum);
}
text = text.replace("{{name}}", data.getName());
text = text.replace("{{idnum}}", data.getIdnum());
text = text.replace("{{positionid}}", data.getCode());
populateCellWithFormattedText(cell, text, templateXwpfRun, addParagraph);
}
}
}
logger.info("准考证填充完成,准备保存");
String path = outputBasePath + File.separatorChar + data.getCode() + File.separatorChar;
File folder = new File(path);
boolean success = folder.mkdir();
if (success) {
logger.info("文件夹创建成功");
} else {
if (folder.exists()) {
logger.info("文件夹已经存在");
} else {
logger.info("文件夹创建失败");
}
}
// 保存生成的文档
FileOutputStream outputFile = new FileOutputStream(
path + data.getName() + "_" + ticketNum + ".docx");
//admission_ticket\null3416212.docx (系统找不到指定的路径。)
document.write(outputFile);
result = path + data.getName() + "_" + ticketNum + ".docx";
/*
* C:\ahbvcSystem\Recruit\admission_ticket\4000189\341621200302160414.docx
* C:\ahbvcSystem\Recruit\admission_ticket\4000189\341621200302160414.docx
*/
logger.info(result + "保存成功");
outputFile.close();
} catch (IOException e) {
logger.error("生成准考证失败", e);
return null;
} finally {
if (document != null) {
try {
document.close();
} catch (IOException e) {
logger.error("关闭文档失败", e);
}
}
}
return result;
}
public static void populateCellWithFormattedText(XWPFTableCell cell, String text, XWPFRun templateXwpfRun, XWPFParagraph addParagraph) {
for (int i = 0; i < text.length(); i++) {
XWPFRun newRun = addParagraph.createRun();
newRun.setText(String.valueOf(text.charAt(i)));
newRun.setFontFamily(templateXwpfRun.getFontFamily());
Double fontSize = templateXwpfRun.getFontSizeAsDouble();
if (fontSize != null) {
newRun.setFontSize(fontSize);
}
newRun.setBold(templateXwpfRun.isBold());
}
cell.removeParagraph(0);
}
}

@ -0,0 +1,173 @@
package edu.ahbvc.recruit.util;
import edu.ahbvc.recruit.model.export.Excel;
import edu.ahbvc.recruit.model.resume.Education;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
/**
* @author c215
*/
public class ExcelExporter {
/**
* 使Log4j2 LogManagerLogger
*/
private static final Logger logger = LogManager.getLogger(ExcelExporter.class);
/**
* @param data Excel
* @param path Excel
* @return 0:,,-1:
*/
public static int exportToExcel(ArrayList<Excel> data, String path) {
if (data == null) {
logger.warn("传入数据为空");
return -1;
}
logger.info("开始生成总表");
Workbook workbook = new XSSFWorkbook();
Sheet sheet = workbook.createSheet("Data");
// 设置样式解决含有'\n'不自动换行的问题
CellStyle cellStyle = workbook.createCellStyle();
// 设置单元格样式为自动换行
cellStyle.setWrapText(true);
// Create header row
Row headerRow = sheet.createRow(0);
// Assuming first column is "No", second is "Code", etc.
String[] columnHeaders = {"序号", "岗位代码", "姓名", "性别", "出生日期", "身份证号码", "政治面貌", "民族", "毕业学校", "所学专业", "学历", "学位",
"毕业时间", "联系电话", "资格审查结果", "备注"};
for (int i = 0; i < columnHeaders.length; i++) {
Cell cell = headerRow.createCell(i);
cell.setCellValue(columnHeaders[i]);
}
// Fill data
int rowNum = 1;
for (Excel item : data) {
Row row = sheet.createRow(rowNum++);
row.createCell(0).setCellValue(rowNum - 1);
row.createCell(1).setCellValue(item.getCode());
row.createCell(2).setCellValue(item.getName());
row.createCell(3).setCellValue(item.getSex() == 1 ? "男" : "女");
row.createCell(4).setCellValue(item.getBirthday());
row.createCell(5).setCellValue(item.getIdnum());
row.createCell(6).setCellValue(item.getZzmm());
row.createCell(7).setCellValue(item.getNation());
StringBuilder school = new StringBuilder();
StringBuilder specialty = new StringBuilder();
StringBuilder education = new StringBuilder();
StringBuilder degree = new StringBuilder();
StringBuilder graduationTime = new StringBuilder();
for (int i = 0; i < item.getEducation().size(); i++) {
boolean end = i == item.getEducation().size() - 1;
Education e = item.getEducation().get(i);
String educations = switch (e.getEducation()) {
case 0 -> "专科";
case 1 -> "本科";
case 2 -> "研究生";
default -> "异常";
};
/* 将学历转换成汉字 */
String degrees = switch (e.getDegree()) {
case 0 -> "暂无";
case 1 -> "学士";
case 2 -> "硕士";
case 3 -> "博士";
default -> "异常";
};
school.append(e.getSchool());
specialty.append(e.getSpecialty());
education.append(educations);
degree.append(degrees);
graduationTime.append(e.getGraduationTime());
if (!end) {
school.append("\n");
specialty.append("\n");
education.append("\n");
degree.append("\n");
graduationTime.append("\n");
}
}
Cell schoolcell = row.createCell(8);
schoolcell.setCellStyle(cellStyle);
schoolcell.setCellValue(school.toString());
Cell specialtycell = row.createCell(9);
specialtycell.setCellStyle(cellStyle);
specialtycell.setCellValue(specialty.toString());
Cell educationcell = row.createCell(10);
educationcell.setCellStyle(cellStyle);
educationcell.setCellValue(education.toString());
Cell degreecell = row.createCell(11);
degreecell.setCellStyle(cellStyle);
degreecell.setCellValue(degree.toString());
Cell graduationTimecell = row.createCell(12);
graduationTimecell.setCellStyle(cellStyle);
graduationTimecell.setCellValue(graduationTime.toString());
row.createCell(13).setCellValue(item.getPhone());
String sta = switch (item.getStatus()) {
case -2 -> "已拒绝";
case -1 -> "拒绝待确认";
case 0 -> "未处理";
case 1 -> "同意待确认";
case 2 -> "已同意";
default -> "异常";
};
row.createCell(14).setCellValue(sta);
row.createCell(15).setCellValue(item.getNote());
}
int graduationTimeColumnIndex = 12;
// 生日列设12个字符宽
sheet.setColumnWidth(4, 12 * 256);
// 身份证号列设18个字符宽
sheet.setColumnWidth(5, 20 * 256);
// 毕业院校列设18个字符宽
sheet.setColumnWidth(8, 18 * 256);
// 专业列设18个字符宽
sheet.setColumnWidth(9, 18 * 256);
// 毕业时间列设8个字符宽
sheet.setColumnWidth(12, 8 * 256);
// 手机号列设12个字符宽
sheet.setColumnWidth(13, 12 * 256);
sheet.setColumnWidth(graduationTimeColumnIndex, 20 * 256);
logger.error("生成总表Excel成功,开始保存 ");
// Write the workbook to a file
try {
FileOutputStream outputStream = new FileOutputStream(path + "招聘总表.xlsx");
workbook.write(outputStream);
workbook.close();
} catch (IOException e) {
logger.error("保存导出的Excel发生IO错误");
return -1;
}
return 0;
}
public static int getExcelFile(String path) {
File folder = new File(path);
File[] fileList = folder.listFiles();
if (fileList == null || fileList.length == 0) {
return 0;
} else if (fileList.length > 1) {
return 2;
}
return 1;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,92 @@
package edu.ahbvc.recruit.util;
import edu.ahbvc.recruit.model.token.Token;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwtException;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.lang.reflect.Field;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class JwtUtil {
private static final Logger logger = LogManager.getLogger(JwtUtil.class);
private static final String KEY = "321ahbvc431e21y123342h1f1u32dia2323ej322133f21h11jskl23afh1djl3a1hfj21kdlahf";
public static String createJWT(Token token) {
if (token.getUserId() != null) {
Date expiration = token.getExpiration();
Map<String, Object> map = new HashMap<>();
Field[] fields = token.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
try {
map.put(field.getName(), field.get(token));
} catch (IllegalAccessException e) {
logger.error(e);
}
}
return Jwts.builder().signWith(SignatureAlgorithm.HS256, KEY)
.setExpiration(expiration).setClaims(map).compact();
}
return null;
}
public static Token parseJWT(String authorizationHeader) {
String stringToken;
// 根据具体情况定义对应的对象类型
Token token = new Token();
if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
stringToken = authorizationHeader.substring(7);
} else {
logger.warn("用户递交非法token请求头");
return null;
}
Claims claims;
try {
claims = Jwts.parser().setSigningKey(KEY).parseClaimsJws(stringToken).getBody();
} catch (JwtException e) {
// 处理其他JwtException情况例如签名不匹配等
logger.warn("用户递交无效token请求头");
return null;
}
// 判断token是否过期
Date expiration = claims.getExpiration();
Date now = new Date();
if (expiration != null && expiration.before(now)) {
// token已过期
logger.info("用户递交token请求头已经过期");
return null;
}
// 读取token对应的信息
Field[] fields = token.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
if (claims.containsKey(field.getName())) {
// 将属性值设置到对象中
try {
Object value = claims.get(field.getName());
if (value instanceof Long && (field.getType().equals(Date.class))) {
value = new Date((Long) value);
}
field.set(token, value);
} catch (IllegalArgumentException | IllegalAccessException e) {
logger.error("读取token失败");
logger.error(e);
return null;
}
}
}
return token;
}
}

@ -0,0 +1,132 @@
package edu.ahbvc.recruit.util.file;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
/**
* @author c215
*/
public class FilePatch {
public static final String SEP = File.separator;
public static final String SaveExcelFilePath = "";
public static final String SaveUserFileNodePath = "user_resume_files";
private static final Logger logger = LoggerFactory.getLogger(FilePatch.class);
public static String SaveUserFileContextPath = "C:\\ahbvcSystem\\.metadata\\.plugins\\org.eclipse.wst.server.core\\tmp1\\wtpwebapps\\Recruit\\";
public static String getSaveUserFileContextPath() {
return SaveUserFileContextPath;
}
public static void setSaveUserFileContextPath(String saveUserFileContextPath) {
SaveUserFileContextPath = saveUserFileContextPath;
}
/**
* @param code
* @param userid id
* @param part 0:,1:,2:,3:,4:,5:,6:,7:,8:,9:,10:,11:,12:,13:,14:,15:,16:,17:,18:
* @param isDev
* @param isIdNum
* @return
*/
public static List<String> getFileUrl(String code, Integer userid, int part, boolean isDev, boolean isIdNum) {
String path;
if (isIdNum) {
path = SaveUserFileContextPath + SaveUserFileNodePath + SEP + "userPhoto" + SEP + userid;
} else {
path = SaveUserFileContextPath + SaveUserFileNodePath + SEP + code + SEP + userid + SEP + part;
}
// 获取目标路径下的文件列表
File folder = new File(path);
File[] fileList = folder.listFiles();
List<String> paths = new ArrayList<>();
if (fileList != null) {
for (File fileItem : fileList) {
String absolutePath = fileItem.getAbsolutePath();
logger.info("文件列表\n" + absolutePath);
System.out.println("文件列表\n" + absolutePath);
int index = absolutePath.indexOf("user_resume");
// 相对路径(user_resume_file/1/2/3/filename.txt)
String relativePath = absolutePath.substring(index);
if (isDev) {
relativePath = "https://supposedly-credible-cougar.ngrok-free.app/Recruit/" + relativePath;
}
relativePath = relativePath.replace("\\", "/");
paths.add(relativePath.replaceAll("\\\\", "/"));
}
return paths;
}
// 目标路径文件列表为空,返回空
return null;
}
public static String setFile(String realPath, String code, Integer userid, Integer part, Boolean isIdNum,
MultipartFile file) {
if (!"".equals(realPath)) {
if ("".equals(SaveUserFileContextPath)) {
SaveUserFileContextPath = realPath;
}
}
if (file != null) {
String path = buildFilePath(userid, code, part, isIdNum);
try {
// 将文件保存到指定路径
file.transferTo(Paths.get(path, file.getOriginalFilename()));
return path;
} catch (IllegalStateException | IOException e) {
logger.error("文件保存失败", e);
return null;
}
}
return null;
}
public static String buildFilePath(Integer userid, String code, Integer part, Boolean isIdNum) {
//
//10:33:40.496 [http-nio-8092-exec-10] INFO edu.ahbvc.controller.UserController:系统上下文物理地址
//10:33:40.496 [http-nio-8092-exec-10] INFO edu.ahbvc.controller.UserController:C:\ahbvcSystem\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\Recruit\
//目录创建成功:{}C:\ahbvcSystem\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\Recruit\(Unicode 无效)user_resume_files\15\22\61\1091\img
String path;
if (isIdNum) {
path = SaveUserFileContextPath + SaveUserFileNodePath + SEP + "userPhoto" + SEP + userid;
} else {
path = SaveUserFileContextPath + SaveUserFileNodePath + SEP + code + SEP + userid + SEP + part;
}
File directory = new File(path);
if (!directory.exists() && directory.mkdirs()) {
logger.info("目录创建成功:{}", path);
System.out.println("目录创建成功:{}" + path);
} else {
logger.info("目录已存在或创建失败:{}", path);
System.out.println("目录已存在或创建失败:{}" + path);
}
return path;
}
public static void modifyLogToFile(String oldIdnum, String oldName, String idnum2, String name2) {
// 声明打印流对象
PrintStream ps = null;
// 如果现在是使用FileOuputStream实例化意味着所有的输出是向文件之中
try {
ps = new PrintStream(new FileOutputStream(SaveUserFileContextPath + "userModifyLog.txt"));
} catch (FileNotFoundException e) {
logger.error("修改记录的txt未找到");
logger.error("请在" + SaveUserFileContextPath + "下建立:userModifyLog.txt");
}
if (ps != null) {
ps.println("更改:");
ps.println(" " + oldName + "," + oldIdnum + ",到:" + name2 + "," + idnum2);
ps.close();
}
}
}

@ -0,0 +1,28 @@
package edu.ahbvc.recruit.util.file;
public class FilePathModel {
private String path = "";
public FilePathModel() {
super();
}
public FilePathModel(String path) {
super();
this.path = path;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
@Override
public String toString() {
return "FilePath [path=" + path + "]";
}
}

@ -0,0 +1,513 @@
package edu.ahbvc.recruit.util.file;
import edu.ahbvc.recruit.model.resume.*;
import edu.ahbvc.recruit.util.AdmissionTicketCreater;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.xwpf.usermodel.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @author c215
*/
public class UserQualificationsCreator {
/**
*
*/
public static final String TEMPLATE_PATH =
"C:/ahbvcSystem/Recruit/template/uiTemplate.docx";
/**
*
*/
public static final String BLANK_TEMPLATE_PATH =
"C:/ahbvcSystem/Recruit/template/uiTemplate2.docx";
/**
*
*/
public static final String OUTPUT_BASE_PATH = "C:\\ahbvcSystem\\Recruit\\UserQualifications";
private static final Logger logger = LogManager.getLogger(UserQualificationsCreator.class);
/**
* @param data
* @return docx
*/
public static String generateUserDocument(UserResume data) {
XWPFDocument document = null;
String result;
try {
// 读取模板文件
FileInputStream templateFile = new FileInputStream(TEMPLATE_PATH);
document = new XWPFDocument(templateFile);
// 遍历段落,查找并替换内容
List<XWPFParagraph> paragraphsHead = document.getParagraphs();
for (XWPFParagraph paragraph : paragraphsHead) {
// 获取段落中所有的运行对象
for (XWPFRun run : paragraph.getRuns()) {
// 获取运行对象中的文本内容
String runText = run.getText(0);
if (runText != null && runText.contains("{{code}}")) {
// 替换文本内容
runText = runText.replace("{{code}}", data.getCode());
// 清空运行对象中的文本内容
run.setText("", 0);
// 添加替换后的文本内容
run.setText(runText, 0);
}
}
}
// 处理模板中的表格
for (XWPFTable table : document.getTables()) {
int rowOffset = 0;
ArrayList<Project> projects = data.getProject();
ArrayList<Project> projects0 = new ArrayList<>();
ArrayList<Project> projects1 = new ArrayList<>();
ArrayList<Project> projects2 = new ArrayList<>();
for (Project project : projects) {
if (project.getType() == 0) {
projects0.add(project);
} else if (project.getType() == 1) {
projects1.add(project);
} else if (project.getType() == 2) {
projects2.add(project);
}
}
List<XWPFTableRow> rows = table.getRows();
for (int rowIndex = 0; rowIndex < rows.size(); rowIndex++) {
logger.info("总行数" + rows.size());
XWPFTableRow row = rows.get(rowIndex);
if (rowIndex <= 8) {
// 第九行以前的
for (XWPFTableCell cell : row.getTableCells()) {
String text = cell.getText();
if (!text.startsWith("{{")) {
continue;
}
UserInfo info = data.getInfo();
// 将模板中的占位符替换成数据源中对应的数据
text = repleteString(text, info);
if (text == null) {
text = "";
}
List<XWPFParagraph> paragraphs = cell.getParagraphs();
XWPFParagraph paragraph = paragraphs.get(0);
List<XWPFRun> runs = paragraph.getRuns();
XWPFRun templateXwpfRun = runs.get(0);
// 保存文本对齐方式
ParagraphAlignment alignment = paragraph.getAlignment();
// 添加新段落
// 重新应用文本对齐方式
XWPFParagraph addParagraph = cell.addParagraph();
addParagraph.setAlignment(alignment);
AdmissionTicketCreater.populateCellWithFormattedText(cell, text, templateXwpfRun, addParagraph);
}
// } else if (lineCount == 910) {
} else if (rowIndex == 9) {
ArrayList<Education> education = data.getEducation();
int educationSize = education.size();
List<XWPFTableCell> tableCells = row.getTableCells();
if (educationSize == 1) {
// // 替换值
loadEducationData(education.get(0), tableCells);
}
if (education.size() > 1) {
XWPFTableRow backupRow = new XWPFTableRow(row.getCtRow(), table);
for (int i = 0; i < education.size() - 1; i++) {
XWPFTableRow blankRow = new XWPFTableRow(backupRow.getCtRow(), table);
loadEducationData(education.get(i), blankRow.getTableCells());
table.addRow(blankRow, 9);
rowOffset++;
rowIndex++;
}
loadEducationData(education.get(education.size() - 1), tableCells);
}
} else if (rowIndex == 13 + rowOffset) {
// 工作经历
ArrayList<WorkExperience> workExperiences = data.getWorkExperience();
logger.info("准备装载" + workExperiences);
int workExperienceSize = workExperiences.size();
List<XWPFTableCell> tableCells = row.getTableCells();
if (workExperienceSize == 1) {
// 替换值
loadWorkExperienceData(workExperiences.get(0), tableCells);
}
if (workExperiences.size() > 1) {
XWPFTableRow backupRow = new XWPFTableRow(row.getCtRow(), table);
for (int i = 0; i < workExperiences.size() - 1; i++) {
XWPFTableRow blankRow = new XWPFTableRow(backupRow.getCtRow(), table);
loadWorkExperienceData(workExperiences.get(i), blankRow.getTableCells());
table.addRow(blankRow, 13 + rowOffset);
rowOffset++;
rowIndex++;
}
loadWorkExperienceData(workExperiences.get(workExperiences.size() - 1), tableCells);
}
} else if (rowIndex == 16 + rowOffset) {
// 论文
ArrayList<Paper> paper = data.getPaper();
logger.info("准备装载" + paper);
int paperSize = paper.size();
List<XWPFTableCell> tableCells = row.getTableCells();
if (paperSize == 1) {
loadPaperData(paper.get(0), tableCells);
}
if (paperSize > 1) {
XWPFTableRow backupRow = new XWPFTableRow(row.getCtRow(), table);
for (int i = 0; i < paper.size() - 1; i++) {
XWPFTableRow blankRow = new XWPFTableRow(backupRow.getCtRow(), table);
loadPaperData(paper.get(i), blankRow.getTableCells());
table.addRow(blankRow, rowIndex);
rowOffset++;
rowIndex++;
}
loadPaperData(paper.get(paperSize - 1), tableCells);
}
} else if (rowIndex == 19 + rowOffset) {
// 教/科研项目
logger.info("准备装载" + projects0);
int paperSize = projects0.size();
List<XWPFTableCell> tableCells = row.getTableCells();
if (paperSize == 1) {
loadProjectData(projects0.get(0), tableCells);
}
if (paperSize > 1) {
XWPFTableRow backupRow = new XWPFTableRow(row.getCtRow(), table);
for (int i = 0; i < projects0.size() - 1; i++) {
XWPFTableRow blankRow = new XWPFTableRow(backupRow.getCtRow(), table);
loadProjectData(projects0.get(i), blankRow.getTableCells());
table.addRow(blankRow, 19 + rowOffset);
rowOffset++;
rowIndex++;
}
loadProjectData(projects0.get(paperSize - 1), tableCells);
}
} else if (rowIndex == 22 + rowOffset) {
// 4.教学成果奖或教学竞赛奖励
logger.info("准备装载" + projects1);
int paperSize = projects1.size();
List<XWPFTableCell> tableCells = row.getTableCells();
if (paperSize == 1) {
loadProjectData(projects1.get(0), tableCells);
}
if (paperSize > 1) {
XWPFTableRow backupRow = new XWPFTableRow(row.getCtRow(), table);
for (int i = 0; i < projects1.size() - 1; i++) {
XWPFTableRow blankRow = new XWPFTableRow(backupRow.getCtRow(), table);
loadProjectData(projects1.get(i), blankRow.getTableCells());
table.addRow(blankRow, 22 + rowOffset);
rowOffset++;
rowIndex++;
}
loadProjectData(projects1.get(paperSize - 1), tableCells);
}
} else if (rowIndex == 25 + rowOffset) {
// 5.指导竞赛
logger.info("准备装载" + projects2);
int paperSize = projects2.size();
List<XWPFTableCell> tableCells = row.getTableCells();
if (paperSize == 1) {
loadProjectData(projects2.get(0), tableCells);
}
if (paperSize > 1) {
XWPFTableRow backupRow = new XWPFTableRow(row.getCtRow(), table);
for (int i = 0; i < projects2.size() - 1; i++) {
XWPFTableRow blankRow = new XWPFTableRow(backupRow.getCtRow(), table);
loadProjectData(projects2.get(i), blankRow.getTableCells());
table.addRow(blankRow, 25 + rowOffset);
rowOffset++;
rowIndex++;
}
loadProjectData(projects2.get(paperSize - 1), tableCells);
}
} else if (rowIndex == 28 + rowOffset) {
// 成果推广
ArrayList<Research> research = data.getResearch();
logger.info("准备装载" + research);
int paperSize = research.size();
List<XWPFTableCell> tableCells = row.getTableCells();
if (paperSize == 1) {
loadResearchData(research.get(0), tableCells);
}
if (paperSize > 1) {
XWPFTableRow backupRow = new XWPFTableRow(row.getCtRow(), table);
for (int i = 0; i < research.size() - 1; i++) {
XWPFTableRow blankRow = new XWPFTableRow(backupRow.getCtRow(), table);
loadResearchData(research.get(i), blankRow.getTableCells());
table.addRow(blankRow, 28 + rowOffset);
rowOffset++;
rowIndex++;
}
loadResearchData(research.get(paperSize - 1), tableCells);
}
} else if (rowIndex == 29 + rowOffset) {
// 奖惩
List<XWPFTableCell> tableCells = row.getTableCells();
for (XWPFTableCell tableCell : tableCells) {
if ("{{awardsAndPunishments}}".equals(tableCell.getText())) {
if (!tableCell.getParagraphs().isEmpty()) {
tableCell.removeParagraph(0);
}
tableCell.setText(data.getAwardsAndPunishments());
}
}
} else if (rowIndex == 31 + rowOffset) {
// 家庭关系
ArrayList<FamilyConnections> familyConnections = data.getFamily();
logger.info("准备装载" + familyConnections);
int paperSize = familyConnections.size();
List<XWPFTableCell> tableCells = row.getTableCells();
if (paperSize == 1) {
loadFamilyConnectionsData(familyConnections.get(0), tableCells);
}
if (paperSize > 1) {
XWPFTableRow backupRow = new XWPFTableRow(row.getCtRow(), table);
for (int i = 0; i < familyConnections.size() - 1; i++) {
XWPFTableRow blankRow = new XWPFTableRow(backupRow.getCtRow(), table);
loadFamilyConnectionsData(familyConnections.get(i), blankRow.getTableCells());
table.addRow(blankRow, 31 + rowOffset);
rowOffset++;
rowIndex++;
}
loadFamilyConnectionsData(familyConnections.get(paperSize - 1), tableCells);
}
} else if (row.getTableCells().size() == 2) {
if ("{{note}}".equals(row.getCell(1).getText())) {
row.getCell(1).removeParagraph(0);
row.getCell(1).setText(data.getNote());
}
}
}
}
String path = OUTPUT_BASE_PATH + File.separatorChar + data.getCode() + File.separatorChar;
File folder = new File(path);
boolean success = folder.mkdir();
if (success) {
logger.info("文件夹创建成功");
} else {
if (folder.exists()) {
logger.info("文件夹已经存在");
} else {
logger.info("文件夹创建失败");
}
}
String fileName = data.getInfo().getName() + "_" + data.getInfo().getIdNum();
// 保存生成的文档
FileOutputStream outputFile = new FileOutputStream(path + File.separatorChar + fileName + ".docx");
document.write(outputFile);
// admission_ticket\null3416212.docx (系统找不到指定的路径。)
result = path + fileName + ".docx";
logger.info(result + "保存成功");
outputFile.close();
} catch (IOException e) {
logger.error(e);
return null;
} finally {
if (document != null) {
try {
document.close();
} catch (IOException e) {
logger.error(e);
}
}
}
return result;
}
private static void loadEducationData(Education education, List<XWPFTableCell> tableCells) {
String ed = degreeEducated(false, education.getEducation());
String de = degreeEducated(true, education.getDegree());
for (int cellIndex = 0; cellIndex < tableCells.size(); cellIndex++) {
XWPFTableCell xwpfTableCell = tableCells.get(cellIndex);
String text = "";
switch (cellIndex) {
case 0 -> text = ed;
case 1 -> text = de;
case 2 -> text = education.getSchool();
case 3 -> text = education.getSpecialty();
case 4 -> text = education.getGraduationTime();
default -> {
}
}
if (!xwpfTableCell.getParagraphs().isEmpty()) {
xwpfTableCell.removeParagraph(0);
}
xwpfTableCell.setText(text);
}
}
private static void loadWorkExperienceData(WorkExperience experience, List<XWPFTableCell> tableCells) {
String workTime = experience.getWorkTimeStart() + "到" + experience.getWorkTimeEnd();
for (int cellIndex = 0; cellIndex < tableCells.size(); cellIndex++) {
XWPFTableCell xwpfTableCell = tableCells.get(cellIndex);
String text = "";
switch (cellIndex) {
case 0 -> text = workTime;
case 1 -> text = experience.getCompany();
case 2 -> text = experience.getPosition();
default -> {
}
}
if (!xwpfTableCell.getParagraphs().isEmpty()) {
xwpfTableCell.removeParagraph(0);
}
xwpfTableCell.setText(text);
}
}
private static void loadPaperData(Paper paper, List<XWPFTableCell> tableCells) {
for (int cellIndex = 0; cellIndex < tableCells.size(); cellIndex++) {
XWPFTableCell xwpfTableCell = tableCells.get(cellIndex);
String text = "";
switch (cellIndex) {
case 0 -> text = paper.getJournal();
case 1 -> text = paper.getTitle();
case 2 -> text = paper.getTime();
case 3 -> text = paper.getJournalNum();
default -> {
}
}
if (!xwpfTableCell.getParagraphs().isEmpty()) {
xwpfTableCell.removeParagraph(0);
}
xwpfTableCell.setText(text);
}
}
private static void loadProjectData(Project project, List<XWPFTableCell> tableCells) {
for (int cellIndex = 0; cellIndex < tableCells.size(); cellIndex++) {
XWPFTableCell xwpfTableCell = tableCells.get(cellIndex);
String text = "";
switch (cellIndex) {
case 0 -> text = project.getTime();
case 1 -> text = project.getTitle();
case 2 -> text = project.getLevel();
case 3 -> text = project.getRank();
default -> {
}
}
if (!xwpfTableCell.getParagraphs().isEmpty()) {
xwpfTableCell.removeParagraph(0);
}
xwpfTableCell.setText(text);
}
}
private static void loadResearchData(Research research, List<XWPFTableCell> tableCells) {
for (int cellIndex = 0; cellIndex < tableCells.size(); cellIndex++) {
XWPFTableCell xwpfTableCell = tableCells.get(cellIndex);
String text = "";
if (cellIndex == 0) {
text = research.getName();
}
if (!xwpfTableCell.getParagraphs().isEmpty()) {
xwpfTableCell.removeParagraph(0);
}
xwpfTableCell.setText(text);
}
}
private static void loadFamilyConnectionsData(FamilyConnections project, List<XWPFTableCell> tableCells) {
for (int cellIndex = 0; cellIndex < tableCells.size(); cellIndex++) {
XWPFTableCell xwpfTableCell = tableCells.get(cellIndex);
String text = "";
switch (cellIndex) {
case 1 -> text = project.getName();
case 2 -> text = project.getConnection();
case 3 -> text = project.getWork();
default -> {
}
}
if (!xwpfTableCell.getParagraphs().isEmpty()) {
xwpfTableCell.removeParagraph(0);
}
xwpfTableCell.setText(text);
}
}
private static String repleteString(String text, UserInfo info) {
if ("{{name}}".equals(text)) {
return info.getName();
}
if ("{{sex}}".equals(text)) {
if (info.getSex() == 1) {
return "男";
} else {
return "女";
}
}
if ("{{phone}}".equals(text)) {
return info.getPhone();
}
if ("{{birthPlace}}".equals(text)) {
return info.getBirthPlace();
}
if ("{{nation}}".equals(text)) {
return info.getNation();
}
if ("{{zzmm}}".equals(text)) {
return info.getPoliticalStatus();
}
if ("{{email}}".equals(text)) {
return info.getEmail();
}
if ("{{birthday}}".equals(text)) {
return info.getBirthday();
}
if ("{{idnum}}".equals(text)) {
return info.getIdNum();
}
if ("{{married}}".equals(text)) {
return info.getMarried();
}
if ("{{native_place}}".equals(text)) {
return info.getNativePlace();
}
if ("{{address}}".equals(text)) {
return info.getAddress();
}
if ("{{specialtiesCertificates}}".equals(text)) {
return info.getSpecialtiesCertificates();
}
return "";
}
private static String degreeEducated(Boolean isDegree, int data) {
// 填充数据
if (isDegree) {
return switch (data) {
case 0 -> "暂无";
case 1 -> "学士";
case 2 -> "硕士";
case 3 -> "博士";
default -> "异常";
};
} else {
/* 将学历转换成汉字 */
return switch (data) {
case 0 -> "专科";
case 1 -> "本科";
case 2 -> "研究生";
default -> "异常";
};
}
}
}

@ -0,0 +1,5 @@
spring.application.name=Recruit
# Development properties
server.port=8080
logging.level.root=DEBUG

@ -0,0 +1,4 @@
spring.application.name=Recruit
# Production properties
server.port=80
logging.level.root=INFO

@ -0,0 +1,11 @@
spring.application.name=Recruit
# Common properties
spring.datasource.url=jdbc:mysql://localhost:3306/ahbvcrefactor
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
mybatis.mapper-locations=classpath:mapper/*.xml
# Development specific properties
spring.profiles.active=dev

@ -0,0 +1,45 @@
/** 白屏阶段会执行的 CSS 加载动画 */
#app-loading {
position: relative;
top: 45vh;
margin: 0 auto;
color: #409eff;
font-size: 12px;
}
#app-loading,
#app-loading::before,
#app-loading::after {
width: 2em;
height: 2em;
border-radius: 50%;
animation: 2s ease-in-out infinite app-loading-animation;
}
#app-loading::before,
#app-loading::after {
content: "";
position: absolute;
}
#app-loading::before {
left: -4em;
animation-delay: -0.2s;
}
#app-loading::after {
left: 4em;
animation-delay: 0.2s;
}
@keyframes app-loading-animation {
0%,
80%,
100% {
box-shadow: 0 2em 0 -2em;
}
40% {
box-shadow: 0 2em 0 0;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

@ -0,0 +1,21 @@
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="/Recruit/favicon.ico" />
<link rel="stylesheet" href="/Recruit/app-loading.css" />
<title>招聘管理系统</title>
<script type="module" crossorigin src="/Recruit/static/index-1243327e.js"></script>
<link rel="modulepreload" crossorigin href="/Recruit/static/vue-1357a625.js">
<link rel="modulepreload" crossorigin href="/Recruit/static/element-b0a266eb.js">
<link rel="modulepreload" crossorigin href="/Recruit/static/vxe-ab33838e.js">
<link rel="stylesheet" href="/Recruit/static/index-e5828985.css">
</head>
<body>
<div id="app">
<div id="app-loading"></div>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
import{_}from"./index-1243327e.js";import{ah as e,l as n,m as c,p as d,I as l,V as t,P as o,T as p}from"./vue-1357a625.js";const u={},i={class:"error-page"},f={class:"error-page-svg"};function m(r,v){const a=e("el-button"),s=e("router-link");return n(),c("div",i,[d("div",f,[l(r.$slots,"default",{},void 0,!0)]),t(s,{to:"/"},{default:o(()=>[t(a,{type:"primary"},{default:o(()=>[p("回到首页")]),_:1})]),_:1})])}const h=_(u,[["render",m],["__scopeId","data-v-5f207ac3"]]);export{h as E};

@ -0,0 +1 @@
.error-page[data-v-5f207ac3]{height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}.error-page-svg[data-v-5f207ac3]{width:400px;margin-bottom:50px}

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 KiB

@ -0,0 +1 @@
const r=e=>{switch(e){case 0:return"无";case 1:return"学士";case 2:return"硕士";case 3:return"博士";default:return"异常"}},t=e=>{switch(e){case 0:return"专科";case 1:return"本科";case 2:return"研究生";default:return"异常"}},s=e=>{switch(e){case"无":return 0;case"学士":return 1;case"硕士":return 2;case"博士":return 3;default:return-1}},a=e=>{switch(e){case"专科":return 0;case"本科":return 1;case"研究生":return 2;default:return-1}};export{r as a,a as b,t as g,s};

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
[data-v-64233a8b] .my-label{background:var(--el-color-success-light-9)!important}[data-v-64233a8b] .my-content{background:var(--el-color-danger-light-9)}

@ -0,0 +1 @@
@charset "UTF-8";.login-container[data-v-d3e57967]{display:flex;justify-content:center;align-items:center;background-image:url(/Recruit/static/banner_1-197f4ad3.jpg);background-position:center;background-repeat:no-repeat;background-size:cover;width:100%;min-height:100%}.login-container .theme-switch[data-v-d3e57967]{position:fixed;top:5%;right:5%;cursor:pointer}.login-container .login-card[data-v-d3e57967]{width:480px;border-radius:20px;box-shadow:0 0 10px #dcdfe6;background-color:#fff;overflow:hidden}.login-container .login-card .title[data-v-d3e57967]{display:flex;justify-content:center;align-items:center;height:150px}.login-container .login-card .title img[data-v-d3e57967]{height:100%}.login-container .login-card .content[data-v-d3e57967]{padding:20px 50px 50px}.login-container .login-card .content[data-v-d3e57967] .el-input-group__append{padding:0;overflow:hidden}.login-container .login-card .content[data-v-d3e57967] .el-input-group__append .el-image{width:100px;height:40px;border-left:0px;-webkit-user-select:none;user-select:none;cursor:pointer;text-align:center}.login-container .login-card .content aaa[data-v-d3e57967]{color:#a39;text-decoration:none;margin-left:10px}.login-container .login-card .content .el-button[data-v-d3e57967]{width:100%;margin-top:10px}

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
import{i as e}from"./index-1243327e.js";function r(t){return e({url:"tableBatch",method:"post",data:t})}function n(t){return e({url:`tableBatch/${t}`,method:"delete"})}function u(t){return e({url:"tableBatch",method:"put",data:t})}function o(t){return e({url:"tableBatch/open",method:"get",params:t})}function l(t){return e({url:"tableBatches",method:"post",data:t})}function i(){return e({url:"tableBatchOption",method:"get"})}export{i as a,r as c,n as d,l as g,o as s,u};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
.el-drawer__body .el-col{text-align:center;padding:.5em .8em;outline:transparent 1px solid}.el-drawer__body .text-left-override{text-align:left}.el-drawer__body .el-row{margin-top:.3em;outline:#ccc 1px solid}.el-col{text-align:center;padding:.5em .3em;outline:transparent 1px solid}.el-upload-listc{display:flex;justify-content:space-between;align-items:center;width:60%}.custom-file-itemc{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
import{i as e}from"./index-1243327e.js";function i(t){return e({url:"tablePosition",method:"post",data:t})}function n(t){const o=Array.isArray(t)?t:[t];return e({url:"tablePositionDel",method:"post",data:o})}function r(t){return e({url:"tablePosition",method:"put",data:t})}function s(t){return e({url:"tablePositions",method:"post",data:t})}function u(){return e({url:"getPositionOption",method:"get"})}export{u as a,i as c,n as d,s as g,r as u};

@ -0,0 +1 @@
.el-drawer__body .el-col{text-align:center;padding:.5em .8em;outline:transparent 1px solid}.el-drawer__body .text-left-override{text-align:left}.el-drawer__body .el-row{margin-top:.3em;outline:#ccc 1px solid}.infinite-list{padding:0;margin:0;list-style:none}.table-wrapper li{margin-bottom:20px}li .el-card__body{padding:0}td{padding:20px}td.td-btn{cursor:pointer;transition:all .5s ease-out}td.td-btn:hover{cursor:pointer;transition:all;color:#00f;box-shadow:inset -2px -2px 5px 2px #888,inset 2px 2px 5px 2px #f4f4f4}

@ -0,0 +1 @@
import{i as r}from"./index-1243327e.js";function n(){return r({url:"userInfo",method:"get"})}function o(e){return r({url:"userInfo",method:"post",data:e})}function s(e){return r({url:"realName",method:"post",data:e})}function u(e){return r({url:"user/pwd",method:"post",data:e})}export{o as a,n as g,u as n,s};

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
import{H as k,aF as b,r as f,_ as C,ah as s,l as F,m as I,V as e,p as n,P as a,u as g,T as _,a3 as R,a9 as S,aI as q,aJ as z}from"./vue-1357a625.js";import{_ as B}from"./logo-text-2-52bab0ac.js";import{e as K,_ as M}from"./index-1243327e.js";import{q as N,t as U}from"./element-b0a266eb.js";import{_ as T}from"./index.vue_vue_type_script_setup_true_lang-3a2a2642.js";import"./vxe-ab33838e.js";const D=r=>(q("data-v-d3e57967"),r=r(),z(),r),E={class:"login-container"},H={class:"login-card"},J=D(()=>n("div",{class:"title"},[n("img",{src:B})],-1)),L={class:"content"},P=k({__name:"index",setup(r){const x=b(),m=f(null),i=f(!1),o=C({username:"",password:"",code:""}),h={username:[{required:!0,message:"请输入用户名",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"},{min:8,max:16,message:"长度在 8 到 16 个字符",trigger:"blur"}]},u=()=>{var d;(d=m.value)==null||d.validate((t,l)=>{t?(i.value=!0,K().login(o).then(()=>{x.push({path:"/"})}).catch(()=>{o.password=""}).finally(()=>{i.value=!1})):console.error("表单校验不通过",l)})};return(d,t)=>{const l=s("el-input"),c=s("el-form-item"),v=s("el-link"),w=s("el-text"),y=s("el-button"),V=s("el-form");return F(),I("div",E,[e(T,{class:"theme-switch"}),n("div",H,[J,n("div",L,[e(V,{ref_key:"loginFormRef",ref:m,model:o,rules:h,onKeyup:S(u,["enter"])},{default:a(()=>[e(c,{prop:"username"},{default:a(()=>[e(l,{modelValue:o.username,"onUpdate:modelValue":t[0]||(t[0]=p=>o.username=p),modelModifiers:{trim:!0},placeholder:"用户名",type:"text",tabindex:"1","prefix-icon":g(N),size:"large"},null,8,["modelValue","prefix-icon"])]),_:1}),e(c,{prop:"password"},{default:a(()=>[e(l,{modelValue:o.password,"onUpdate:modelValue":t[1]||(t[1]=p=>o.password=p),modelModifiers:{trim:!0},placeholder:"密码",type:"password",tabindex:"2","prefix-icon":g(U),size:"large","show-password":""},null,8,["modelValue","prefix-icon"])]),_:1}),e(w,null,{default:a(()=>[_("没有账号? "),e(v,{href:"#/register"},{default:a(()=>[_("去注册")]),_:1})]),_:1}),e(y,{loading:i.value,type:"primary",size:"large",onClick:R(u,["prevent"])},{default:a(()=>[_("登 录")]),_:1},8,["loading","onClick"])]),_:1},8,["model","onKeyup"])])])])}}});const W=M(P,[["__scopeId","data-v-d3e57967"]]);export{W as default};

@ -0,0 +1 @@
import{i as o}from"./index-1243327e.js";function i(t){return o({url:"searchPositions",method:"post",data:t})}function u(){return o({url:"batchs",method:"get"})}function s(t){return o({url:"submitA",method:"post",data:t})}function n(t){return o({url:"submitB",method:"post",data:t})}function a(t){return o({url:"submitC",method:"post",data:t})}function e(t){return o({url:"submitC",method:"put",data:t})}export{n as a,a as b,u as c,i as g,e as r,s};

@ -0,0 +1 @@
.search-wrapper[data-v-2f683bf2]{margin-bottom:20px}.search-wrapper[data-v-2f683bf2] .el-card__body{padding-bottom:2px}.toolbar-wrapper[data-v-2f683bf2]{display:flex;justify-content:space-between;margin-bottom:20px}.table-wrapper[data-v-2f683bf2]{margin-bottom:20px}.pager-wrapper[data-v-2f683bf2]{display:flex;justify-content:flex-end}

@ -0,0 +1 @@
import{H as t,aE as r,aF as a,l as o,m as s}from"./vue-1357a625.js";const _=t({__name:"index",setup(n){const e=r();return a().replace({path:"/"+e.params.path,query:e.query}),(c,p)=>(o(),s("div"))}});export{_ as default};

@ -0,0 +1 @@
.search-wrapper[data-v-00c90673]{margin-bottom:20px}.search-wrapper[data-v-00c90673] .el-card__body{padding-bottom:2px}.toolbar-wrapper[data-v-00c90673]{display:flex;justify-content:space-between;margin-bottom:20px}.table-wrapper[data-v-00c90673]{margin-bottom:20px}.pager-wrapper[data-v-00c90673]{display:flex;justify-content:flex-end}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
.search-wrapper[data-v-4d9ef9a6]{margin-bottom:20px}.search-wrapper[data-v-4d9ef9a6] .el-card__body{padding-bottom:2px}.toolbar-wrapper[data-v-4d9ef9a6]{display:flex;justify-content:space-between;margin-bottom:20px}.table-wrapper[data-v-4d9ef9a6]{margin-bottom:20px}.pager-wrapper[data-v-4d9ef9a6]{display:flex;justify-content:flex-end}

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

Loading…
Cancel
Save