1.添加用户投诉岗位
2.管理员对企业和岗位下架
This commit is contained in:
@@ -182,4 +182,12 @@ public class AppUserController extends BaseController
|
||||
appReviewJob.setUserId(SiteSecurityUtils.getUserId());
|
||||
return toAjax(appReviewJobService.insertAppReviewJob(appReviewJob));
|
||||
}
|
||||
|
||||
@ApiOperation("求职者求职安全保障")
|
||||
@PostMapping("/editUserSafety")
|
||||
public AjaxResult editUserSafety(@RequestBody AppUser appUser)
|
||||
{
|
||||
appUser.setUserId(SiteSecurityUtils.getUserId());
|
||||
return AjaxResult.success(appUserService.editUserSafety(appUser));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,6 +142,7 @@ public class CmsJobController extends BaseController
|
||||
String errorMsg = "描述中包含敏感词:" + String.join("、", sensitiveWords);
|
||||
return AjaxResult.error(errorMsg, sensitiveWords);
|
||||
}
|
||||
job.setJobStatus("0");
|
||||
// 无敏感词,执行插入
|
||||
return toAjax(jobService.insertJob(job));
|
||||
}
|
||||
@@ -432,6 +433,7 @@ public class CmsJobController extends BaseController
|
||||
job.setCompanyId(getCompanyId(allCompany, job.getCompanyName()));
|
||||
job.setExperience("0");//经验不限
|
||||
job.setJobType("0");//疆内
|
||||
job.setJobStatus("0");//岗位上架
|
||||
String companyName=StringUtils.isNotEmpty(job.getCompanyName())?job.getCompanyName():null;
|
||||
// 联系方式转换
|
||||
List<JobContact> contactList = new ArrayList<>();
|
||||
@@ -460,6 +462,28 @@ public class CmsJobController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("岗位下架")
|
||||
@PreAuthorize("@ss.hasPermi('cms:job:jobDown')")
|
||||
@PutMapping("/jobDown/{jobId}")
|
||||
@Log(title = "岗位", businessType = BusinessType.UPDATE)
|
||||
public AjaxResult jobDown(@PathVariable("jobId") Long jobId){
|
||||
if(jobId==null){
|
||||
return error("岗位id为空");
|
||||
}
|
||||
return toAjax(jobService.jobDown(jobId));
|
||||
}
|
||||
|
||||
@ApiOperation("岗位上架")
|
||||
@PreAuthorize("@ss.hasPermi('cms:job:jobUp')")
|
||||
@PutMapping("/jobUp/{jobId}")
|
||||
@Log(title = "岗位", businessType = BusinessType.UPDATE)
|
||||
public AjaxResult jobUp(@PathVariable("jobId") Long jobId){
|
||||
if(jobId==null){
|
||||
return error("岗位id为空");
|
||||
}
|
||||
return toAjax(jobService.jobUp(jobId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param allCompany
|
||||
* @param aab004
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.AppUserJobComplaint;
|
||||
import com.ruoyi.cms.service.IAppUserJobComplaintService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cms/jobComplaint")
|
||||
public class CmsUserJobComplaintController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private IAppUserJobComplaintService appUserJobComplaintService;
|
||||
|
||||
/**
|
||||
* 投诉列表分页
|
||||
*/
|
||||
@ApiOperation("投诉列表分页")
|
||||
@PreAuthorize("@ss.hasPermi('cms:jobComplaint:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppUserJobComplaint appUserJobComplaint) {
|
||||
startPage();
|
||||
List<AppUserJobComplaint> list = appUserJobComplaintService.selectAppUserJobComplaintList(appUserJobComplaint);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@ApiOperation("详情")
|
||||
@PreAuthorize("@ss.hasPermi('cms:jobComplaint:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(appUserJobComplaintService.selectAppUserJobComplaintById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增投诉(用户端提交可单独抽接口,这里后台新增)
|
||||
*/
|
||||
@ApiOperation("新增投诉")
|
||||
@PreAuthorize("@ss.hasPermi('cms:jobComplaint:add')")
|
||||
@Log(title = "岗位投诉", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AppUserJobComplaint appUserJobComplaint) {
|
||||
return toAjax(appUserJobComplaintService.insertAppUserJobComplaint(appUserJobComplaint));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改(处理投诉、填写回复)
|
||||
*/
|
||||
@ApiOperation("修改")
|
||||
@PreAuthorize("@ss.hasPermi('cms:jobComplaint:edit')")
|
||||
@Log(title = "岗位投诉", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AppUserJobComplaint appUserJobComplaint) {
|
||||
return toAjax(appUserJobComplaintService.updateAppUserJobComplaint(appUserJobComplaint));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@ApiOperation("批量删除")
|
||||
@PreAuthorize("@ss.hasPermi('cms:jobComplaint:remove')")
|
||||
@Log(title = "岗位投诉", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(appUserJobComplaintService.deleteAppUserJobComplaintByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否已投诉该岗位
|
||||
*/
|
||||
@ApiOperation("校验是否已投诉该岗位")
|
||||
@PreAuthorize("@ss.hasPermi('cms:jobComplaint:checkComplaint')")
|
||||
@GetMapping("/checkComplaint")
|
||||
public AjaxResult checkComplaint(Long userId, Long jobId) {
|
||||
boolean has = appUserJobComplaintService.checkUserHasComplaint(userId, jobId);
|
||||
return AjaxResult.success(has);
|
||||
}
|
||||
}
|
||||
@@ -165,4 +165,27 @@ public class CompanyController extends BaseController
|
||||
List<Company> list = companyService.selectCompanyList(company);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("企业下架")
|
||||
@PreAuthorize("@ss.hasPermi('cms:company:companyDown')")
|
||||
@Log(title = "企业", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/companyDown/{companyId}")
|
||||
public AjaxResult companyDown(@PathVariable("companyId") Long companyId){
|
||||
if(companyId==null){
|
||||
return error("企业id为空");
|
||||
}
|
||||
return toAjax(companyService.companyDown(companyId));
|
||||
}
|
||||
|
||||
@ApiOperation("企业上架")
|
||||
@PreAuthorize("@ss.hasPermi('cms:company:companyUp')")
|
||||
@PutMapping("/companyUp/{companyId}")
|
||||
@Log(title = "企业", businessType = BusinessType.UPDATE)
|
||||
public AjaxResult companyUp(@PathVariable("companyId") Long companyId){
|
||||
if(companyId==null){
|
||||
return error("企业id为空");
|
||||
}
|
||||
return toAjax(companyService.companyUp(companyId));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户投诉岗位记录 shz.app_user_job_complaint
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("用户投诉岗位表")
|
||||
@TableName("app_user_job_complaint")
|
||||
public class AppUserJobComplaint extends BaseEntity {
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
@ApiModelProperty("主键ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 投诉人用户ID */
|
||||
@ApiModelProperty("投诉人用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 被投诉岗位ID */
|
||||
@ApiModelProperty("被投诉岗位ID")
|
||||
private Long jobId;
|
||||
|
||||
/** 投诉类型 1岗位虚假 2薪资不符 3信息过期 4骚扰沟通 5其他 */
|
||||
@ApiModelProperty("投诉类型 1岗位虚假 2薪资不符 3信息过期 4骚扰沟通 5其他")
|
||||
private Integer complaintType;
|
||||
|
||||
/** 投诉详情描述 */
|
||||
@ApiModelProperty("投诉详情描述")
|
||||
private String complaintContent;
|
||||
|
||||
/** 举证图片/附件地址,多图逗号分隔 */
|
||||
@ApiModelProperty("举证图片/附件地址,多图逗号分隔")
|
||||
private String evidenceUrl;
|
||||
|
||||
/** 投诉人联系电话 */
|
||||
@ApiModelProperty("投诉人联系电话")
|
||||
private String contactPhone;
|
||||
|
||||
/** 投诉状态 1待处理 2处理中 3已办结 4驳回 */
|
||||
@ApiModelProperty("投诉状态 1待处理 2处理中 3已办结 4驳回")
|
||||
private Integer complaintStatus;
|
||||
|
||||
/** 处理管理员ID */
|
||||
@ApiModelProperty("处理管理员ID")
|
||||
private Long handleUserId;
|
||||
|
||||
/** 处理回复内容 */
|
||||
@ApiModelProperty("处理回复内容")
|
||||
private String handleContent;
|
||||
|
||||
/** 处理时间 */
|
||||
@ApiModelProperty("处理时间")
|
||||
private LocalDateTime handleTime;
|
||||
}
|
||||
@@ -206,6 +206,9 @@ public class Job extends BaseEntity
|
||||
@ApiModelProperty("审核状态")
|
||||
private String reviewStatus;
|
||||
|
||||
@ApiModelProperty("状态 0上架,1下架")
|
||||
private String jobStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("户外招聘会岗位审核状态")
|
||||
private String fairReviewStatus;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.cms.domain.AppUserJobComplaint;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AppUserJobComplaintMapper extends BaseMapper<AppUserJobComplaint> {
|
||||
|
||||
/**
|
||||
* 查询投诉列表
|
||||
*/
|
||||
List<AppUserJobComplaint> selectAppUserJobComplaintList(AppUserJobComplaint appUserJobComplaint);
|
||||
|
||||
/**
|
||||
* 根据id查询单条
|
||||
*/
|
||||
AppUserJobComplaint selectAppUserJobComplaintById(Long id);
|
||||
|
||||
/**
|
||||
* 根据用户ID+岗位ID查询未删除投诉记录
|
||||
* @param userId 用户ID
|
||||
* @param jobId 岗位ID
|
||||
* @return 投诉记录
|
||||
*/
|
||||
AppUserJobComplaint selectExistComplaint(@Param("userId") Long userId, @Param("jobId") Long jobId);
|
||||
}
|
||||
@@ -31,4 +31,6 @@ public interface CompanyMapper extends BaseMapper<Company>
|
||||
List<Company> selectLikeCompanyList(Company company);
|
||||
|
||||
Company selectCompanyByJobId(Long jobId);
|
||||
|
||||
int updateStatus(Company company);
|
||||
}
|
||||
|
||||
@@ -69,4 +69,12 @@ public interface JobMapper extends BaseMapper<Job> {
|
||||
Long delRowWork();
|
||||
|
||||
List<AppUser> getRecommendByJobId(@Param("jobId") Long jobId);
|
||||
|
||||
public int updateStatus(Job job);
|
||||
|
||||
//根据企业id批量上架岗位
|
||||
public void updateBatchUpStatus(@Param("companyId") Long companyId);
|
||||
|
||||
//根据企业id批量下架架岗位
|
||||
public void updateBatchDownStatus(@Param("companyId") Long companyId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.AppUserJobComplaint;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IAppUserJobComplaintService {
|
||||
|
||||
/**
|
||||
* 查询投诉列表
|
||||
*/
|
||||
List<AppUserJobComplaint> selectAppUserJobComplaintList(AppUserJobComplaint appUserJobComplaint);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*/
|
||||
AppUserJobComplaint selectAppUserJobComplaintById(Long id);
|
||||
|
||||
/**
|
||||
* 新增投诉
|
||||
*/
|
||||
int insertAppUserJobComplaint(AppUserJobComplaint appUserJobComplaint);
|
||||
|
||||
/**
|
||||
* 修改投诉
|
||||
*/
|
||||
int updateAppUserJobComplaint(AppUserJobComplaint appUserJobComplaint);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
int deleteAppUserJobComplaintByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 校验用户是否已投诉该岗位
|
||||
* @param userId 用户ID
|
||||
* @param jobId 岗位ID
|
||||
* @return true=已投诉 false=未投诉
|
||||
*/
|
||||
boolean checkUserHasComplaint(Long userId, Long jobId);
|
||||
}
|
||||
@@ -83,4 +83,6 @@ public interface IAppUserService
|
||||
public MyChart getMyTj(Long userId);
|
||||
|
||||
public List<AppUserShow> selectUserApplyList(AppUser appUser);
|
||||
|
||||
int editUserSafety(AppUser appUser);
|
||||
}
|
||||
|
||||
@@ -81,4 +81,8 @@ public interface ICompanyService
|
||||
Company queryCodeCompany(String code);
|
||||
|
||||
List<Company> selectLikeCompanyList(Company company);
|
||||
|
||||
int companyDown(Long companyId);
|
||||
|
||||
int companyUp(Long companyId);
|
||||
}
|
||||
|
||||
@@ -72,4 +72,6 @@ public interface IESJobSearchService
|
||||
List<ESJobDocument> selectByIds(Long[] jobIds);
|
||||
|
||||
List<ESJobDocument> selectSysTextListExceptJobId(ESJobSearch esJobSearch, List<Long> jobIds, AppUser appUser);
|
||||
|
||||
void batchUpdateJob(List<Long> jobIdList);
|
||||
}
|
||||
|
||||
@@ -118,4 +118,8 @@ public interface IJobService
|
||||
List<AppUser> getRecommendByJobId(Long jobId);
|
||||
|
||||
void shzLocalUploadFile(List<Job> jobs);
|
||||
|
||||
public int jobDown(Long jobId);
|
||||
|
||||
public int jobUp(Long jobId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.AppUserJobComplaint;
|
||||
import com.ruoyi.cms.mapper.AppUserJobComplaintMapper;
|
||||
import com.ruoyi.cms.service.IAppUserJobComplaintService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AppUserJobComplaintServiceImpl extends ServiceImpl<AppUserJobComplaintMapper, AppUserJobComplaint> implements IAppUserJobComplaintService {
|
||||
|
||||
@Autowired
|
||||
private AppUserJobComplaintMapper appUserJobComplaintMapper;
|
||||
|
||||
@Override
|
||||
public List<AppUserJobComplaint> selectAppUserJobComplaintList(AppUserJobComplaint appUserJobComplaint) {
|
||||
return appUserJobComplaintMapper.selectAppUserJobComplaintList(appUserJobComplaint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUserJobComplaint selectAppUserJobComplaintById(Long id) {
|
||||
return appUserJobComplaintMapper.selectAppUserJobComplaintById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertAppUserJobComplaint(AppUserJobComplaint appUserJobComplaint) {
|
||||
Long userId = appUserJobComplaint.getUserId();
|
||||
Long jobId = appUserJobComplaint.getJobId();
|
||||
// 校验重复投诉
|
||||
if (checkUserHasComplaint(userId, jobId)) {
|
||||
throw new ServiceException("您已投诉过该岗位,请勿重复提交");
|
||||
}
|
||||
return appUserJobComplaintMapper.insert(appUserJobComplaint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateAppUserJobComplaint(AppUserJobComplaint appUserJobComplaint) {
|
||||
return appUserJobComplaintMapper.updateById(appUserJobComplaint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteAppUserJobComplaintByIds(Long[] ids) {
|
||||
return appUserJobComplaintMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户是否已经投诉该岗位
|
||||
*/
|
||||
@Override
|
||||
public boolean checkUserHasComplaint(Long userId, Long jobId) {
|
||||
if (userId == null || jobId == null) {
|
||||
return false;
|
||||
}
|
||||
AppUserJobComplaint exist = appUserJobComplaintMapper.selectExistComplaint(userId, jobId);
|
||||
return exist != null;
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,11 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.util.http.HttpClientUtils;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.domain.entity.MyChart;
|
||||
import com.ruoyi.common.core.domain.entity.File;
|
||||
import com.ruoyi.cms.domain.vo.AppSkillVo;
|
||||
@@ -15,11 +18,13 @@ import com.ruoyi.common.core.domain.entity.*;
|
||||
import com.ruoyi.cms.domain.vo.AppUserLky;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.service.IAppUserService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -47,6 +52,14 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper,AppUser> imple
|
||||
private CompanyMapper companyMapper;
|
||||
@Autowired
|
||||
private FileMapper fileMapper;
|
||||
@Autowired
|
||||
private HttpClientUtils httpClientUtils;
|
||||
|
||||
//互联网修改个人信息
|
||||
@Value("${lc_web_auth.editUserInfoUrl}")
|
||||
String WEB_UPDATE_USER_INFO;
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 查询APP用户
|
||||
@@ -632,4 +645,31 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper,AppUser> imple
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int editUserSafety(AppUser appUser) {
|
||||
appUserMapper.updateById(appUser);
|
||||
String lcUserToken=redisCache.getCacheObject(CacheConstants.LC_HLW_TOKEN+appUser.getUserId());
|
||||
if(StringUtils.isBlank(lcUserToken)){
|
||||
throw new RuntimeException("token已失效");
|
||||
}
|
||||
//修改门户个人信息
|
||||
JSONObject pJson = new JSONObject();
|
||||
if (StringUtils.isNotBlank(appUser.getEmail())) {
|
||||
pJson.put("personEmail", appUser.getEmail());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appUser.getPhone())) {
|
||||
pJson.put("personPhone", appUser.getPhone());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appUser.getPassword())) {
|
||||
pJson.put("password", appUser.getPassword());
|
||||
}
|
||||
String result=httpClientUtils.sendHttpPost(WEB_UPDATE_USER_INFO,lcUserToken,pJson.toJSONString());
|
||||
if (StringUtils.isBlank(result)) {
|
||||
throw new RuntimeException("调用门户修改用户信息接口响应为空");
|
||||
}
|
||||
JSONObject json = JSONObject.parseObject(result);
|
||||
System.out.println("门户修改个人信息返回:"+json);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.ruoyi.cms.domain.query.CompanySearch;
|
||||
import com.ruoyi.cms.domain.query.JobSearch;
|
||||
import com.ruoyi.cms.domain.query.LabelQuery;
|
||||
import com.ruoyi.cms.mapper.*;
|
||||
import com.ruoyi.cms.service.IESJobSearchService;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.common.core.domain.entity.CompanyContact;
|
||||
@@ -53,6 +54,8 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
||||
private CompanyLabelMapper companyLabelMapper;
|
||||
@Autowired
|
||||
private CompanyContactMapper companyContactMapper;
|
||||
@Autowired
|
||||
private IESJobSearchService iesJobSearchService;
|
||||
/**
|
||||
* 查询公司
|
||||
*
|
||||
@@ -338,4 +341,50 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
||||
public List<Company> selectLikeCompanyList(Company company) {
|
||||
return companyMapper.selectLikeCompanyList(company);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int companyDown(Long companyId) {
|
||||
//更新企业状态
|
||||
Company company=new Company();
|
||||
company.setCompanyId(companyId);
|
||||
company.setCompanyStatus("1");
|
||||
int i=companyMapper.updateStatus(company);
|
||||
//批量下架所有岗位
|
||||
jobMapper.updateBatchDownStatus(companyId);
|
||||
//查询企业下所有岗位
|
||||
JobSearch parJob=new JobSearch();
|
||||
parJob.setCompanyId(company.getCompanyId());
|
||||
List<Job> jobs=jobMapper.selectJobList(parJob);
|
||||
//批量刷新es
|
||||
if (jobs != null && !jobs.isEmpty()) {
|
||||
List<Long> jobIdList = jobs.stream()
|
||||
.map(Job::getJobId)
|
||||
.collect(Collectors.toList());
|
||||
iesJobSearchService.batchUpdateJob(jobIdList);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int companyUp(Long companyId) {
|
||||
//更新企业状态
|
||||
Company company=new Company();
|
||||
company.setCompanyId(companyId);
|
||||
company.setCompanyStatus("0");
|
||||
int i=companyMapper.updateStatus(company);
|
||||
//批量上架所有岗位
|
||||
jobMapper.updateBatchUpStatus(companyId);
|
||||
//查询企业下所有岗位
|
||||
JobSearch parJob=new JobSearch();
|
||||
parJob.setCompanyId(company.getCompanyId());
|
||||
List<Job> jobs=jobMapper.selectJobList(parJob);
|
||||
//批量刷新es
|
||||
if (jobs != null && !jobs.isEmpty()) {
|
||||
List<Long> jobIdList = jobs.stream()
|
||||
.map(Job::getJobId)
|
||||
.collect(Collectors.toList());
|
||||
iesJobSearchService.batchUpdateJob(jobIdList);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.cms.service.impl;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.cms.domain.vo.CompanyVo;
|
||||
import com.ruoyi.cms.mapper.AppUserBlockCompanyMapper;
|
||||
import com.ruoyi.cms.mapper.CompanyMapper;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.cms.domain.ESJobDocument;
|
||||
@@ -75,6 +76,9 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
@Autowired
|
||||
private JobTitleMapper jobTitleMapper;
|
||||
Logger logger = LoggerFactory.getLogger(JobServiceImpl.class);
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化索引及数据
|
||||
*/
|
||||
@@ -919,7 +923,7 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
|
||||
BeanUtils.copyBeanProp(esJobDocument, job);
|
||||
esJobDocument.setJobCategory(resolveJobCategoryLabel(job.getJobCategory()));
|
||||
esJobDocument.setAppJobUrl("https://www.xjksly.cn/app#/packageA/pages/post/post?jobId="+ Base64.getEncoder().encodeToString(String.valueOf(job.getJobId()).getBytes()));
|
||||
esJobDocument.setAppJobUrl("https://xjshzly.longbiosphere.com/app#/packageA/pages/post/post?jobId="+ Base64.getEncoder().encodeToString(String.valueOf(job.getJobId()).getBytes()));
|
||||
if(!StringUtil.isEmptyOrNull(job.getScale())){
|
||||
esJobDocument.setScale(Integer.valueOf(job.getScale()));
|
||||
}else {
|
||||
@@ -941,7 +945,7 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
esJobDocument.setLatAndLon(esJobDocument.getLatitude().toString() + "," + esJobDocument.getLongitude().toString());
|
||||
}
|
||||
if(StringUtil.isEmptyOrNull(job.getCompanyNature())){
|
||||
esJobDocument.setCompanyNature("6");
|
||||
esJobDocument.setCompanyNature("4");
|
||||
}
|
||||
ensureJobDocumentIndexExists();
|
||||
|
||||
@@ -1127,4 +1131,129 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
}
|
||||
return jobCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位id批量更新es
|
||||
* @param jobIdList
|
||||
*/
|
||||
@Override
|
||||
public void batchUpdateJob(List<Long> jobIdList) {
|
||||
if (jobIdList == null || jobIdList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
//索引初始化
|
||||
ensureJobDocumentIndexExists();
|
||||
//查询所有岗位数据
|
||||
List<Job> allJobList = jobMapper.selectBatchIds(jobIdList);
|
||||
if (allJobList == null || allJobList.isEmpty()) {
|
||||
LambdaEsQueryWrapper<ESJobDocument> delWrapper = new LambdaEsQueryWrapper<>();
|
||||
delWrapper.in(ESJobDocument::getJobId, jobIdList);
|
||||
esJobDocumentMapper.delete(delWrapper);
|
||||
return;
|
||||
}
|
||||
//查询所有企业数据
|
||||
List<Long> companyIdList = allJobList.stream()
|
||||
.map(Job::getCompanyId)
|
||||
.filter(id -> id != null)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<Company> companyList = new ArrayList<>();
|
||||
if (!companyIdList.isEmpty()) {
|
||||
companyList = companyMapper.selectBatchIds(companyIdList);
|
||||
}
|
||||
Map<Long, Company> companyMap = companyList.stream()
|
||||
.collect(Collectors.toMap(Company::getCompanyId, c -> c));
|
||||
|
||||
// 批量转换ES
|
||||
List<ESJobDocument> esDocList = allJobList.stream()
|
||||
.map(job -> convertToEsDoc(job, companyMap))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
try {
|
||||
// 批量删除旧索引
|
||||
LambdaEsQueryWrapper<ESJobDocument> delWrapper = new LambdaEsQueryWrapper<>();
|
||||
delWrapper.in(ESJobDocument::getJobId, jobIdList);
|
||||
esJobDocumentMapper.delete(delWrapper);
|
||||
// 批量插入新索引
|
||||
esJobDocumentMapper.insertBatch(esDocList);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("ES批量更新失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Job 转 ESJobDocument 抽取单独方法
|
||||
*/
|
||||
private ESJobDocument convertToEsDoc(Job job, Map<Long, Company> companyMap) {
|
||||
ESJobDocument esDoc = new ESJobDocument();
|
||||
BeanUtils.copyBeanProp(esDoc, job);
|
||||
// 企业编码赋值
|
||||
if (job.getCompanyId() != null) {
|
||||
Company company = companyMap.get(job.getCompanyId());
|
||||
if (company != null) {
|
||||
esDoc.setCode(company.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
esDoc.setJobCategory(resolveJobCategoryLabel(job.getJobCategory()));
|
||||
esDoc.setAppJobUrl("https://www.xjksly.cn/app#/packageA/pages/post/post?jobId="+ job.getJobId());
|
||||
esDoc.setScale(parseIntDefaultZero(job.getScale()));
|
||||
//工作经验
|
||||
if (StringUtil.isEmptyOrNull(job.getExperience())) {
|
||||
esDoc.setExperience("0");
|
||||
esDoc.setExperience_int(0);
|
||||
} else {
|
||||
Integer expInt = parseIntDefaultZero(job.getExperience());
|
||||
esDoc.setExperience_int(expInt);
|
||||
}
|
||||
|
||||
// 学历字段统一处理
|
||||
if (StringUtil.isEmptyOrNull(job.getEducation())) {
|
||||
esDoc.setEducation("-1");
|
||||
esDoc.setEducation_int(-1);
|
||||
} else {
|
||||
Integer eduInt = parseIntDefaultMinusOne(job.getEducation());
|
||||
esDoc.setEducation_int(eduInt);
|
||||
}
|
||||
|
||||
// 经纬度拼接
|
||||
if (esDoc.getLatitude() != null && esDoc.getLongitude() != null) {
|
||||
esDoc.setLatAndLon(esDoc.getLatitude() + "," + esDoc.getLongitude());
|
||||
}
|
||||
|
||||
// 企业行业默认值
|
||||
if (StringUtil.isEmptyOrNull(job.getCompanyNature())) {
|
||||
esDoc.setCompanyNature("4");
|
||||
}
|
||||
|
||||
return esDoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转数字,空/非法返回0
|
||||
*/
|
||||
private Integer parseIntDefaultZero(String str) {
|
||||
if (StringUtil.isEmptyOrNull(str)) {
|
||||
return 0;
|
||||
}
|
||||
try {
|
||||
return Integer.valueOf(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转数字,空/非法返回-1
|
||||
*/
|
||||
private Integer parseIntDefaultMinusOne(String str) {
|
||||
if (StringUtil.isEmptyOrNull(str)) {
|
||||
return -1;
|
||||
}
|
||||
try {
|
||||
return Integer.valueOf(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.dromara.easyes.core.biz.EsPageInfo;
|
||||
import org.slf4j.Logger;
|
||||
@@ -1305,4 +1304,28 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
|
||||
//刷新es
|
||||
iesJobSearchService.resetTextCache();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public int jobDown(Long jobId) {
|
||||
Job job=new Job();
|
||||
job.setJobId(jobId);
|
||||
job.setJobStatus("1");
|
||||
int i=jobMapper.updateStatus(job);
|
||||
//刷新单条数据
|
||||
iesJobSearchService.updateJob(jobId);
|
||||
return i;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public int jobUp(Long jobId) {
|
||||
Job job=new Job();
|
||||
job.setJobId(jobId);
|
||||
job.setJobStatus("0");
|
||||
//刷新单条数据
|
||||
int i=jobMapper.updateStatus(job);
|
||||
iesJobSearchService.updateJob(jobId);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.ruoyi.cms.util.http;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class HttpClientUtils {
|
||||
|
||||
/**
|
||||
* @param url
|
||||
* @param token
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public String sendHttpPost(String url,String token, String params) {
|
||||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
if (StringUtils.isNotEmpty(token)) {
|
||||
httpPost.setHeader("Authorization", "Bearer " + token);
|
||||
}
|
||||
httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
httpPost.setEntity(new StringEntity(params, "UTF-8"));
|
||||
// 响应自动关闭,无需手动close
|
||||
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
if (response.getEntity() == null) {
|
||||
return "";
|
||||
}
|
||||
String result = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
// 释放连接
|
||||
EntityUtils.consume(response.getEntity());
|
||||
return result;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("调用外部接口异常:" + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user