新增:添加controller,mapper,model包

dev
cs 3 months ago
parent fce631eb3c
commit 082e0631ce

@ -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();
}
}
Loading…
Cancel
Save