|
@@ -1,12 +1,19 @@
|
|
|
package com.ruoyi.web.work.service.impl;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import com.ruoyi.web.work.mapper.ResumeDeliverMapper;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.exception.ServiceException;
|
|
|
+import com.ruoyi.web.work.api.util.AppUtil;
|
|
|
+import com.ruoyi.web.work.domain.Position;
|
|
|
import com.ruoyi.web.work.domain.ResumeDeliver;
|
|
|
+import com.ruoyi.web.work.domain.dto.ResumeDeliverDto;
|
|
|
+import com.ruoyi.web.work.mapper.ResumeDeliverMapper;
|
|
|
+import com.ruoyi.web.work.service.IPositionService;
|
|
|
import com.ruoyi.web.work.service.IResumeDeliverService;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @author lsw
|
|
@@ -17,8 +24,66 @@ public class ResumeDeliverServiceImpl extends ServiceImpl<ResumeDeliverMapper, R
|
|
|
@Autowired
|
|
|
private ResumeDeliverMapper resumeDeliverMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IPositionService positionService;
|
|
|
+
|
|
|
@Override
|
|
|
public List<ResumeDeliver> selectList(ResumeDeliver resumeDeliver) {
|
|
|
return resumeDeliverMapper.selectList(resumeDeliver);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult send(Long id) {
|
|
|
+ Position position = positionService.getById(id);
|
|
|
+ if (position == null || position.getState() != 0 || position.getAudit() != 1) {
|
|
|
+ return AjaxResult.error("该职位不存在或已下架");
|
|
|
+ }
|
|
|
+ ResumeDeliver resumeDeliver = new ResumeDeliver();
|
|
|
+ resumeDeliver.setUserId(AppUtil.getUser().getId());
|
|
|
+ resumeDeliver.setPositionId(position.getId());
|
|
|
+ resumeDeliver.setEnterpriseId(position.getUserId());
|
|
|
+ if (!save(resumeDeliver)) {
|
|
|
+ throw new ServiceException("投递简历失败");
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult agree(ResumeDeliverDto dto) {
|
|
|
+ ResumeDeliver resumeDeliver = getById(dto.getId());
|
|
|
+ if (resumeDeliver == null || !resumeDeliver.getUserId().equals(AppUtil.getUser().getId())) {
|
|
|
+ return AjaxResult.error("面试不存在或非法操作");
|
|
|
+ }
|
|
|
+ resumeDeliver.setIsAccept(dto.getIsAccept());
|
|
|
+ if (!updateById(resumeDeliver)) {
|
|
|
+ throw new ServiceException("接受或拒绝面试邀请失败");
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult invite(Long id) {
|
|
|
+ ResumeDeliver resumeDeliver = getById(id);
|
|
|
+ if (resumeDeliver == null || !resumeDeliver.getEnterpriseId().equals(AppUtil.getUser().getId())) {
|
|
|
+ return AjaxResult.error("简历不存在或非法操作");
|
|
|
+ }
|
|
|
+ resumeDeliver.setState(1);
|
|
|
+ if (!updateById(resumeDeliver)) {
|
|
|
+ throw new ServiceException("发生面试邀请失败");
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult detail(Long id) {
|
|
|
+ ResumeDeliver resumeDeliver = getById(id);
|
|
|
+ if (resumeDeliver == null || !resumeDeliver.getEnterpriseId().equals(AppUtil.getUser().getId())) {
|
|
|
+ return AjaxResult.error("简历不存在或非法操作");
|
|
|
+ }
|
|
|
+ if (resumeDeliver.getIsRead() == 0) {
|
|
|
+ resumeDeliver.setIsRead(1);
|
|
|
+ updateById(resumeDeliver);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(resumeDeliver);
|
|
|
+ }
|
|
|
}
|