ZpglRcxxMaterialController.java 3.65 KB
Newer Older
翁国栋 committed
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 93
package cn.timer.api.controller.zpgl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zpgl.ZpglMslcLog;
import cn.timer.api.bean.zpgl.ZpglRcxx;
import cn.timer.api.bean.zpgl.ZpglRcxxMaterial;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dao.zpgl.ZpglRcxxMaterialMapper;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.transaction.Transactional;


/**
 * 入职申请材料附件
 *
 * @author wgd
 * @email 862422848@qq.com
 * @date 2022-05-12 18:00:06
 */
@Api(tags = "招聘管理")
@Transactional(rollbackOn = Exception.class)
@RestController
@RequestMapping("/zpgl/rzcl")
public class ZpglRcxxMaterialController {
    @Autowired
    private ZpglRcxxMaterialMapper zpglRcxxMaterialMapper;

    @PostMapping("/subrz")
    @ApiOperation(value = "提交入职材料", httpMethod = "GET", notes = "查询面试申请信息")
    @Log(title = "interviewApplicationIofo", businessType = BusinessType.INSERT_UPDATE)
    public Result<Object> subrz(@CurrentUser UserBean userBean,
                                @RequestBody ZpglRcxxMaterial zpglRcxxMaterial) {

        if (zpglRcxxMaterial.getZpglRcxxId() <= 0 || zpglRcxxMaterial.getZpglRcxxId() == null) {
            return ResultUtil.error("人才不存在");
        }
        if (zpglRcxxMaterial.getDataList().size() <= 0) {
            return ResultUtil.error("文件不存在");
        }
        ZpglRcxx zpglRcxx = ZpglRcxx.builder().id(zpglRcxxMaterial.getZpglRcxxId()).build().selectById();
        if (zpglRcxx == null) {
            return ResultUtil.error("人才不存在");
        }
        zpglRcxxMaterial.getDataList().stream().forEach(v->{
            ZpglRcxxMaterial data  = new ZpglRcxxMaterial();
            data.setOrgCode(userBean.getOrgCode());
            data.setCreateTime(new Date());
            data.setZpglRcxxId(zpglRcxxMaterial.getZpglRcxxId());
            data.setType(Integer.parseInt(v.get("type")));
            data.setUrl(v.get("url").toString());
            data.insert();
        });
        return ResultUtil.data("提交成功");
    }

    @GetMapping("/materialList")
    @ApiOperation(value = "入职材料列表", httpMethod = "GET", notes = "查询面试申请信息")
    @Log(title = "interviewApplicationIofo", businessType = BusinessType.INSERT_UPDATE)
    public Result<Object> materialList(@CurrentUser UserBean userBean,Integer empNum) {

        YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
                .lambda().eq(YgglMainEmp::getOrgCode,userBean.getOrgCode())
        .eq(YgglMainEmp::getEmpNum,empNum));
        if(ygglMainEmp==null){
            return ResultUtil.error("用户不存在");
        }
        List<ZpglRcxxMaterial> list = ZpglRcxxMaterial.builder().build().selectList(new QueryWrapper<ZpglRcxxMaterial>().lambda()
        .eq(ZpglRcxxMaterial::getNumId,empNum));
        if(list.size()<=0){
            return ResultUtil.error("当前用户没有材料");
        }
        return ResultUtil.data(list);
    }

}