当亲戚知道我是程序员后:
有的让我修电脑;
有的让我PS;
有的让我扯网线;
有的让我搞路由器;
这次的亲戚,让我干起了老本行:软件开发。
他是做人力资源公司的,要让我开发个招聘系统,成本是一顿饭的钱!
一,系统技术栈
系统的技术栈采用的较多:
总体的框架是SpringBoot+Vue,数据库采用的Mysql。
第一个版本的话,未加微服务相关的技术,后面的话,会开发微服务相关的版本。
- 开发语言:Java
- JDK版本:JDK1.8
- 后端技术:SpingBoot , Mybatis-Plus
- 前端技术:Vue , Vuex , Axios , echarts , element-ui , tinymce
- 数据库:mysql 5.7(一定要5.7版本)
- 数据库工具:Navicat11
- 开发软件:idea
- Maven包:Maven3.3.9
二,运行说明:
-
本系统为前后端分离开发,recruit-sys是后端,recruit-web是前端。
-
开发环境下后端用idea打开,前端用vscode或webstorm打开
-
前端运行环境需要 node 12+,需要安装yarn
前端运行步骤:
- 安装包依赖:yarn install
- 运行项目:yarn run serve
- 编译项目:yarn run build (若不需要编译忽略此步骤)
(编译后根目录会生成dist文件夹,把dist文件夹放到nginx/html目录下,启动nginx即可访问编译后程序)
- 如果选择编译后运行,后端打成jar包运行,前端使用nginx运行(nginx程序包会随源码附送)
- 访问地址:
http://localhost:8080/index
管理员用户:root
管理员密码:123456
求职者用户:zhangsan
求职者密码:1
招聘者用户:hr11
招聘者密码:1
三,系统的演示
亲戚请我吃了一顿饭,再让我继续开发!
还给我写了2页的bug问题。
四,系统的核心代码演示
给大家看下系统的核心代码演示,若想学习的,可以借鉴下
@Validated
@RestController
@RequestMapping("/recruit/admin")
@PermissionModule(value = "管理员")
public class AdminController {
@Autowired
private AdminService adminService;
@Autowired
private GroupService groupService;
@GetMapping("/permission")
@PermissionMeta(value = "查询所有可分配的权限")
public Map<String, List<PermissionDO>> getAllPermissions() {
return adminService.getAllStructuralPermissions();
}
@GetMapping("/users")
@PermissionMeta(value = "查询所有用户")
public PageResponseVO<UserInfoVO> getUsers(
@RequestParam(name = "group_id", required = false)
@Min(value = 1, message = "{group.id.positive}") Integer groupId,
@RequestParam(name = "count", required = false, defaultValue = "10")
@Min(value = 1, message = "{page.count.min}")
@Max(value = 30, message = "{page.count.max}") Integer count,
@RequestParam(name = "page", required = false, defaultValue = "0")
@Min(value = 0, message = "{page.number.min}") Integer page) {
IPage<UserDO> iPage = adminService.getUserPageByGroupId(groupId, count, page);
List<UserInfoVO> userInfos = iPage.getRecords().stream().map(user -> {
List<GroupDO> groups = groupService.getUserGroupsByUserId(user.getId());
return new UserInfoVO(user, groups);
}).collect(Collectors.toList());
return PageUtil.build(iPage, userInfos);
}
@PutMapping("/user/{id}/password")
@PermissionMeta(value = "修改用户密码")
public UpdatedVO changeUserPassword(@PathVariable @Positive(message = "{id.positive}") Integer id, @RequestBody @Validated ResetPasswordDTO validator) {
adminService.changeUserPassword(id, validator);
return new UpdatedVO(4);
}
@DeleteMapping("/user/{id}")
@PermissionMeta(value = "删除用户")
public DeletedVO deleteUser(@PathVariable @Positive(message = "{id.positive}") Integer id) {
adminService.deleteUser(id);
return new DeletedVO(5);
}
@PutMapping("/user/{id}")
@PermissionMeta(value = "管理员更新用户信息")
public UpdatedVO updateUser(@PathVariable @Positive(message = "{id.positive}") Integer id, @RequestBody @Validated UpdateUserInfoDTO validator) {
adminService.updateUserInfo(id, validator);
return new UpdatedVO(6);
}
@GetMapping("/group")
@PermissionMeta(value = "查询所有权限组及其权限")
public PageResponseVO<GroupDO> getGroups(
@RequestParam(name = "count", required = false, defaultValue = "10")
@Min(value = 1, message = "{page.count.min}")
@Max(value = 30, message = "{page.count.max}") Integer count,
@RequestParam(name = "page", required = false, defaultValue = "0")
@Min(value = 0, message = "{page.number.min}") Integer page) {
IPage<GroupDO> iPage = adminService.getGroupPage(page, count);
return PageUtil.build(iPage);
}
@GetMapping("/group/all")
@PermissionMeta(value = "查询所有权限组")
public List<GroupDO> getAllGroup() {
return adminService.getAllGroups();
}
@GetMapping("/group/{id}")
@PermissionMeta(value = "查询一个权限组及其权限")
public GroupPermissionBO getGroup(@PathVariable @Positive(message = "{id.positive}") Integer id) {
return adminService.getGroup(id);
}
@PostMapping("/group")
@PermissionMeta(value = "新建权限组")
public CreatedVO createGroup(@RequestBody @Validated NewGroupDTO validator) {
adminService.createGroup(validator);
return new CreatedVO(15);
}
@PutMapping("/group/{id}")
@PermissionMeta(value = "更新一个权限组")
public UpdatedVO updateGroup(@PathVariable @Positive(message = "{id.positive}") Integer id,
@RequestBody @Validated UpdateGroupDTO validator) {
adminService.updateGroup(id, validator);
return new UpdatedVO(7);
}
@DeleteMapping("/group/{id}")
@PermissionMeta(value = "删除一个权限组")
public DeletedVO deleteGroup(@PathVariable @Positive(message = "{id.positive}") Integer id) {
adminService.deleteGroup(id);
return new DeletedVO(8);
}
@PostMapping("/permission/dispatch")
@PermissionMeta(value = "分配单个权限")
public CreatedVO dispatchPermission(@RequestBody @Validated DispatchPermissionDTO validator) {
adminService.dispatchPermission(validator);
return new CreatedVO(9);
}
@PostMapping("/permission/dispatch/batch")
@PermissionMeta(value = "分配多个权限")
public CreatedVO dispatchPermissions(@RequestBody @Validated DispatchPermissionsDTO validator) {
adminService.dispatchPermissions(validator);
return new CreatedVO(9);
}
@PostMapping("/permission/remove")
@PermissionMeta(value = "删除多个权限")
public DeletedVO removePermissions(@RequestBody @Validated RemovePermissionsDTO validator) {
adminService.removePermissions(validator);
return new DeletedVO(10);
}
@RestController
@RequestMapping("/recruit/application")
@PermissionModule(value = "申请")
public class ApplicationController {
@Autowired
private ApplicationService applicationService;
@Autowired
private InterviewService interviewService;
/**
* 投递简历——添加申请
* @return
*/
@Logger(template = "投递简历")
@PostMapping("")
@GroupRequired
@PermissionMeta(value = "投递简历")
public CreatedVO create(@RequestBody ApplicationDO applicationDO) {
applicationService.create(applicationDO);
return new CreatedVO(7000);
}
/**
* 根据申请id修改状态state
* @param id
* @param state
* @return
*/
@Logger(template = "处理简历")
@PutMapping("/state/{id}")
@GroupRequired
@PermissionMeta(value = "申请审核")
public UpdatedVO update(@PathVariable @Positive(message = "{id.positive}") Integer id, @RequestParam Integer state) {
// 根据id查找申请
ApplicationDO applicationDO = applicationService.getById(id);
if (applicationDO == null) {
throw new NotFoundException(70000);
}
// 更新申请状态
applicationService.updateState(id, state);
// 若简历通过则插入面试表,初始状态为0,未面试
if(state==1){
InterviewDO interviewDO=new InterviewDO();
interviewDO.setResumeId(applicationDO.getResumeId());
interviewDO.setHrId(applicationDO.getHrId());
interviewDO.setUserId(applicationDO.getUserId());
interviewDO.setCompanyId(applicationDO.getCompanyId());
interviewDO.setPositionId(applicationDO.getPositionId());
interviewDO.setStatus(0);
interviewService.getBaseMapper().insert(interviewDO);
}
return new UpdatedVO(7100);
}
/**
* 根据id撤销申请(只有未处理的申请才可以撤销,即state=0的申请才可以撤销)
* @param id
* @return
*/
@Logger(template = "撤销职位申请")
@DeleteMapping("/{id}")
@GroupRequired
@PermissionMeta(value = "撤销申请")
public DeletedVO delete(@PathVariable @Positive(message = "{id.positive}") Integer id) {
// 根据id查找申请
ApplicationDO applicationDO = applicationService.getById(id);
if (applicationDO == null) {
throw new NotFoundException(70000);
}
applicationService.removeById(id);
return new DeletedVO(7200);
}
/**
* 根据用户id和职位id查询申请表,避免重复投递同个岗位
* @param positionId
* @param userId
* @return
*/
@GetMapping("")
public Boolean get(@RequestParam Integer positionId, @RequestParam Integer userId) {
QueryWrapper<ApplicationDO> wrapper = new QueryWrapper<>();
wrapper.eq("position_id", positionId).eq("user_id", userId);
ApplicationDO applicationDO = applicationService.getOne(wrapper);
if (applicationDO == null) {
return true;
}
return false;
}
/**
* 根据hr_id查询该hr接收到的所有简历,并且根据state区分申请的状态
* @param count
* @param page
* @param hrID
* @param state
* @return
*/
@Logger(template = "查看应聘简历")
@GetMapping("/page/{hrID}")
@GroupRequired
@PermissionMeta(value = "简历管理")
public PageResponseVO<ApplicationResultDO> page(
@RequestParam(name = "count", required = false, defaultValue = "10")
@Min(value = 1, message = "{page.count.min}")
@Max(value = 30, message = "{page.count.max}") Integer count,
@RequestParam(name = "page", required = false, defaultValue = "0")
@Min(value = 0, message = "{page.number.min}") Integer page,
@PathVariable(value = "hrID") @Positive(message = "{id.positive}") Integer hrID,
@RequestParam Integer state
) {
return applicationService.getByHrId(count, page, hrID, state);
}
@RestController
@RequestMapping("/api")
public class ChartController {
@Autowired
LogService logService;
@Autowired
UserService userService;
@Autowired
PositionService positionService;
@Autowired
ApplicationService applicationService;
@GetMapping("/visits")
public JSONObject getVisits() {
return logService.getVisits();
}
@GetMapping("/users")
public JSONObject getUsers() {
return userService.getUsers();
}
@GetMapping("/jobs")
public JSONObject getJobs() {
return positionService.getJobs();
}
@GetMapping("/applications")
public JSONObject getApplications() {
return applicationService.getApplications();
}
@RestController
@RequestMapping("/recruit/interview")
@PermissionModule(value = "面试")
public class InterviewController {
@Autowired
private InterviewService interviewService;
@GetMapping("/page/{hrID}")
@GroupRequired
@PermissionMeta(value = "面试管理")
public PageResponseVO<InterviewResultDO> page(
@RequestParam(name = "count", required = false, defaultValue = "10")
@Min(value = 1, message = "{page.count.min}")
@Max(value = 30, message = "{page.count.max}") Integer count,
@RequestParam(name = "page", required = false, defaultValue = "0")
@Min(value = 0, message = "{page.number.min}") Integer page,
@PathVariable(value = "hrID") @Positive(message = "{id.positive}") Integer hrID,
@RequestParam Integer state
) {
return interviewService.getByHrId(count, page, hrID);
}
@GetMapping("/page/find/{userId}")
@GroupRequired
@PermissionMeta(value = "我的面试")
public PageResponseVO<InterviewResultDO> pageByUserId(
@RequestParam(name = "count", required = false, defaultValue = "10")
@Min(value = 1, message = "{page.count.min}")
@Max(value = 30, message = "{page.count.max}") Integer count,
@RequestParam(name = "page", required = false, defaultValue = "0")
@Min(value = 0, message = "{page.number.min}") Integer page,
@PathVariable(value = "userId") @Positive(message = "{id.positive}") Integer userId,
@RequestParam Integer state
) {
return interviewService.getByUserId(count, page, userId);
}
@PostMapping("/sendInterviewNotify")
@GroupRequired
@PermissionMeta(value = "面试管理")
public UpdatedVO sendInterviewNotify(@RequestBody InterviewDO interviewDO){
QueryWrapper<InterviewDO> wrapper = new QueryWrapper<>();
wrapper.eq("id", interviewDO.getId());
InterviewDO result = interviewService.getOne(wrapper);
if (result == null) {
throw new NotFoundException(41000);
}
result.setStatus(1);
result.setAddress(interviewDO.getAddress());
result.setMemo(interviewDO.getMemo());
result.setTime(interviewDO.getTime());
interviewService.updateById(result);
return new UpdatedVO(4100);
}
@PostMapping("/updateInterviewResult")
@GroupRequired
@PermissionMeta(value = "面试管理")
public UpdatedVO updateInterviewResult(@RequestBody InterviewDO interviewDO){
QueryWrapper<InterviewDO> wrapper = new QueryWrapper<>();
wrapper.eq("id", interviewDO.getId());
InterviewDO result = interviewService.getOne(wrapper);
if (result == null) {
throw new NotFoundException(41000);
}
result.setStatus(interviewDO.getStatus());
result.setComments(interviewDO.getComments());
interviewService.updateById(result);
return new UpdatedVO(4100);
}
我是程序员小孟,如果觉得系统不错,欢迎点赞关注。点赞、转发多的话,我会把系统给大家开源!
点击下面可以联系我。