ZpglH5Controller.java 7.51 KB
Newer Older
1 2 3 4
package cn.timer.api.controller.zpgl;

import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType;
5
import cn.timer.api.bean.qyzx.QyzxEntInfoM;
6
import cn.timer.api.bean.zpgl.*;
284718418@qq.com committed
7 8
import cn.timer.api.config.enuminterface.JxglEnumInterface;
import cn.timer.api.controller.zpgl.sevice.ZpglMslcLogService;
9
import cn.timer.api.dto.zpgl.InterviewApplicationDto;
284718418@qq.com committed
10
import cn.timer.api.utils.DateFormatUtils;
11 12
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
284718418@qq.com committed
13
import cn.timer.api.utils.ZpglMessageTemplate;
14 15 16 17 18
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
284718418@qq.com committed
19
import org.springframework.beans.factory.annotation.Autowired;
284718418@qq.com committed
20
import org.springframework.util.StringUtils;
21 22 23 24
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.transaction.Transactional;
25
import java.util.ArrayList;
284718418@qq.com committed
26
import java.util.Date;
27 28 29 30 31 32 33 34
import java.util.List;

@Api(tags = "招聘管理")
@Transactional(rollbackOn = Exception.class)
@RestController
@RequestMapping(value = "/zpgl/h5")
public class ZpglH5Controller {

284718418@qq.com committed
35 36 37 38 39


    @Autowired
    private ZpglMslcLogService zpglMslcLogService;

40 41 42 43 44 45 46 47
    /**
     * 添加面试申请
     * @param
     * @return
     */
    @RequestMapping("/add_interview_application")
    @ApiOperation(value = "添加面试申请", httpMethod = "POST", notes = "添加面试申请")
    @Log(title = "addInterviewApplication", businessType = BusinessType.INSERT_UPDATE)
龙于生 committed
48
    public Result<Object> addInterviewApplication(@Validated @RequestBody InterviewApplicationDto dto) {
49

龙于生 committed
50
        System.out.println(dto);
51 52
        ZpglRcxx zpglRcxx = new ZpglRcxx();
        //复制到 ZpglRcxx 实体对象
龙于生 committed
53
        BeanUtils.copyProperties(dto,zpglRcxx);
54 55 56 57 58
        /**
         * 新增需要添加
         * 是否初始化面试流程记录
         */
        boolean insertZpglMslcLogFlag = StringUtils.isEmpty(zpglRcxx.getId());
284718418@qq.com committed
59 60 61 62
        // 计算工作年限
        if(!StringUtils.isEmpty(zpglRcxx.getWorkBeginYear())){
            zpglRcxx.setWorkyears(DateFormatUtils.yearCompare(zpglRcxx.getWorkBeginYear(),new Date()));
        }
63 64
        zpglRcxx.insertOrUpdate();

65
        if(insertZpglMslcLogFlag){
284718418@qq.com committed
66 67 68 69 70 71 72 73 74
            // 新增人才信息 初始化流程记录
            ZpglMslcLog zpglMslcLog = new ZpglMslcLog();
            zpglMslcLog.setZpglRcxxId(zpglRcxx.getId());
            zpglMslcLog.setUserId(0);
            zpglMslcLog.setUserName("");
            zpglMslcLog.setZpglRcxxStatus(JxglEnumInterface.MslcLogStatus.OTHER.getType());
            zpglMslcLog.setDetail(ZpglMessageTemplate.SYS_ADD);
            zpglMslcLogService.addZpglMslcLog(zpglMslcLog);
        }
75 76

        //添加紧急联系人
龙于生 committed
77 78
        if(dto.getZpglRcxxLxxxb() != null){
            ZpglRcxxLxxxb zpglRcxxLxxxb = dto.getZpglRcxxLxxxb();
79 80 81 82 83
            zpglRcxxLxxxb.setZpglRcxxId(zpglRcxx.getId());
            zpglRcxxLxxxb.insertOrUpdate();
        }

        //新增/修改工作经验
龙于生 committed
84 85
        if(dto.getZpglRcxxExperience() !=null && dto.getZpglRcxxExperience().size()>0){
            List<ZpglRcxxExperience> experiences = dto.getZpglRcxxExperience();
86 87 88 89 90 91 92 93 94
            for(ZpglRcxxExperience experience : experiences){
                if(experience.getCompany() != null){
                    experience.setZpglRcxxId(zpglRcxx.getId());
                    experience.insertOrUpdate();
                }
            }
        }

        //新增/修改教育经历
龙于生 committed
95 96
        if(dto.getZpglRcxxStudy() !=null && dto.getZpglRcxxStudy().size()>0){
            List<ZpglRcxxStudy> zpglRcxxStudys = dto.getZpglRcxxStudy();
97 98 99 100 101 102 103 104
            for(ZpglRcxxStudy study : zpglRcxxStudys){
                if(study.getSchoolName() != null){
                    study.setZpglRcxxId(zpglRcxx.getId());
                    study.insertOrUpdate();
                }
            }
        }
        //新增/修改家庭资料
龙于生 committed
105 106
        if(dto.getZpglRcxxJtzls() !=null && dto.getZpglRcxxJtzls().size()>0){
            List<ZpglRcxxJtzl> zpglRcxxJtzls = dto.getZpglRcxxJtzls();
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
            for(ZpglRcxxJtzl jtzl : zpglRcxxJtzls){
                if(jtzl.getName() != null){
                    jtzl.setZpglRcxxId(zpglRcxx.getId());
                    jtzl.insertOrUpdate();
                }
            }
        }


        return ResultUtil.success();
    }

