feat: Add job fair region type to models, database, and migration scripts
This commit is contained in:
@@ -136,6 +136,10 @@ public class CmsJobController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Job job)
|
||||
{
|
||||
AjaxResult companyCheck = bindRecruitingCompany(job, false);
|
||||
if (companyCheck != null) {
|
||||
return companyCheck;
|
||||
}
|
||||
// 校验描述中的敏感词
|
||||
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
||||
if (!sensitiveWords.isEmpty()) {
|
||||
@@ -156,6 +160,10 @@ public class CmsJobController extends BaseController
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Job job)
|
||||
{
|
||||
AjaxResult companyCheck = bindRecruitingCompany(job, true);
|
||||
if (companyCheck != null) {
|
||||
return companyCheck;
|
||||
}
|
||||
// 校验描述中的敏感词
|
||||
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
||||
if (!sensitiveWords.isEmpty()) {
|
||||
@@ -165,6 +173,52 @@ public class CmsJobController extends BaseController
|
||||
return toAjax(jobService.updateJob(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定岗位的招聘公司。
|
||||
*
|
||||
* <p>企业账号的招聘公司由登录账号确定,前端无需也不能指定;管理员仍须传入其选择的公司。
|
||||
* 同时同步公司名称,避免隐藏企业端表单字段后产生 company_name 为空的岗位数据。</p>
|
||||
*
|
||||
* @param job 岗位信息
|
||||
* @param editing 是否为修改岗位
|
||||
* @return 校验失败时的响应,校验通过时返回 {@code null}
|
||||
*/
|
||||
private AjaxResult bindRecruitingCompany(Job job, boolean editing)
|
||||
{
|
||||
Company company;
|
||||
if (RoleUtils.isCompanyAdmin()) {
|
||||
company = companyService.queryCodeCompany(RoleUtils.getCurrentUseridCard());
|
||||
if (company == null) {
|
||||
return AjaxResult.error("未查询到当前企业信息");
|
||||
}
|
||||
|
||||
if (editing) {
|
||||
if (job.getJobId() == null) {
|
||||
return AjaxResult.error("jobId不能为空");
|
||||
}
|
||||
Job existingJob = jobService.selectJobByJobId(job.getJobId());
|
||||
if (existingJob == null) {
|
||||
return AjaxResult.error("岗位不存在");
|
||||
}
|
||||
if (!Objects.equals(company.getCompanyId(), existingJob.getCompanyId())) {
|
||||
return AjaxResult.error("无权修改其他企业的岗位");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (job.getCompanyId() == null) {
|
||||
return AjaxResult.error("请选择招聘公司");
|
||||
}
|
||||
company = companyService.selectCompanyByCompanyId(job.getCompanyId());
|
||||
if (company == null) {
|
||||
return AjaxResult.error("招聘公司不存在");
|
||||
}
|
||||
}
|
||||
|
||||
job.setCompanyId(company.getCompanyId());
|
||||
job.setCompanyName(company.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
|
||||
@@ -31,6 +31,9 @@ public class PublicJobFair implements Serializable {
|
||||
@ApiModelProperty("招聘会类型")
|
||||
private String jobFairType;
|
||||
|
||||
@ApiModelProperty("区域类型(1-疆内 2-疆外 3-师市以内 4-师市以外)")
|
||||
private String jobFairRegionType;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("招聘会开始时间")
|
||||
private Date jobFairStartTime;
|
||||
|
||||
@@ -41,6 +41,9 @@ public class PublicJobFairDetail implements Serializable {
|
||||
@ApiModelProperty("招聘会类型 1-线上 2-线下")
|
||||
private Integer jobFairType;
|
||||
|
||||
@ApiModelProperty("区域类型(1-疆内 2-疆外 3-师市以内 4-师市以外)")
|
||||
private String jobFairRegionType;
|
||||
|
||||
@ApiModelProperty("纬度")
|
||||
private BigDecimal latitude;
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ public class PublicJobFairQuery implements Serializable {
|
||||
@ApiModelProperty("招聘会类型")
|
||||
private String jobFairType;
|
||||
|
||||
@ApiModelProperty("区域类型")
|
||||
private String jobFairRegionType;
|
||||
|
||||
@ApiModelProperty("招聘会举办时间(格式:yyyy-MM-dd)")
|
||||
private String zphjbsj;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user