ZpglMslcController.java 3.63 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
package cn.timer.api.controller.zpgl;

import cn.timer.api.bean.zpgl.ZpglMslcLog;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.JxglEnumInterface;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.dto.zpgl.ZpglMslcLogDto;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.transaction.Transactional;
import java.util.List;

/**
 * 招聘管理
 *
 * @author wuqingjun
 * @email 284718418@qq.com
 * @date 2022-03-08 15:14:40
 */
@Api(tags = "招聘管理")
@Transactional(rollbackOn = Exception.class)
@RestController
@RequestMapping(value = "/zpgl", produces = {"application/json"})
@Slf4j
public class ZpglMslcController {

    /**
     * 招聘-招聘中
     *
     * @param
     * @return
     */
    @GetMapping(value = "/mslc_list")
    @ApiOperation(value = "1.招聘管理面试流程记录", httpMethod = "GET", notes = "招聘管理面试流程记录")
    @ApiOperationSupport(order = 1)
    public Result<Object> mslcList(@CurrentUser UserBean userBean,
                                  @ApiParam("人才信息ID") @RequestParam(required = false) Integer zpglRcxxId,
                                  @ApiParam("状态") @RequestParam(required = false) Integer zpglRcxxStatus) {
        try {
            QueryWrapper<ZpglMslcLog> queryWrapper = new QueryWrapper<ZpglMslcLog>();
            queryWrapper.lambda().eq(ZpglMslcLog::getZpglRcxxId,zpglRcxxId);
            // 0全部类型,1状态变更,2面试,3Offer,4讨论,5其他
            // JxglEnumInterface.MslcLogStatus
            if(zpglRcxxStatus>0){
                queryWrapper.lambda().eq(ZpglMslcLog::getZpglRcxxStatus,zpglRcxxStatus);
            }
            queryWrapper.lambda().orderByDesc(ZpglMslcLog::getCreateTime);
            List<ZpglMslcLog> zpglMslcLogs = ZpglMslcLog.builder().build().selectList(queryWrapper);
            return ResultUtil.data(zpglMslcLogs, "搜索成功");

        } catch (Exception e) {
            e.printStackTrace();
            throw new CustomException("招聘-招聘列表失败");
        }

    }
    /**
     * 招聘-添加讨论
     *
     * @param
     * @return
     */
    @PostMapping(value = "/mslc/save")
    @ApiOperation(value = "2.招聘-添加讨论", httpMethod = "POST", notes = "招聘-添加讨论")
    @ApiOperationSupport(order = 2)
    public Result<Object> save(@CurrentUser UserBean userBean, @RequestBody @Validated ZpglMslcLogDto zpglMslcLogDto) {
        try {
            ZpglMslcLog zpglMslcLog = ZpglMslcLog.builder().build();
            BeanUtils.copyProperties(zpglMslcLogDto, zpglMslcLog);
            zpglMslcLog.setUserId(userBean.getEmpNum());
            zpglMslcLog.setUserName(userBean.getQyzxEmpLogin().getUsername());
            zpglMslcLog.setDetail(userBean.getQyzxEmpLogin().getUsername()+" "+zpglMslcLogDto.getDetail());
            zpglMslcLog.setZpglRcxxStatus(JxglEnumInterface.MslcLogStatus.DISCUSS.getType());
            return zpglMslcLog.insert() ? ResultUtil.data(zpglMslcLog) : ResultUtil.error();
        } catch (Exception e) {
            e.printStackTrace();
            throw new CustomException("招聘-添加讨论");
        }
    }

}