    /**
     * 查询面试申请信息
     * @param
     * @return
     */
124
    @RequestMapping("/interview_application_info")
125 126
    @ApiOperation(value = "查询面试申请信息", httpMethod = "GET", notes = "查询面试申请信息")
    @Log(title = "interviewApplicationIofo", businessType = BusinessType.INSERT_UPDATE)
127 128
    public Result<InterviewApplicationDto> interviewApplicationIofo(@RequestParam String mobile,Integer zpglRcxxId) {

129
        InterviewApplicationDto dto = new InterviewApplicationDto();
130 131 132 133 134 135 136 137 138 139
        List<ZpglRcxx> zpglRcxxes = new ArrayList<>();
        if(null != zpglRcxxId){
            zpglRcxxes = ZpglRcxx.builder().build()
                    .selectList(new QueryWrapper<ZpglRcxx>().lambda()
                            .eq(ZpglRcxx::getId, zpglRcxxId));
        }else{
            zpglRcxxes = ZpglRcxx.builder().build()
                    .selectList(new QueryWrapper<ZpglRcxx>().lambda()
                            .eq(ZpglRcxx::getMobile, mobile));
        }
140 141 142 143
        if(zpglRcxxes.size() == 0){
            return ResultUtil.error("没有简历信息");
        }

144 145


146 147 148 149 150 151 152 153
        ZpglRcxx zpglRcxx = zpglRcxxes.get(0);
        //复制到dto
        BeanUtils.copyProperties(zpglRcxx,dto);

        //联系人信息
        List<ZpglRcxxLxxxb> zpglRcxxLxxxbs = ZpglRcxxLxxxb.builder().build().selectList(new QueryWrapper<ZpglRcxxLxxxb>()
                .lambda().select(ZpglRcxxLxxxb::getId,ZpglRcxxLxxxb::getLinkName,ZpglRcxxLxxxb::getLinkMobile)
                .eq(ZpglRcxxLxxxb::getZpglRcxxId, zpglRcxx.getId()));
龙于生 committed
154 155 156 157
        if(zpglRcxxLxxxbs.size()>0)
            dto.setZpglRcxxLxxxb(zpglRcxxLxxxbs.get(0));


158 159 160 161 162

        //工作经验
        List<ZpglRcxxExperience> experiences = ZpglRcxxExperience.builder().build()
                .selectList(new QueryWrapper<ZpglRcxxExperience>()
                .lambda().eq(ZpglRcxxExperience::getZpglRcxxId, zpglRcxx.getId()));
龙于生 committed
163 164
        if (experiences.size()>0)
            dto.setZpglRcxxExperience(experiences);
165 166 167 168 169

        //教育经历
        List<ZpglRcxxStudy> study = ZpglRcxxStudy.builder().build()
                .selectList(new QueryWrapper<ZpglRcxxStudy>()
                        .lambda().eq(ZpglRcxxStudy::getZpglRcxxId, zpglRcxx.getId()));
龙于生 committed
170 171
        if (study.size()>0)
            dto.setZpglRcxxStudy(study);
172 173 174 175 176

        //家庭资料
        List<ZpglRcxxJtzl> jtzl = ZpglRcxxJtzl.builder().build()
                .selectList(new QueryWrapper<ZpglRcxxJtzl>()
                        .lambda().eq(ZpglRcxxJtzl::getZpglRcxxId, zpglRcxx.getId()));
龙于生 committed
177 178
        if (jtzl.size()>0)
            dto.setZpglRcxxJtzls(jtzl);
179 180 181

        return ResultUtil.data(dto,"查询成功");
    }
182 183 184 185 186 187 188 189 190 191 192

    @RequestMapping("/getOrgName")
    @ApiOperation(value = "根据orgCode获取企业名称", httpMethod = "GET", notes = "获取企业名称")
    public Object getOrgName(@RequestParam("orgCode") Integer orgCode){
        QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().build()
                .selectOne(new QueryWrapper<QyzxEntInfoM>().lambda()
                        .select(QyzxEntInfoM::getName).eq(QyzxEntInfoM::getId, orgCode));

        return ResultUtil.data(qyzxEntInfoM);
    }

193
}