package net.mingsoft.tf.action; import java.util.List; import java.io.File; import java.util.ArrayList; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import cn.hutool.core.util.ObjectUtil; import java.util.*; import net.mingsoft.base.entity.ResultData; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import java.util.stream.Collectors; import org.springframework.web.bind.annotation.*; import net.mingsoft.tf.biz.IRecruitmentBiz; import net.mingsoft.tf.entity.RecruitmentEntity; import net.mingsoft.base.entity.BaseEntity; import net.mingsoft.basic.util.BasicUtil; import net.mingsoft.basic.util.StringUtil; import net.mingsoft.basic.bean.EUListBean; import net.mingsoft.basic.annotation.LogAnn; import net.mingsoft.basic.constant.e.BusinessTypeEnum; import org.apache.commons.lang3.StringUtils; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.enums.ParameterIn; /** * 人才招聘管理控制层 * @author 阿白 * 创建日期:2025年12月13日 下午1:24:22
* 历史修订:
*/ @Tag(name = "后台-人才招聘接口") @Controller("tfRecruitmentAction") @RequestMapping("/${ms.manager.path}/tf/recruitment") public class RecruitmentAction extends BaseAction{ /** * 注入人才招聘业务层 */ @Autowired private IRecruitmentBiz recruitmentBiz; /** * 返回主界面index */ @Hidden @GetMapping("/index") public String index() { return "/tf/recruitment/index"; } /** * 返回编辑界面recruitment的form */ @Hidden @GetMapping("/form") public String form() { return "/tf/recruitment/form"; } /** * 查询人才招聘列表 * @param recruitment 人才招聘实体 */ @Operation(summary = "查询人才招聘列表接口") @Parameters({ @Parameter(name = "recruitmentName", description = "岗位名称", in = ParameterIn.QUERY), @Parameter(name = "recruitmentLocation", description = "工作地点", in = ParameterIn.QUERY), @Parameter(name = "recruitmentSalary", description = "薪资范围", in = ParameterIn.QUERY), @Parameter(name = "recruitmentExper", description = "工作经验", in = ParameterIn.QUERY), @Parameter(name = "recruitmentEducation", description = "学历", in = ParameterIn.QUERY), @Parameter(name = "recruitmentTime", description = "发布时间", in = ParameterIn.QUERY), @Parameter(name = "recruitmentRequirements", description = "岗位要求", in = ParameterIn.QUERY), }) @RequestMapping(value ="/list",method = {RequestMethod.GET,RequestMethod.POST}) @ResponseBody public ResultData list(@ModelAttribute @Parameter(hidden = true) RecruitmentEntity recruitment) { BasicUtil.startPage(); List recruitmentList = null; if ( recruitment.getSqlWhere() != null){ recruitmentList = recruitmentBiz.query(recruitment); } else { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(recruitment).orderByDesc(RecruitmentEntity::getCreateDate); recruitmentList = recruitmentBiz.list(wrapper); } return ResultData.build().success(new EUListBean(recruitmentList,(int)BasicUtil.endPage(recruitmentList).getTotal())); } /** * 获取人才招聘 * @param recruitment 人才招聘实体 */ @Operation(summary = "获取人才招聘列表接口") @Parameter(name = "id", description = "主键ID", required =true,in = ParameterIn.QUERY) @GetMapping("/get") @ResponseBody public ResultData get(@ModelAttribute @Parameter(hidden = true) RecruitmentEntity recruitment) { if (StringUtils.isBlank(recruitment.getId())) { return ResultData.build().error(getResString("err.error",this.getResString("id"))); } RecruitmentEntity _recruitment = (RecruitmentEntity)recruitmentBiz.getById(recruitment.getId()); return ResultData.build().success(_recruitment); } /** * 保存人才招聘 * @param recruitment 人才招聘实体 */ @Operation(summary = "保存人才招聘列表接口") @Parameters({ @Parameter(name = "recruitmentName", description = "岗位名称", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentLocation", description = "工作地点", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentSalary", description = "薪资范围", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentExper", description = "工作经验", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentEducation", description = "学历", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentTime", description = "发布时间", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentRequirements", description = "岗位要求", required = false, in = ParameterIn.QUERY), }) @PostMapping("/save") @ResponseBody @LogAnn(title = "保存人才招聘", businessType = BusinessTypeEnum.INSERT) @RequiresPermissions("tf:recruitment:save") public ResultData save(@ModelAttribute @Parameter(hidden = true) RecruitmentEntity recruitment) { if ( StringUtils.isNotBlank(recruitment.getRecruitmentName()) && !StringUtil.checkLength(recruitment.getRecruitmentName()+"", 0, 255)) { return ResultData.build().error(getResString("err.length", this.getResString("recruitment.name"), "0", "255")); } if ( StringUtils.isNotBlank(recruitment.getRecruitmentLocation()) && !StringUtil.checkLength(recruitment.getRecruitmentLocation()+"", 0, 255)) { return ResultData.build().error(getResString("err.length", this.getResString("recruitment.location"), "0", "255")); } if ( StringUtils.isNotBlank(recruitment.getRecruitmentSalary()) && !StringUtil.checkLength(recruitment.getRecruitmentSalary()+"", 0, 255)) { return ResultData.build().error(getResString("err.length", this.getResString("recruitment.salary"), "0", "255")); } if ( StringUtils.isNotBlank(recruitment.getRecruitmentExper()) && !StringUtil.checkLength(recruitment.getRecruitmentExper()+"", 0, 255)) { return ResultData.build().error(getResString("err.length", this.getResString("recruitment.exper"), "0", "255")); } if ( StringUtils.isNotBlank(recruitment.getRecruitmentEducation()) && !StringUtil.checkLength(recruitment.getRecruitmentEducation()+"", 0, 255)) { return ResultData.build().error(getResString("err.length", this.getResString("recruitment.education"), "0", "255")); } recruitmentBiz.save(recruitment); return ResultData.build().success(recruitment); } /** * 删除人才招聘 * * @param recruitments 人才招聘实体 */ @Operation(summary = "批量删除人才招聘列表接口") @PostMapping("/delete") @ResponseBody @LogAnn(title = "删除人才招聘", businessType = BusinessTypeEnum.DELETE) @RequiresPermissions("tf:recruitment:del") public ResultData delete(@RequestBody List recruitments) { List ids = (List)recruitments.stream().map((p) -> {return p.getId();}).collect(Collectors.toList()); return this.recruitmentBiz.removeByIds(ids) ? ResultData.build().success() : ResultData.build().error(this.getResString("err.error", new String[]{this.getResString("id")})); } /** * 更新人才招聘列表 * * @param recruitment 人才招聘实体 */ @Operation(summary = "更新人才招聘列表接口") @Parameters({ @Parameter(name = "id", description = "主键ID", required =true,in = ParameterIn.QUERY), @Parameter(name = "recruitmentName", description = "岗位名称", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentLocation", description = "工作地点", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentSalary", description = "薪资范围", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentExper", description = "工作经验", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentEducation", description = "学历", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentTime", description = "发布时间", required = false, in = ParameterIn.QUERY), @Parameter(name = "recruitmentRequirements", description = "岗位要求", required = false, in = ParameterIn.QUERY), }) @PostMapping("/update") @ResponseBody @LogAnn(title = "更新人才招聘", businessType = BusinessTypeEnum.UPDATE) @RequiresPermissions("tf:recruitment:update") public ResultData update(@ModelAttribute @Parameter(hidden = true) RecruitmentEntity recruitment) { //先查询数据是否存在 RecruitmentEntity _recruitment = (RecruitmentEntity)recruitmentBiz.getById(recruitment.getId()); if(_recruitment == null) { return ResultData.build().error(getResString("err.not.exist",recruitment.getId() )); } if ( StringUtils.isNotBlank(recruitment.getRecruitmentName()) && !StringUtil.checkLength(recruitment.getRecruitmentName()+"", 0, 255)) { return ResultData.build().error(getResString("err.length", this.getResString("recruitment.name"), "0", "255")); } if ( StringUtils.isNotBlank(recruitment.getRecruitmentLocation()) && !StringUtil.checkLength(recruitment.getRecruitmentLocation()+"", 0, 255)) { return ResultData.build().error(getResString("err.length", this.getResString("recruitment.location"), "0", "255")); } if ( StringUtils.isNotBlank(recruitment.getRecruitmentSalary()) && !StringUtil.checkLength(recruitment.getRecruitmentSalary()+"", 0, 255)) { return ResultData.build().error(getResString("err.length", this.getResString("recruitment.salary"), "0", "255")); } if ( StringUtils.isNotBlank(recruitment.getRecruitmentExper()) && !StringUtil.checkLength(recruitment.getRecruitmentExper()+"", 0, 255)) { return ResultData.build().error(getResString("err.length", this.getResString("recruitment.exper"), "0", "255")); } if ( StringUtils.isNotBlank(recruitment.getRecruitmentEducation()) && !StringUtil.checkLength(recruitment.getRecruitmentEducation()+"", 0, 255)) { return ResultData.build().error(getResString("err.length", this.getResString("recruitment.education"), "0", "255")); } recruitmentBiz.updateById(recruitment); return ResultData.build().success(recruitment); } @GetMapping("verify") @ResponseBody public ResultData verify(String fieldName, String fieldValue, String id,String idName) { boolean verify = false; if (StringUtils.isBlank(id)) { verify = super.validated("RECRUITMENT",fieldName,fieldValue); } else { verify = super.validated("RECRUITMENT",fieldName,fieldValue,id,idName); } if (verify) { return ResultData.build().success(false); }else { return ResultData.build().success(true); } } }