init
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package com.newyetai.recruit.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.newyetai.recruit.user.dto.BrowseRecordDTO;
|
||||
import com.newyetai.recruit.user.dto.BrowseRecordPageQueryDTO;
|
||||
import com.newyetai.recruit.user.dto.BrowseRecordUserPageQueryDTO;
|
||||
import com.newyetai.recruit.user.entity.BrowseRecord;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户岗位访问记录表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Carlye
|
||||
* @since 2021-01-21
|
||||
*/
|
||||
@Validated(Default.class)
|
||||
public interface BrowseRecordService extends IService<BrowseRecord> {
|
||||
|
||||
|
||||
/**
|
||||
* 新增用户访问记录
|
||||
*
|
||||
* @param recordDTO 记录dto
|
||||
* @return {@link BrowseRecord}
|
||||
*/
|
||||
void create(BrowseRecordDTO recordDTO);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param queryDTO 查询dto
|
||||
* @return {@link List< BrowseRecordDTO >}
|
||||
*/
|
||||
List<BrowseRecordDTO> pagePosition(@Valid BrowseRecordPageQueryDTO queryDTO);
|
||||
|
||||
Integer statistics();
|
||||
|
||||
List<BrowseRecordDTO> browseRecordUserPage(BrowseRecordUserPageQueryDTO queryDTO);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.newyetai.recruit.user.service;
|
||||
|
||||
|
||||
import com.newyetai.recruit.user.dto.JobExpectDTO;
|
||||
import com.newyetai.recruit.user.dto.JobExpectOperateDTO;
|
||||
import com.newyetai.recruit.user.dto.JobExpectQueryDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 求职期望表
|
||||
*
|
||||
* @author fzp on 2022-02-23
|
||||
*/
|
||||
public interface JobExpectService {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param jobExpectOperateDTO
|
||||
* @return
|
||||
* @author fzp on 2022-02-23
|
||||
*/
|
||||
Long create(JobExpectOperateDTO jobExpectOperateDTO);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param jobExpectOperateDTO
|
||||
* @author fzp on 2022-02-23
|
||||
*/
|
||||
void modify(JobExpectOperateDTO jobExpectOperateDTO);
|
||||
|
||||
/**
|
||||
* 更新求职状态
|
||||
* @param jobExpectOperateDTO
|
||||
*/
|
||||
void modifyOnDuty(JobExpectOperateDTO jobExpectOperateDTO);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id
|
||||
* @author fzp on 2022-02-23
|
||||
*/
|
||||
void remove(Long id);
|
||||
void removeByUserId();
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param jobExpectQueryDTO
|
||||
* @return
|
||||
* @author fzp on 2022-02-23
|
||||
*/
|
||||
List<JobExpectDTO> list(JobExpectQueryDTO jobExpectQueryDTO);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param jobExpectQueryDTO
|
||||
* @return
|
||||
* @author fzp on 2022-02-23
|
||||
*/
|
||||
void page(JobExpectQueryDTO jobExpectQueryDTO);
|
||||
|
||||
/**
|
||||
* 单个查询
|
||||
*
|
||||
* @param jobExpectQueryDTO
|
||||
* @return
|
||||
* @author fzp on 2022-02-23
|
||||
*/
|
||||
JobExpectDTO find(JobExpectQueryDTO jobExpectQueryDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.newyetai.recruit.user.service;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.newyetai.recruit.user.dto.*;
|
||||
|
||||
/**
|
||||
* 简历管理
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-19
|
||||
*/
|
||||
@Validated(Default.class)
|
||||
public interface ResumeService {
|
||||
|
||||
/**
|
||||
* 简历管理 - 创建
|
||||
*
|
||||
* @param operatorDto 操作dto
|
||||
* @return {@link ResumeDTO}
|
||||
*/
|
||||
void createOrModify(ResumeOperatorDTO operatorDto);
|
||||
|
||||
/**
|
||||
* 简历管理 - 修改
|
||||
*
|
||||
* @param operatorDto 操作dto
|
||||
* @return {@link ResumeDTO}
|
||||
*/
|
||||
void modify(@Valid ResumeOperatorDTO operatorDto);
|
||||
|
||||
/**
|
||||
* 简历管理 - 删除
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link ResumeDTO}
|
||||
*/
|
||||
void delete();
|
||||
|
||||
/**
|
||||
* 简历管理 - 根据ID查询单个
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link ResumeDTO}
|
||||
*/
|
||||
ResumeDTO findById(Long id);
|
||||
|
||||
/**
|
||||
* 简历管理 - 列表查询
|
||||
*
|
||||
* @param queryDTO 列表查询dto
|
||||
* @return {@link List}<{@link ResumeDTO}>
|
||||
*/
|
||||
List<ResumeDTO> list(ResumeQueryDTO queryDTO);
|
||||
|
||||
/**
|
||||
* 简历管理 - 分页查询
|
||||
*
|
||||
* @param queryDTO 分页查询dto
|
||||
* @return {@link ResumeDTO}
|
||||
*/
|
||||
List<ResumeDTO> page(ResumePageQueryDTO queryDTO);
|
||||
|
||||
ResumeDTO userFind();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.newyetai.recruit.user.service;
|
||||
|
||||
|
||||
|
||||
import com.newyetai.recruit.user.dto.UserCertificateCreateDTO;
|
||||
import com.newyetai.recruit.user.dto.UserCertificateDTO;
|
||||
import com.newyetai.recruit.user.dto.UserCertificateModifyDTO;
|
||||
import com.newyetai.recruit.user.dto.UserCertificateQueryDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserCertificateService {
|
||||
|
||||
void create(List<UserCertificateCreateDTO> operateDTOs);
|
||||
|
||||
UserCertificateDTO modify(UserCertificateModifyDTO operateDTO);
|
||||
|
||||
UserCertificateDTO delete(Long id);
|
||||
|
||||
List<UserCertificateDTO> list(UserCertificateQueryDTO queryDTO);
|
||||
|
||||
List<UserCertificateDTO> page(UserCertificateQueryDTO queryDTO);
|
||||
|
||||
UserCertificateDTO findById(Long queryDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.newyetai.recruit.user.service;
|
||||
|
||||
import com.newyetai.recruit.position.dto.PositionDTO;
|
||||
import com.newyetai.recruit.position.dto.PositionPageQueryDTO;
|
||||
import com.newyetai.recruit.user.dto.UserCollectionCreateDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author fzp
|
||||
* @Date 2021年10月21日10:39:46
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface UserCollectionService {
|
||||
|
||||
List<PositionDTO> page(PositionPageQueryDTO queryDTO);
|
||||
|
||||
void create(UserCollectionCreateDTO dto);
|
||||
|
||||
int delete(Long id);
|
||||
|
||||
Integer statistics();
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.newyetai.recruit.user.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.newyetai.common.exception.util.Assert;
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
import com.newyetai.recruit.user.dao.BrowseRecordMapper;
|
||||
import com.newyetai.recruit.user.dto.BrowseRecordDTO;
|
||||
import com.newyetai.recruit.user.dto.BrowseRecordPageQueryDTO;
|
||||
import com.newyetai.recruit.user.dto.BrowseRecordUserPageQueryDTO;
|
||||
import com.newyetai.recruit.user.entity.BrowseRecord;
|
||||
import com.newyetai.recruit.user.service.BrowseRecordService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户岗位访问记录表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Carlye
|
||||
* @since 2021-01-21
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class BrowseRecordServiceImpl extends ServiceImpl<BrowseRecordMapper, BrowseRecord> implements BrowseRecordService {
|
||||
|
||||
@Override
|
||||
public void create(BrowseRecordDTO recordDTO) {
|
||||
BrowseRecord browseRecord = new BrowseRecord();
|
||||
browseRecord.setPositionId(recordDTO.getPositionId());
|
||||
browseRecord.setUserId(UserContextHolder.getExistLoginUserId());
|
||||
browseRecord.setCreateBy(UserContextHolder.getExistLoginUserId());
|
||||
browseRecord.setCreateTime(new Date());
|
||||
Assert.isTrue(save(browseRecord), "新增浏览记录失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BrowseRecordDTO> pagePosition(BrowseRecordPageQueryDTO queryDTO) {
|
||||
return getBaseMapper().pagePosition(queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer statistics() {
|
||||
Integer count = getBaseMapper().selectCount(new LambdaQueryWrapper<BrowseRecord>()
|
||||
.eq(BrowseRecord::getDeleted, false)
|
||||
.eq(BrowseRecord::getUserId, UserContextHolder.getExistLoginUserId())
|
||||
);
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BrowseRecordDTO> browseRecordUserPage(BrowseRecordUserPageQueryDTO queryDTO) {
|
||||
return getBaseMapper().pageUserPosition(queryDTO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.newyetai.recruit.user.service.impl;
|
||||
|
||||
|
||||
import com.newyetai.common.exception.BusinessException;
|
||||
import com.newyetai.common.exception.util.Assert;
|
||||
import com.newyetai.common.util.ListUtil;
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
import com.newyetai.recruit.user.convert.JobExpectMapMapper;
|
||||
import com.newyetai.recruit.user.dao.JobExpectMapper;
|
||||
import com.newyetai.recruit.user.dto.JobExpectDTO;
|
||||
import com.newyetai.recruit.user.dto.JobExpectOperateDTO;
|
||||
import com.newyetai.recruit.user.dto.JobExpectQueryDTO;
|
||||
import com.newyetai.recruit.user.entity.JobExpect;
|
||||
import com.newyetai.recruit.user.service.JobExpectService;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @author fzp on 2022-02-23
|
||||
*/
|
||||
@Service
|
||||
public class JobExpectServiceImpl implements JobExpectService {
|
||||
|
||||
@Autowired
|
||||
private JobExpectMapper jobExpectMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Long create(JobExpectOperateDTO jobExpectOperateDTO) {
|
||||
// List<JobExpectDTO> jobExpectDTOS = this.list(JobExpectQueryDTO.builder().userId(UserContextHolder.getLoginUserId()).build());
|
||||
// if (jobExpectDTOS.size() >= 3) {
|
||||
// throw new BusinessException("添加失败,求职期望数量最多3个");
|
||||
// }
|
||||
this.removeByUserId();
|
||||
JobExpect jobExpect = JobExpectMapMapper.INSTANCE.toEntity(jobExpectOperateDTO);
|
||||
jobExpect.setUserId(UserContextHolder.getLoginUserId());
|
||||
jobExpectMapper.saveEntity(jobExpect);
|
||||
return jobExpect.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void modify(JobExpectOperateDTO jobExpectOperateDTO) {
|
||||
JobExpect jobExpect = JobExpectMapMapper.INSTANCE.toEntity(jobExpectOperateDTO);
|
||||
jobExpect.setUserId(UserContextHolder.getLoginUserId());
|
||||
jobExpectMapper.updateEntitySelective(jobExpect);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void modifyOnDuty(JobExpectOperateDTO jobExpectOperateDTO) {
|
||||
JobExpect jobExpect = JobExpectMapMapper.INSTANCE.toEntity(jobExpectOperateDTO);
|
||||
jobExpect.setUserId(UserContextHolder.getLoginUserId());
|
||||
// 批量更新未删除的求职状态
|
||||
jobExpectMapper.updateByUserId(jobExpect);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void remove(Long id) {
|
||||
List<JobExpectDTO> list = this.list(JobExpectQueryDTO.builder().userId(UserContextHolder.getLoginUserId()).build());
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
List<JobExpectDTO> jobExpectDTOList = list.stream()
|
||||
.filter(jobExpectDTO -> jobExpectDTO.getUserId().equals(UserContextHolder.getExistLoginUserId()) &&
|
||||
jobExpectDTO.getId().equals(id)
|
||||
).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(jobExpectDTOList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
jobExpectMapper.deleteEntity(JobExpect.builder().id(id).build(), UserContextHolder.getLoginUserId());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void removeByUserId() {
|
||||
List<JobExpectDTO> list = this.list(JobExpectQueryDTO.builder().userId(UserContextHolder.getLoginUserId()).build());
|
||||
for (JobExpectDTO jobExpectDTO : list) {
|
||||
jobExpectMapper.deleteEntity(JobExpect.builder().id(jobExpectDTO.getId()).build(), UserContextHolder.getLoginUserId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JobExpectDTO> list(JobExpectQueryDTO jobExpectQueryDTO) {
|
||||
jobExpectQueryDTO.disablePage();
|
||||
return jobExpectMapper.listJobExpectDTO(jobExpectQueryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void page(JobExpectQueryDTO jobExpectQueryDTO) {
|
||||
jobExpectQueryDTO.setUserId(UserContextHolder.getLoginUserId());
|
||||
jobExpectMapper.listJobExpectDTO(jobExpectQueryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobExpectDTO find(JobExpectQueryDTO jobExpectQueryDTO) {
|
||||
List<JobExpectDTO> jobExpectDTOs = this.list(jobExpectQueryDTO);
|
||||
return jobExpectDTOs.isEmpty() ? null : ListUtil.first(jobExpectDTOs);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.newyetai.recruit.user.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.newyetai.component.file.entity.FileRecord;
|
||||
import com.newyetai.component.file.service.FileRecordService;
|
||||
import com.newyetai.recruit.user.convert.ResumeConvert;
|
||||
import com.newyetai.recruit.user.dto.*;
|
||||
import com.newyetai.recruit.user.dao.ResumeMapper;
|
||||
import com.newyetai.recruit.user.entity.Resume;
|
||||
import com.newyetai.recruit.user.service.ResumeService;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 简历管理
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ResumeServiceImpl implements ResumeService {
|
||||
|
||||
@Resource
|
||||
private ResumeMapper resumeMapper;
|
||||
|
||||
@Autowired
|
||||
private FileRecordService fileRecordService;
|
||||
|
||||
@Override
|
||||
public void createOrModify(ResumeOperatorDTO operatorDto) {
|
||||
Integer count = resumeMapper.selectCount(new LambdaQueryWrapper<Resume>()
|
||||
.eq(Resume::getUserId, UserContextHolder.getExistLoginUserId())
|
||||
.eq(Resume::getDeleted, false)
|
||||
);
|
||||
if (count == 0) {
|
||||
Resume resume = ResumeConvert.INSTANCE.convert(operatorDto);
|
||||
resume.setUserId(UserContextHolder.getExistLoginUserId());
|
||||
resumeMapper.saveEntity(resume);
|
||||
} else {
|
||||
this.modify(operatorDto);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify(ResumeOperatorDTO operatorDto) {
|
||||
Resume resume = ResumeConvert.INSTANCE.convert(operatorDto);
|
||||
resume.setUserId(UserContextHolder.getExistLoginUserId());
|
||||
resumeMapper.updateByUserId(resume);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete() {
|
||||
|
||||
Resume resume = Resume.builder().build();
|
||||
resume.setUserId(UserContextHolder.getExistLoginUserId());
|
||||
resume.setDeleted(true);
|
||||
resumeMapper.updateByUserId(resume);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResumeDTO findById(Long id) {
|
||||
Resume resume = resumeMapper.getById(id);
|
||||
if (Objects.isNull(resume)) {
|
||||
return null;
|
||||
}
|
||||
return ResumeConvert.INSTANCE.convert(resume);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResumeDTO> list(ResumeQueryDTO queryDTO) {
|
||||
return resumeMapper.list(queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResumeDTO> page(ResumePageQueryDTO queryDTO) {
|
||||
return resumeMapper.page(queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResumeDTO userFind() {
|
||||
Resume resume = resumeMapper.selectOne(new LambdaQueryWrapper<Resume>()
|
||||
.eq(Resume::getDeleted, false)
|
||||
.eq(Resume::getUserId, UserContextHolder.getExistLoginUserId())
|
||||
);
|
||||
if (Objects.isNull(resume)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ResumeDTO resumeDTO = ResumeDTO.builder().build();
|
||||
if (StringUtils.isNotBlank(resume.getFileCode())) {
|
||||
FileRecord fileRecord = fileRecordService.find(FileRecord.builder().fileCode(resume.getFileCode()).build());
|
||||
if (Objects.nonNull(fileRecord)) {
|
||||
resumeDTO.setFileName(fileRecord.getFileName());
|
||||
}
|
||||
}
|
||||
resumeDTO.setFileCode(resume.getFileCode());
|
||||
resumeDTO.setSelfEvaluation(resume.getSelfEvaluation());
|
||||
resumeDTO.setEducation(resume.getEducation());
|
||||
resumeDTO.setCityCode(resume.getCityCode());
|
||||
resumeDTO.setDataJson(resume.getDataJson());
|
||||
return resumeDTO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.newyetai.recruit.user.service.impl;
|
||||
|
||||
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
import com.newyetai.frame.redis.aop.annotation.AutoUnLock;
|
||||
import com.newyetai.recruit.user.convert.UserCertificateMapMapper;
|
||||
import com.newyetai.recruit.user.dao.UserCertificateMapper;
|
||||
import com.newyetai.recruit.user.dto.UserCertificateCreateDTO;
|
||||
import com.newyetai.recruit.user.dto.UserCertificateDTO;
|
||||
import com.newyetai.recruit.user.dto.UserCertificateModifyDTO;
|
||||
import com.newyetai.recruit.user.dto.UserCertificateQueryDTO;
|
||||
import com.newyetai.recruit.user.entity.UserCertificate;
|
||||
import com.newyetai.recruit.user.service.UserCertificateService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author fzp on 2022年6月8日09:58:44
|
||||
*/
|
||||
@Service
|
||||
public class UserCertificateServiceImpl implements UserCertificateService {
|
||||
|
||||
@Autowired
|
||||
private UserCertificateMapper userCertificateMapper;
|
||||
|
||||
@Override
|
||||
@AutoUnLock
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(List<UserCertificateCreateDTO> operateDTOs) {
|
||||
List<UserCertificate> userCertificates = UserCertificateMapMapper.INSTANCE.toEntitys(operateDTOs);
|
||||
userCertificates.forEach(userCertificate -> {
|
||||
userCertificate.setUserId(UserContextHolder.getLoginUserId());
|
||||
});
|
||||
userCertificateMapper.saveEntites(userCertificates, UserContextHolder.getExistLoginUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserCertificateDTO modify(UserCertificateModifyDTO operateDTO) {
|
||||
UserCertificate exchange = UserCertificateMapMapper.INSTANCE.toEntity(operateDTO);
|
||||
userCertificateMapper.updateEntitySelective(exchange);
|
||||
UserCertificate byId = userCertificateMapper.getById(exchange.getId());
|
||||
return UserCertificateMapMapper.INSTANCE.toDTO(byId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserCertificateDTO delete(Long id) {
|
||||
UserCertificate userCertificate = userCertificateMapper.getById(id);
|
||||
if (Objects.isNull(userCertificate)) {
|
||||
return null;
|
||||
}
|
||||
UserCertificate param = new UserCertificate();
|
||||
param.setId(id);
|
||||
userCertificateMapper.deleteEntity(param, UserContextHolder.getLoginUserId());
|
||||
return UserCertificateMapMapper.INSTANCE.toDTO(userCertificate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserCertificateDTO findById(Long id) {
|
||||
UserCertificate byId = userCertificateMapper.getById(id);
|
||||
if (Objects.isNull(byId)) {
|
||||
return null;
|
||||
}
|
||||
return UserCertificateMapMapper.INSTANCE.toDTO(byId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserCertificateDTO> page(UserCertificateQueryDTO queryDTO) {
|
||||
return userCertificateMapper.page(queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserCertificateDTO> list(UserCertificateQueryDTO queryDTO) {
|
||||
queryDTO.disablePage();
|
||||
return userCertificateMapper.page(queryDTO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.newyetai.recruit.user.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
import com.newyetai.recruit.position.dto.PositionDTO;
|
||||
import com.newyetai.recruit.position.dto.PositionPageQueryDTO;
|
||||
import com.newyetai.recruit.position.service.PositionService;
|
||||
import com.newyetai.recruit.user.dao.UserCollectionMapper;
|
||||
import com.newyetai.recruit.user.dto.UserCollectionCreateDTO;
|
||||
import com.newyetai.recruit.user.entity.UserCollection;
|
||||
import com.newyetai.recruit.user.service.UserCollectionService;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Author dylanyuan
|
||||
* @Date 2021/1/16 3:44 下午
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class UserCollectionServiceImpl implements UserCollectionService {
|
||||
|
||||
|
||||
@Resource
|
||||
private UserCollectionMapper userCollectionMapper;
|
||||
|
||||
@Resource
|
||||
private PositionService positionService;
|
||||
|
||||
@Override
|
||||
public List<PositionDTO> page(PositionPageQueryDTO queryDTO) {
|
||||
int pageNo = queryDTO.getPageNo();
|
||||
int pageSize = queryDTO.getPageSize();
|
||||
// 收藏的岗位id
|
||||
List<Long> ids = userCollectionMapper.page(UserContextHolder.getLoginUserId(), (pageNo - 1) * pageSize, pageSize);
|
||||
queryDTO.setIds(ids);
|
||||
return CollectionUtils.isEmpty(ids) ? new ArrayList<>() : positionService.userPage(queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(UserCollectionCreateDTO dto) {
|
||||
UserCollection userCollection = UserCollection.builder()
|
||||
.userId(UserContextHolder.getExistLoginUserId())
|
||||
.postId(dto.getPositionId())
|
||||
.deleted(false).build();
|
||||
|
||||
if (CollectionUtil.isEmpty(userCollectionMapper.selectList(new LambdaQueryWrapper<UserCollection>()
|
||||
.eq(UserCollection::getUserId, UserContextHolder.getExistLoginUserId())
|
||||
.eq(UserCollection::getPostId, dto.getPositionId())
|
||||
.eq(UserCollection::getDeleted, false)
|
||||
))) {
|
||||
userCollectionMapper.saveEntity(userCollection);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id) {
|
||||
|
||||
List<UserCollection> userCollection = userCollectionMapper.selectList(new LambdaQueryWrapper<UserCollection>()
|
||||
.eq(UserCollection::getUserId, UserContextHolder.getExistLoginUserId())
|
||||
.eq(UserCollection::getPostId, id)
|
||||
.eq(UserCollection::getDeleted, false));
|
||||
if (!CollectionUtil.isEmpty(userCollection)) {
|
||||
UserCollection entity = UserCollection.builder().id(userCollection.get(0).getId())
|
||||
.postId(id).build();
|
||||
return userCollectionMapper.deleteEntity(entity, UserContextHolder.getLoginUserId());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer statistics() {
|
||||
return userCollectionMapper.selectCount(new LambdaQueryWrapper<UserCollection>().eq(UserCollection::getDeleted, false).eq(UserCollection::getUserId, UserContextHolder.getExistLoginUserId()));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user