package com.zjrs.ggfw.rlzysc.blo.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.mohrss.leaf.core.framework.domain.blo.impl.BLOImpl;
import org.mohrss.leaf.core.framework.persistens.PageResult;
import org.mohrss.leaf.core.framework.persistens.PageUtil;
import org.mohrss.leaf.core.framework.util.CurrentUser;
import org.mohrss.leaf.core.framework.web.exception.AppException;
import com.zjrs.ggfw.portal.entity.VRsGgfwUserMapper;
import com.zjrs.ggfw.rlzysc.blo.GrqzBLO;
import com.zjrs.ggfw.rlzysc.bpo.JbxxglFeignClientBPO;
import com.zjrs.ggfw.rlzysc.bpo.WjfwFeignClientBPO;
import com.zjrs.ggfw.rlzysc.dto.*;
import com.zjrs.ggfw.rlzysc.dto.common.PageDTO;
import com.zjrs.ggfw.rlzysc.dto.grzxjlxx.*;
import com.zjrs.ggfw.rlzysc.entity.*;
import com.zjrs.ggfw.rlzysc.po.*;
import com.zjrs.ggfw.rlzysc.utils.RlzyscUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class GrqzBLOimpl extends BLOImpl implements GrqzBLO {
    private static final Logger LOG = LoggerFactory.getLogger(GrqzBLOimpl.class);
    @Resource
    GwxxMapper gwxxMapper;
    @Resource
    WjfwFeignClientBPO wjfwFeignClientBPO;
    @Resource
    GrqzJlxxMapper grqzJlxxMapper;
    @Resource
    GzgsMapper gzgsMapper;
    @Resource
    PbszMapper pbszMapper;
    @Resource
    ZyssqMapper zyssqMapper;
    @Resource
    JlxxMapper jlxxMapper;
    @Resource
    QzyxMapper qzyxMapper;
    @Resource
    GzjyMapper gzjyMapper;
    @Resource
    GzjyWhMapper gzjyWhMapper;
    @Resource
    JyjlMapper jyjlMapper;
    @Resource
    JyjlWhMappper jyjlWhMappper;
    @Resource
    ZyjnMapper zyjnMapper;
    @Resource
    ZyjnWhMapper zyjnWhMapper;
    @Resource
    ShzsMapper shzsMapper;
    @Resource
    ShzsWhMapper shzsWhMapper;
    @Resource
    HjqkMapper hjqkMapper;
    @Resource
    HjqkWhMapper hjqkWhMapper;
    @Resource
    PxjlMapper pxjlMapper;
    @Resource
    PxjlWhMapper pxjlWhMapper;
    @Resource
    ZcqkMapper zcqkMapper;
    @Resource
    ZcqkWhMapper zcqkWhMapper;
    @Resource
    private RsRlzyQzyxWhMapper rsRlzyQzyxWhMapper;
    @Resource
    ZwxxMapper zwxxMapper;
    @Resource
    ZwscMapper zwscMapper;
    @Resource
    JlglMapper jlglMapper;

    @Resource
    private JbxxglFeignClientBPO jbxxglFeignClientBPO;

    @Resource
    private VRsGgfwUserMapper vRsGgfwUserMapper;

    //头像上传
    @Override
    public void uploadPhoto(GrqzGrtxUploadDTO dto) {
        //操作时间
        Date t = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUserid() == null ? "" : currentUser.getUserid().trim();

        JlxxPO jlxxPO = new JlxxPO();
        jlxxPO.setTsxgr(userid);
        jlxxPO.setTsxgsj(df.format(t));
        this.grqzJlxxMapper.updateById(jlxxPO);
    }

    //头像查询
    @Override
    public JlxxPO queryPhoto(GrqzGrxxQueryDTO dto) {
        QueryWrapper<JlxxPO> queryWrapper = new QueryWrapper<>();
        return this.grqzJlxxMapper.selectOne(queryWrapper);
    }

    //视频上传
    @Override
    public void uploadVideo(GrqzGrspUploadDTO dto) {

        //操作时间
        Date t = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        JlxxPO jlxxPO = new JlxxPO();
        jlxxPO.setRsrlzyjlxxlsh(dto.getRsrlzyjlxxlsh());
        jlxxPO.setTsxgsj(df.format(t));
        this.grqzJlxxMapper.updateById(jlxxPO);
    }

    //视频查询
    @Override
    public JlxxPO queryVideo(GrqzGrxxQueryDTO dto) {
        QueryWrapper<JlxxPO> queryWrapper = new QueryWrapper<>();
        return this.grqzJlxxMapper.selectOne(queryWrapper);
    }

    //岗位信息列表
    @Override
    public PageResult queryGwxxList(GrqzGwxxQueryDTO dto, int page, int rows) {
        Page<GrqzGwxxListDTO> page1 = new Page<>(page, rows);
        Page<GrqzGwxxListDTO> pageResult = null;
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        dto.setRsyhlsh(userid);
        pageResult = (Page) this.gwxxMapper.getGwxxList(page1, dto);
        PageResult result = PageUtil.PageResult(pageResult);
        return result;
    }

    //删除岗位信息
    @Override
    public void deleteGwxx(String id) {
        this.gwxxMapper.deleteById(id);
    }

    //关注公司列表
    @Override
    public PageResult queryGzgsList(GrqzGzgsQueryDTO dto, int page, int rows) {
        Page<GrqzGzgsListDTO> page1 = new Page<>(page, rows);
        Page<GrqzGzgsListDTO> pageResult = null;
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        dto.setRsyhlsh(userid);
        pageResult = (Page) this.gzgsMapper.getGzgsList(page1, dto);
        PageResult result = PageUtil.PageResult(pageResult);
        return result;
    }

    //关注公司
    @Override
    public void addGzgs(GrqzGzgsDTO dto) {
        //操作时间
        Date t = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        QueryWrapper<GzgsPO> queryWrapper = new QueryWrapper<>();
        long count = gzgsMapper.selectCount(queryWrapper);
        if (count > 0) {
            throw new AppException("已关注当前企业, 请勿重复关注");
        }

        GzgsPO gzgsPO = new GzgsPO();
        BeanUtils.copyProperties(dto, gzgsPO);
        gzgsPO.setTscjsj(df.format(t));

        this.gzgsMapper.insert(gzgsPO);

    }

    //取消关注公司
    @Override
    public void deleteGzgs(String id) {
        this.gzgsMapper.deleteById(id);
    }

    //屏蔽设置列表
    @Override
    public PageResult queryPbszList(GrqzPbszQueryDTO dto, int page, int rows) {
        Page<GrqzPbszListDTO> page1 = new Page<>(page, rows);
        Page<GrqzPbszListDTO> pageResult = null;
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        dto.setRsyhlsh(userid);
        pageResult = (Page) this.pbszMapper.queryPbszList(page1, dto);
        PageResult result = PageUtil.PageResult(pageResult);
        return result;
    }

    //新增屏蔽设置
    @Override
    public void addPbsz(GrqzPbszDTO dto) {
        //操作时间
        Date t = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        PbszPO pbszPO = new PbszPO();
        BeanUtils.copyProperties(dto, pbszPO);
        pbszPO.setTscjsj(df.format(t));

        this.pbszMapper.insert(pbszPO);

    }

    //取消屏蔽设置
    @Override
    public void deletePbsz(String id) {
        this.pbszMapper.deleteById(id);
    }

    //职业搜索器列表
    @Override
    public PageResult queryZyssqList(GrqzZyssqDTO dto, int page, int rows) {
        Page<GrqzZyssqListDTO> page1 = new Page<>(page, rows);
        Page<GrqzZyssqListDTO> pageResult = null;
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        dto.setRsyhlsh(userid);
        pageResult = (Page) this.zyssqMapper.getZyssqList(page1, userid);
        PageResult result = PageUtil.PageResult(pageResult);
        return result;
    }

    //新增职业搜索器
    @Override
    public void addZyssq(GrqzZyssqDTO dto) {
        //操作时间
        Date t = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        ZyssqPO zyssqPO = new ZyssqPO();
        BeanUtils.copyProperties(dto, zyssqPO);
        zyssqPO.setTscjr(userid);
        String sub = df.format(t);
        String s = sub.substring(0, 10);
        zyssqPO.setTscjsj(df.format(t));
        zyssqPO.setTsyxbz("1");
        this.zyssqMapper.insert(zyssqPO);

    }

    //更新职业搜索器
    @Override
    public void updateZyssq(GrqzZyssqDTO dto) {
        //操作时间
        Date t = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        ZyssqPO zyssqPO = new ZyssqPO();
        BeanUtils.copyProperties(dto, zyssqPO);
        zyssqPO.setTsxgr(userid);
        String sub = df.format(t);
        String s = sub.substring(0, 10);
        zyssqPO.setTsxgsj(df.format(t));
        zyssqPO.setDsqzxsj(s);
        this.zyssqMapper.updateById(zyssqPO);
    }

    //获取职业搜索器BYID
    @Override
    public ZyssqPO getZyssqById(String id) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if(StringUtils.isBlank(userid)){
            return new ZyssqPO();
        }

        QueryWrapper<ZyssqPO> queryWrapper = new QueryWrapper();
        queryWrapper.eq("rs_rlzy_zyssq",id);

        return this.zyssqMapper.selectOne(queryWrapper);
    }

    //删除职业搜索器BYID
    @Override
    public void deleteZyssqById(String id) {        //操作时间
        LOG.info("blo,删除职业搜索器BYID" + id);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if(StringUtils.isBlank(userid)){
            return;
        }

        QueryWrapper<ZyssqPO> queryWrapper = new QueryWrapper();
        queryWrapper.eq("rs_rlzy_zyssq",id);
        this.zyssqMapper.delete(queryWrapper);
    }

    //职业搜索器不能超过10
    @Override
    public int countZyssq() {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        return this.zyssqMapper.countZyssq(userid);
    }

    @Override
    public PageResult getgzjyWhList(int page, int rows, JlxxWDTO dto) {
        Page<RsRlzyGzjyPO> page1 = new Page<>(page, rows);
        Page<RsRlzyGzjyPO> pageResult = null;
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String jlssr = dto.getJlssr();
        if (StringUtils.isBlank(jlssr)){
            jlssr = userid;
        }
        if (StringUtils.isNotBlank(jlssr)){
            pageResult = (Page) this.gzjyMapper.getgzjyWhList(page1, jlssr, dto);
            PageResult result = PageUtil.PageResult(pageResult);
            return result;
        }else{
            throw new AppException("获取不到该用户信息");
        }

    }

    @Override
    public PageResult getjyjlWhList(int page, int rows, JlxxWDTO dto) {
        Page<RsRlzyJyjlPO> page1 = new Page<>(page, rows);
        Page<RsRlzyJyjlPO> pageResult = null;
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String jlssr = dto.getJlssr();
        if (StringUtils.isBlank(jlssr)){
            jlssr = userid;
        }

        if (StringUtils.isNotBlank(jlssr)){
            pageResult = (Page) this.jyjlMapper.getjyjlWhList(page1, jlssr, dto);
            PageResult result = PageUtil.PageResult(pageResult);
            return result;
        }else{
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public PageResult getpxjlWhList(int page, int rows, JlxxWDTO dto) {
        Page<RsRlzyPxjlPO> page1 = new Page<>(page, rows);
        Page<RsRlzyPxjlPO> pageResult = null;
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String jlssr = dto.getJlssr();
        if (StringUtils.isBlank(jlssr)){
            jlssr = userid;
        }

        if (StringUtils.isNotBlank(jlssr)){
            pageResult = (Page) this.pxjlMapper.getpxjlWhList(page1, jlssr, dto);
            PageResult result = PageUtil.PageResult(pageResult);
            return result;
        }else{
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public PageResult getzyjnWhList(int page, int rows, JlxxWDTO dto) {
        Page<RsRlzyZyjnPO> page1 = new Page<>(page, rows);
        Page<RsRlzyZyjnPO> pageResult = null;
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String jlssr = dto.getJlssr();
        if (StringUtils.isBlank(jlssr)){
            jlssr = userid;
        }

        if (StringUtils.isNotBlank(jlssr)){
            pageResult = (Page) this.zyjnMapper.getzyjnWhList(page1, jlssr, dto);
            PageResult result = PageUtil.PageResult(pageResult);
            return result;
        }else{
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public PageResult getshzsWhList(int page, int rows, JlxxWDTO dto) {
        Page<RsRlzyShzsPO> page1 = new Page<>(page, rows);
        Page<RsRlzyShzsPO> pageResult = null;
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String jlssr = dto.getJlssr();
        if (StringUtils.isBlank(jlssr)){
            jlssr = userid;
        }

        if (StringUtils.isNotBlank(jlssr)){
            pageResult = (Page) this.shzsMapper.getshzsWhList(page1, jlssr, dto);
            PageResult result = PageUtil.PageResult(pageResult);
            return result;
        }else{
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public PageResult getHjqkWhList(int page, int rows, JlxxWDTO dto) {
        Page<RsRlzyHjqkPO> page1 = new Page<>(page, rows);
        Page<RsRlzyHjqkPO> pageResult = null;
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String jlssr = dto.getJlssr();
        if (StringUtils.isBlank(jlssr)){
            jlssr = userid;
        }

        if (StringUtils.isNotBlank(jlssr)){
            pageResult = (Page) this.hjqkMapper.getHjqkWhList(page1, jlssr, dto);
            PageResult result = PageUtil.PageResult(pageResult);
            return result;
        }else{
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public PageResult getZcqkWhList(int page, int rows, JlxxWDTO dto) {
        Page<RsRlzyZcqkPO> page1 = new Page<>(page, rows);
        Page<RsRlzyZcqkPO> pageResult = null;
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String jlssr = dto.getJlssr();
        if (StringUtils.isBlank(jlssr)){
            jlssr = userid;
        }

        if (StringUtils.isNotBlank(jlssr)){
            pageResult = (Page) this.zcqkMapper.getZcqkWhList(page1, jlssr, dto);
            PageResult result = PageUtil.PageResult(pageResult);
            return result;
        }else{
            throw new AppException("获取不到该用户信息");
        }
    }

    //删除工作经验信息
    @Override
    public void deleteById(String id) {  //删除的是dyb对应表中的数据
//        CurrentUser currentUser = getCurrentUser();
//        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
//        if (StringUtils.isNotBlank(userid)){
            QueryWrapper<RsRlzyGzjyWhPO> queryWrapper = new QueryWrapper();
            queryWrapper.eq("rs_rlzy_gzjy_dyb",id);
            RsRlzyGzjyWhPO po = this.gzjyWhMapper.selectOne(queryWrapper);
            if(!isfb(po.getRsrlzyjlxxlsh(),null)){
                this.gzjyWhMapper.deleteById(id);
            }else{
            throw new AppException("该简历已发布,不允许修改!");
            }
//        }else{
//            throw new AppException("获取不到该用户信息");
//        }

    }

    //删除教育经历信息
    @Override
    public void deleteJyjlById(String id) {
//        CurrentUser currentUser = getCurrentUser();
//        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
//        if (StringUtils.isNotBlank(userid)){
            QueryWrapper<RsRlzyJyjlWhPO> queryWrapper = new QueryWrapper();
            queryWrapper.eq("rs_rlzy_jyjl_dyb",id);
            RsRlzyJyjlWhPO po = this.jyjlWhMappper.selectOne(queryWrapper);
            if(!isfb(po.getRsrlzyjlxxlsh(),null)){
                this.jyjlWhMappper.deleteById(id);
            }else{
                throw new AppException("该简历已发布,不允许修改!");
            }
//        }else{
//            throw new AppException("获取不到该用户信息");
//        }
    }

    //删除培训经历信息
    @Override
    public void deletePxjlById(String id) {
//        CurrentUser currentUser = getCurrentUser();
//        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
//        if (StringUtils.isNotBlank(userid)){
            QueryWrapper<RsRlzyPxjlWhPO> queryWrapper = new QueryWrapper();
            queryWrapper.eq("rs_rlzy_pxjl_dyb",id);
            RsRlzyPxjlWhPO po = this.pxjlWhMapper.selectOne(queryWrapper);
            if(!isfb(po.getRsrlzyjlxxlsh(),null)){
                this.pxjlWhMapper.deleteById(id);
            }else{
                throw new AppException("该简历已发布,不允许修改!");
            }
//        }else{
//            throw new AppException("获取不到该用户信息");
//        }
    }

    //删除职业技能信息
    @Override
    public void deleteZyjnById(String id) {
//        CurrentUser currentUser = getCurrentUser();
//        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
//        if (StringUtils.isNotBlank(userid)){
            QueryWrapper<RsRlzyZyjnWhPO> queryWrapper = new QueryWrapper();
            queryWrapper.eq("rs_rlzy_zyjn_dyb",id);
            RsRlzyZyjnWhPO po = this.zyjnWhMapper.selectOne(queryWrapper);
            if(!isfb(po.getRsrlzyjlxxlsh(),null)){
                this.zyjnWhMapper.deleteById(id);
            }else{
                throw new AppException("该简历已发布,不允许修改!");
            }
//        }else{
//            throw new AppException("获取不到该用户信息");
//        }
    }

    //删除所获奖项情况
    @Override
    public void deleteShzsById(String id) {
//        CurrentUser currentUser = getCurrentUser();
//        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
//        if (StringUtils.isNotBlank(userid)){
            QueryWrapper<RsRlzyShzsWhPO> queryWrapper = new QueryWrapper();
            queryWrapper.eq("rs_rlzy_shzs_dyb",id);
            RsRlzyShzsWhPO po = this.shzsWhMapper.selectOne(queryWrapper);
            if(!isfb(po.getRsrlzyjlxxlsh(),null)){
                this.shzsWhMapper.deleteById(id);
            }else{
                throw new AppException("该简历已发布,不允许修改!");
            }
//        }else{
//            throw new AppException("获取不到该用户信息");
//        }
    }

    //删除获奖情况情况
    @Override
    public void deleteHjqkById(String id) {
//        CurrentUser currentUser = getCurrentUser();
//        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
//        if (StringUtils.isNotBlank(userid)){
            QueryWrapper<RsRlzyHjqkWhPO> queryWrapper = new QueryWrapper();
            queryWrapper.eq("rs_rlzy_hjqk_dyb",id);
            RsRlzyHjqkWhPO po = this.hjqkWhMapper.selectOne(queryWrapper);
            if(!isfb(po.getRsrlzyjlxxlsh(),null)){
                this.hjqkWhMapper.deleteById(id);
            }else{
                throw new AppException("该简历已发布,不允许修改!");
            }
//        }else{
//            throw new AppException("获取不到该用户信息");
//        }
    }

    @Override
    public void deleteZcqkById(String id) {
//        CurrentUser currentUser = getCurrentUser();
//        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
//        if (StringUtils.isNotBlank(userid)){
            QueryWrapper<RsRlzyZcqkWhPO> queryWrapper = new QueryWrapper();
            queryWrapper.eq("rs_rlzy_zcqk_dyb",id);
            RsRlzyZcqkWhPO po = this.zcqkWhMapper.selectOne(queryWrapper);
            if(!isfb(po.getRsrlzyjlxxlsh(),null)){
                this.zcqkWhMapper.deleteById(id);
            }else{
                throw new AppException("该简历已发布,不允许修改!");
            }
//        }else{
//            throw new AppException("获取不到该用户信息");
//        }
    }

    //保存工作经验信息
    @Override
    public RsRlzyGzjyPO saveGzjyXx(JlxxGzjyUDTO dto) {
        if (StringUtils.isNotBlank(dto.getGzdw()) && dto.getGzdw().length() > 100) {
            throw new AppException("工作单位最多只能输入100个字符或汉字");
        }
        if (StringUtils.isNotBlank(dto.getSzzw()) && dto.getSzzw().length() > 100) {
            throw new AppException("所在职位最多只能输入100个字符或汉字");
        }
        if (StringUtils.isNotBlank(dto.getGzzz()) && dto.getGzzz().length() > 1000) {
            throw new AppException("工作职责最多只能输入1000个字符或汉字");
        }
        RsRlzyGzjyPO po = new RsRlzyGzjyPO();
        BeanUtils.copyProperties(dto, po);
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String fbzt = "0";
        String shjg = "0";
        String sftjnwsh = "0";

        String jlssr = dto.getJlssr();
        if (StringUtils.isBlank(jlssr)){
            jlssr = userid;
        } else {
            fbzt = "0";
            shjg = "1";
            sftjnwsh = "1";
        }

        if (StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(jlssr)) {
            if (!isfb(dto.getRsrlzyjlxxlsh(),null)) {
                po.setTsxgr(userid);//修改人
                po.setTsxgsj(dataString);//修改时间
                if (StringUtils.isNotBlank(dto.getRsrlzygzjylsh())) {
                    //更新简历主表的提交审核状态，审核结果，发布状态
                    JlxxPO jlxxpo = new JlxxPO();
                    jlxxpo.setSftjnwsh(sftjnwsh);//是否提交审核置为未提交
                    jlxxMapper.updateById(jlxxpo);
                    //更新获奖情况表数据
                    po.setRsrlzygzjylsh(dto.getRsrlzygzjylsh());
                    gzjyMapper.updateById(po);

                } else {
                    //新增
                    //插入工作经验表数据
                    po.setTscjr(userid);//创建人
                    po.setTscjsj(dataString);//创建时间
                    po.setRsyhlsh(jlssr);//简历对应的用户
                    po.setTsyxbz("1");//新增默认有效
                    gzjyMapper.insert(po);
                    //插入对应表数据
                    RsRlzyGzjyWhPO dybpo = new RsRlzyGzjyWhPO();
                    dybpo.setTscjsj(dataString);//创建时间
                    gzjyWhMapper.insert(dybpo);
                }
                return po;
            } else {
                throw new AppException("该简历已发布，不允许修改！");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }

    }

    //保存教育经历信息
    @Override
    public RsRlzyJyjlPO saveJyjlXx(JlxxJyjlUDTO dto) {
        if (StringUtils.isNotBlank(dto.getByyx()) && dto.getByyx().length() > 50) {
            throw new AppException("毕业院校最多只能输入50个字符或汉字");
        }
        if (StringUtils.isNotBlank(dto.getSxzy()) && dto.getSxzy().length() > 25) {
            throw new AppException("所学专业最多只能输入25个字符或汉字");
        }
        RsRlzyJyjlPO po = new RsRlzyJyjlPO();
        BeanUtils.copyProperties(dto, po);
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String fbzt = "0";
        String shjg = "0";
        String sftjnwsh = "0";

        String jlssr = dto.getJlssr();

        if (StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(jlssr)) {
            if(!isfb(dto.getRsrlzyjlxxlsh(),null)){
                po.setTsxgr(userid);//修改人
                po.setTsxgsj(dataString);//修改时间
                if (StringUtils.isNotBlank(dto.getRsrlzyjyjllsh())) {
                    JlxxPO jlxxpo = new JlxxPO();
                    jlxxpo.setFbzt(fbzt);
                    po.setRsrlzyjyjllsh(dto.getRsrlzyjyjllsh());
                    jyjlMapper.updateById(po);
                } else {
                    po.setTscjr(userid);
                    po.setTscjsj(dataString);
                    jyjlMapper.insert(po);
                    String rsrlzyjyjllsh = po.getRsrlzyjyjllsh();
                    RsRlzyJyjlWhPO dybpo = new RsRlzyJyjlWhPO();
                    dybpo.setTscjsj(dataString);//创建时间
                    jyjlWhMappper.insert(dybpo);
                }
                return po;
        }else{
            throw new AppException("该简历已发布，不允许修改！");
        }
    }else{
            throw new AppException("获取不到该用户信息");
        }
    }

    //保存培训经历信息
    @Override
    public RsRlzyPxjlPO savePxjlXx(JlxxPxjlUDTO dto) {
        if (StringUtils.isNotBlank(dto.getPxjg()) && dto.getPxjg().length() > 16) {
            throw new AppException("培训机构最多只能输入16个字符或汉字");
        }
        if (StringUtils.isNotBlank(dto.getPxkc()) && dto.getPxkc().length() > 16) {
            throw new AppException("培训课程最多只能输入16个字符或汉字");
        }
        RsRlzyPxjlPO po = new RsRlzyPxjlPO();
        BeanUtils.copyProperties(dto, po);
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String fbzt = "0";
        String shjg = "0";
        String sftjnwsh = "0";

        String jlssr = dto.getJlssr();

        if (StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(jlssr)) {
            if(!isfb(dto.getRsrlzyjlxxlsh(),null)){
                po.setTsxgr(userid);//修改人
                po.setTsxgsj(dataString);//修改时间
                if (StringUtils.isNotBlank(dto.getRsrlzypxjllsh())) {
                    //更新简历主表的提交审核状态，审核结果，发布状态
                    JlxxPO jlxxpo = new JlxxPO();
                    jlxxMapper.updateById(jlxxpo);
                    //更新培训经历表数据
                    po.setRsrlzypxjllsh(dto.getRsrlzypxjllsh());
                    pxjlMapper.updateById(po);
                } else {
                    //新增
                    //插入培训经历表数据
                    po.setTscjr(userid);//创建人
                    pxjlMapper.insert(po);
                    //插入对应表数据
                    String rsrlzypxjllsh = po.getRsrlzypxjllsh();
                    RsRlzyPxjlWhPO dybpo = new RsRlzyPxjlWhPO();
                    dybpo.setTscjsj(dataString);//创建时间
                    pxjlWhMapper.insert(dybpo);
                }
                return po;
            }else{
                throw new AppException("该简历已发布，不允许修改！");
            }
    } else {
        throw new AppException("获取不到该用户信息");
    }
}

    //保存职业技能信息
    @Override
    public RsRlzyZyjnPO saveZyjnXx(JlxxZyjnUDTO dto) {
        if (StringUtils.isNotBlank(dto.getJnhztc()) && dto.getJnhztc().length()>50){
            throw new AppException("技能或特长最多只能输入50个字符或汉字");
        }
        if (StringUtils.isNotBlank(dto.getCygz()) && dto.getCygz().length()>10){
            throw new AppException("从业工种最多只能输入10个字符或汉字");
        }
        RsRlzyZyjnPO po = new RsRlzyZyjnPO();
        BeanUtils.copyProperties(dto, po);
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String fbzt = "0";
        String shjg = "0";
        String sftjnwsh = "0";

        String jlssr = dto.getJlssr();
        if (StringUtils.isNotBlank(userid)) {
            if(!isfb(dto.getRsrlzyjlxxlsh(),null)){
                po.setTsxgr(userid);//修改人
                po.setTsxgsj(dataString);//修改时间
                if (StringUtils.isNotBlank(dto.getRsrlzyzyjnlsh())) {
                    //更新简历主表的提交审核状态，审核结果，发布状态
                    JlxxPO jlxxpo = new JlxxPO();
                    jlxxpo.setRsrlzyjlxxlsh(dto.getRsrlzyjlxxlsh());
                    jlxxMapper.updateById(jlxxpo);
                    //更新职业技能表数据
                    po.setRsrlzyzyjnlsh(dto.getRsrlzyzyjnlsh());
                    zyjnMapper.updateById(po);
                } else {
                    //新增
                    //插入职业技能表表数据
                    po.setTscjr(userid);//创建人
                    po.setTscjsj(dataString);//创建时间
                    zyjnMapper.insert(po);
                    //插入对应表数据
                    String rsrlzyzyjnlsh = po.getRsrlzyzyjnlsh();
                    RsRlzyZyjnWhPO dybpo = new RsRlzyZyjnWhPO();
                    dybpo.setRsrlzyjlxxlsh(dto.getRsrlzyjlxxlsh());
                    zyjnWhMapper.insert(dybpo);
                }
                return po;
            }else{
                throw new AppException("该简历已发布，不允许修改！");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    //保存所获证书信息
    @Override
    public RsRlzyShzsPO saveShzsXx(JlxxShzsUDTO dto) {
            if (StringUtils.isNotBlank(dto.getZsmc()) && dto.getZsmc().length()>100){
                throw new AppException("证书名称最多只能输入100个字符或汉字");
            }
            if (StringUtils.isNotBlank(dto.getZsbh()) && dto.getZsbh().length()>50){
                throw new AppException("证书编号最多只能输入50个字符或汉字");
            }
        RsRlzyShzsPO po = new RsRlzyShzsPO();
        BeanUtils.copyProperties(dto, po);
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String fbzt = "0";
        String shjg = "0";
        String sftjnwsh = "0";

        String jlssr = dto.getJlssr();

        if (StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(jlssr)) {
            if(!isfb(dto.getRsrlzyjlxxlsh(),null)){
                po.setTsxgr(userid);//修改人
                po.setTsxgsj(dataString);//修改时间
                if (StringUtils.isNotBlank(dto.getRsrlzyshzslsh())) {
                    //更新简历主表的提交审核状态，审核结果，发布状态
                    JlxxPO jlxxpo = new JlxxPO();
                    jlxxpo.setRsrlzyjlxxlsh(dto.getRsrlzyjlxxlsh());
                    jlxxMapper.updateById(jlxxpo);
                    //更新所获证书表数据
                    po.setRsrlzyshzslsh(dto.getRsrlzyshzslsh());
                    shzsMapper.updateById(po);
                } else {
                    //新增
                    //插入求职意向表数据
                    po.setTscjr(userid);//创建人
                    shzsMapper.insert(po);
                    //插入所获证书对应表数据
                    String rsrlzyshzslsh = po.getRsrlzyshzslsh();
                    RsRlzyShzsWhPO dybpo = new RsRlzyShzsWhPO();
                    dybpo.setRsrlzyshzslsh(rsrlzyshzslsh);
                    dybpo.setTscjr(userid);//创建人
                    dybpo.setTscjsj(dataString);//创建时间
                    shzsWhMapper.insert(dybpo);
                }
                return po;
            }else{
                throw new AppException("该简历已发布，不允许修改！");
            }

        } else {
            throw new AppException("获取不到该用户信息");
        }

    }

    //保存获奖情况信息
    @Override
    public RsRlzyHjqkPO saveHjqkXx(JlxxHjqkUDTO dto) {
            if (StringUtils.isNotBlank(dto.getZsmc()) && dto.getZsmc().length()>100){
                throw new AppException("获奖情况最多只能输入100个字符或汉字");
            }
            if (StringUtils.isNotBlank(dto.getBjjg()) && dto.getBjjg().length()>100){
                throw new AppException("颁奖机构最多只能输入100个字符或汉字");
            }
        RsRlzyHjqkPO po = new RsRlzyHjqkPO();
        BeanUtils.copyProperties(dto, po);
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        String fbzt = "0";
        String shjg = "0";
        String sftjnwsh = "0";

        String jlssr = dto.getJlssr();


        if (StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(jlssr)) {
            if(!isfb(dto.getRsrlzyjlxxlsh(),null)){
                po.setTsxgr(userid);//修改人
                po.setTsxgsj(dataString);//修改时间
                if (StringUtils.isNotBlank(dto.getRsrlzyhjqklsh())) {
                    //更新简历主表的提交审核状态，审核结果，发布状态
                    JlxxPO jlxxpo = new JlxxPO();
                    jlxxpo.setRsrlzyjlxxlsh(dto.getRsrlzyjlxxlsh());
                    jlxxMapper.updateById(jlxxpo);
                    //更新获奖情况表数据
                    po.setRsrlzyhjqklsh(dto.getRsrlzyhjqklsh());
                    hjqkMapper.updateById(po);
                } else {
                    //新增
                    //插入获奖情况表数据
                    po.setTscjr(userid);//创建人
                    hjqkMapper.insert(po);
                    //插入对应表数据
                    String rsrlzyhjqklsh = po.getRsrlzyhjqklsh();
                    RsRlzyHjqkWhPO dybpo = new RsRlzyHjqkWhPO();
                    dybpo.setTscjr(userid);//创建人
                    dybpo.setTscjsj(dataString);//创建时间
                    hjqkWhMapper.insert(dybpo);
                }
                return po;
            }else{
                throw new AppException("该简历已发布，不允许修改！");
            }

        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    //保存职称情况信息
    @Override
    public RsRlzyZcqkPO saveZcqkXx(JlxxZcqkUDTO dto) {
        RsRlzyZcqkPO po = new RsRlzyZcqkPO();
        BeanUtils.copyProperties(dto, po);
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String fbzt = "0";
        String shjg = "0";
        String sftjnwsh = "0";

        String jlssr = dto.getJlssr();

        if (StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(jlssr)) {
            if(!isfb(dto.getRsrlzyjlxxlsh(),null)){
                po.setTsxgr(userid);//修改人
                po.setTsxgsj(dataString);//修改时间
                if (StringUtils.isNotBlank(dto.getRsrlzyzcqklsh())) {
                    //更新简历主表的提交审核状态，审核结果，发布状态
                    JlxxPO jlxxpo = new JlxxPO();
                    jlxxpo.setRsrlzyjlxxlsh(dto.getRsrlzyjlxxlsh());
                    jlxxMapper.updateById(jlxxpo);
                    //更新获奖情况表数据
                    po.setRsrlzyzcqklsh(dto.getRsrlzyzcqklsh());
                    zcqkMapper.updateById(po);
                } else {
                    //新增
                    //插入获奖情况表数据
                    po.setTscjr(userid);//创建人
                    po.setTsyxbz("1");//新增默认有效
                    zcqkMapper.insert(po);
                    //插入对应表数据
                    String rsrlzyzcqklsh = po.getRsrlzyzcqklsh();
                    RsRlzyZcqkWhPO dybpo = new RsRlzyZcqkWhPO();
                    dybpo.setTscjr(userid);//创建人
                    dybpo.setTscjsj(dataString);//创建时间
                    zcqkWhMapper.insert(dybpo);
                }
                return po;
            }else{
                throw new AppException("该简历已发布，不允许修改！");
            }

        } else {
            throw new AppException("获取不到该用户信息");
        }
    }


    @Override
    public void deleteGzjyWhById(SelectJlxxDTO dto) {//维护主表信息
        if (!isfb(dto.getRsrlzyjlxxlsh())){
            RsRlzyGzjyPO po = new RsRlzyGzjyPO();
            po.setTsyxbz("0");
            po.setRsrlzygzjylsh(dto.getZjlsh());
            this.gzjyMapper.updateById(po);
        }else{
            throw new AppException("该简历已发布，不可修改!");
        }

    }

    @Override
    public void deleteJyjlWhById(SelectJlxxDTO dto) {
        if (!isfb(dto.getRsrlzyjlxxlsh())){
            RsRlzyJyjlPO po = new RsRlzyJyjlPO();
            po.setTsyxbz("0");
            po.setRsrlzyjyjllsh(dto.getZjlsh());
            this.jyjlMapper.updateById(po);
        }else{
            throw new AppException("该简历已发布，不可修改!");
        }
    }

    @Override
    public void deletePxjlWhById(SelectJlxxDTO dto) {
        if (!isfb(dto.getRsrlzyjlxxlsh())) {
            RsRlzyPxjlPO po = new RsRlzyPxjlPO();
            po.setTsyxbz("0");
            po.setRsrlzypxjllsh(dto.getZjlsh());
            this.pxjlMapper.updateById(po);
        } else {
            throw new AppException("该简历已发布，不可修改!");
        }
    }


    @Override
    public void deleteZyjnWhById(SelectJlxxDTO dto) {
        if (!isfb(dto.getRsrlzyjlxxlsh())) {
            RsRlzyZyjnPO po = new RsRlzyZyjnPO();
            po.setTsyxbz("0");
            po.setRsrlzyzyjnlsh(dto.getZjlsh());
            this.zyjnMapper.updateById(po);
        } else {
            throw new AppException("该简历已发布，不可修改!");
        }
    }

    @Override
    public void deleteShzsWhById(SelectJlxxDTO dto) {

        if (!isfb(dto.getRsrlzyjlxxlsh())) {
            RsRlzyShzsPO po = new RsRlzyShzsPO();
            po.setTsyxbz("0");
            po.setRsrlzyshzslsh(dto.getZjlsh());
            this.shzsMapper.updateById(po);
        } else {
            throw new AppException("该简历已发布，不可修改!");
        }
    }

    @Override
    public void deleteHjqkWhById(SelectJlxxDTO dto) {
        if (!isfb(dto.getRsrlzyjlxxlsh())) {
            RsRlzyHjqkPO po = new RsRlzyHjqkPO();
            po.setTsyxbz("0");
            po.setRsrlzyhjqklsh(dto.getZjlsh());
            this.hjqkMapper.updateById(po);
        } else {
            throw new AppException("该简历已发布，不可修改!");
        }
    }

    @Override
    public void deleteZcqkWhById(SelectJlxxDTO dto) {
        if (!isfb(dto.getRsrlzyjlxxlsh())) {
            RsRlzyZcqkPO po = new RsRlzyZcqkPO();
            po.setTsyxbz("0");
            po.setRsrlzyzcqklsh(dto.getZjlsh());
            this.zcqkMapper.updateById(po);
        } else {
            throw new AppException("该简历已发布，不可修改!");
        }
    }

    @Override
    public Map getJlgzjy(ZjQueryDTO dto) {
        Map<String, Object> res = new HashMap<>();
        if ("edit".equals(dto.getFlag()) || "view".equals(dto.getFlag())) {
            CurrentUser currentUser = getCurrentUser();
            String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
            if (StringUtils.isNotBlank(dto.getZjlsh()) && StringUtils.isNotBlank(userid)) {
                HashMap<String, Object> qmap = new HashMap<>();
                qmap.put("userid", userid);
                Map<String, Object> qres = this.jlxxMapper.getJlgzjy(qmap);
                if (qres != null) {
                    res.putAll(qres);
                }
            } else {
                throw new AppException("缺少主键参数");
            }
        }
        return res;
    }


    @Override
    public Map getJljyjl(ZjQueryDTO dto) {
        Map<String, Object> res = new HashMap<>();
        if ("edit".equals(dto.getFlag()) || "view".equals(dto.getFlag())) {
            CurrentUser currentUser = getCurrentUser();
            String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
            if (StringUtils.isNotBlank(dto.getZjlsh()) && StringUtils.isNotBlank(userid)) {
                HashMap<String, Object> qmap = new HashMap<>();
                qmap.put("userid", userid);
                Map<String, Object> qres = this.jlxxMapper.getJljyjl(qmap);
                if (qres != null) {
                    res.putAll(qres);
                }
            } else {
                throw new AppException("缺少主键参数");
            }
        }
        return res;
    }

    @Override
    public Map getJlpxjl(ZjQueryDTO dto) {
        Map<String, Object> res = new HashMap<>();
        if ("edit".equals(dto.getFlag()) || "view".equals(dto.getFlag())) {
            CurrentUser currentUser = getCurrentUser();
            String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
            if (StringUtils.isNotBlank(dto.getZjlsh()) && StringUtils.isNotBlank(userid)) {
                HashMap<String, Object> qmap = new HashMap<>();
                qmap.put("userid", userid);
                Map<String, Object> qres = this.jlxxMapper.getJlpxjl(qmap);
                if (qres != null) {
                    res.putAll(qres);
                }
            } else {
                throw new AppException("缺少主键参数");
            }
        }
        return res;
    }

    @Override
    public Map getJlzyjn(ZjQueryDTO dto) {
        Map<String, Object> res = new HashMap<>();
        if ("edit".equals(dto.getFlag()) || "view".equals(dto.getFlag())) {
            CurrentUser currentUser = getCurrentUser();
            String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
            if (StringUtils.isNotBlank(dto.getZjlsh()) && StringUtils.isNotBlank(userid)) {
                HashMap<String, Object> qmap = new HashMap<>();
                qmap.put("userid", userid);
                Map<String, Object> qres = this.jlxxMapper.getJlzyjn(qmap);
                if (qres != null) {
                    res.putAll(qres);
                }
            } else {
                throw new AppException("缺少主键参数");
            }
        }
        return res;
    }

    @Override
    public Map getJlshzs(ZjQueryDTO dto) {
        Map<String, Object> res = new HashMap<>();
        if ("edit".equals(dto.getFlag()) || "view".equals(dto.getFlag())) {
            CurrentUser currentUser = getCurrentUser();
            String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
            if (StringUtils.isNotBlank(dto.getZjlsh()) && StringUtils.isNotBlank(userid)) {
                HashMap<String, Object> qmap = new HashMap<>();
                qmap.put("userid", userid);
                Map<String, Object> qres = this.jlxxMapper.getJlshzs(qmap);
                if (qres != null) {
                    res.putAll(qres);
                }
            } else {
                throw new AppException("缺少主键参数");
            }
        }
        return res;
    }

    @Override
    public Map getJlhjqk(ZjQueryDTO dto) {
        Map<String, Object> res = new HashMap<>();
        if ("edit".equals(dto.getFlag()) || "view".equals(dto.getFlag())) {
            CurrentUser currentUser = getCurrentUser();
            String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
            if (StringUtils.isNotBlank(dto.getZjlsh()) && StringUtils.isNotBlank(userid)) {
                HashMap<String, Object> qmap = new HashMap<>();
                qmap.put("userid", userid);
                Map<String, Object> qres = this.jlxxMapper.getJlhjqk(qmap);
                if (qres != null) {
                    res.putAll(qres);
                }
            } else {
                throw new AppException("缺少主键参数");
            }
        }
        return res;
    }

    @Override
    public Map getJlzcqk(ZjQueryDTO dto) {
        Map<String, Object> res = new HashMap<>();
        if ("edit".equals(dto.getFlag()) || "view".equals(dto.getFlag())) {
            CurrentUser currentUser = getCurrentUser();
            String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
            if (StringUtils.isNotBlank(dto.getZjlsh()) && StringUtils.isNotBlank(userid)) {
                HashMap<String, Object> qmap = new HashMap<>();
                qmap.put("userid", userid);
                Map<String, Object> qres = this.jlxxMapper.getJlzcqk(qmap);
                if (qres != null) {
                    res.putAll(qres);
                }
            } else {
                throw new AppException("缺少主键参数");
            }
        }
        return res;
    }

    @Override
    public List<JlxxGzjyUDTO> getgzjyList(JlxxWhDTO dto) {
        List<JlxxGzjyUDTO> gzjyList = this.gzjyMapper.getgzjyList(dto);
        return gzjyList;
    }

    @Override
    public List<JlxxJyjlUDTO> getjyjlList(JlxxWhDTO dto) {
        List<JlxxJyjlUDTO> gzjyList = this.jyjlMapper.getJyjlList(dto);
        return gzjyList;
    }

    @Override
    public List<JlxxPxjlUDTO> getpxjlList(JlxxWhDTO dto) {
        List<JlxxPxjlUDTO> pxjlList = this.pxjlMapper.getPxjlList(dto);
        return pxjlList;
    }

    @Override
    public List<JlxxZyjnUDTO> getzyjnList(JlxxWhDTO dto) {
        List<JlxxZyjnUDTO> pxjlList = this.zyjnMapper.getZyjnList(dto);
        return pxjlList;
    }

    @Override
    public List<JlxxShzsUDTO> getshzsList(JlxxWhDTO dto) {
        List<JlxxShzsUDTO> shzsList = this.shzsMapper.getShzsList(dto);
        return shzsList;
    }

    @Override
    public List<JlxxHjqkUDTO> gethjqkList(JlxxWhDTO dto) {
        List<JlxxHjqkUDTO> hjqkList = this.hjqkMapper.getHjqkList(dto);
        return hjqkList;
    }

    @Override
    public List<JlxxZcqkUDTO> getzcqkList(JlxxWhDTO dto) {
        List<JlxxZcqkUDTO> zcqkList = this.zcqkMapper.getZcqkList(dto);
        return zcqkList;
    }

    @Override
    public List<RsRlzyGzjyPO> getGzjyNrById(String id) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            if (StringUtils.isNotBlank(id)) {
                List<RsRlzyGzjyPO> list = this.gzjyMapper.getGzjyNrById(id, userid);
                return list;
            } else {
                throw new AppException("缺少简历流水号");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public List<RsRlzyJyjlPO> getJyjlNrById(String id) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            if (StringUtils.isNotBlank(id)) {
                List<RsRlzyJyjlPO> list = this.jyjlMapper.getJyjlNrById(id, userid);
                return list;
            } else {
                throw new AppException("缺少简历流水号");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public List<RsRlzyPxjlPO> getPxjlNrById(String id) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            if (StringUtils.isNotBlank(id)) {
                List<RsRlzyPxjlPO> list = this.pxjlMapper.getPxjlNrById(id, userid);
                return list;
            } else {
                throw new AppException("缺少简历流水号");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public List<RsRlzyZyjnPO> getZyjnNrById(String id) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            if (StringUtils.isNotBlank(id)) {
                List<RsRlzyZyjnPO> list = this.zyjnMapper.getZyjnNrById(id, userid);
                return list;
            } else {
                throw new AppException("缺少简历流水号");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public List<RsRlzyShzsPO> getShzsNrById(String id) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            if (StringUtils.isNotBlank(id)) {
                List<RsRlzyShzsPO> list = this.shzsMapper.getShzsNrById(id, userid);
                return list;
            } else {
                throw new AppException("缺少简历流水号");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public List<RsRlzyHjqkPO> getHjqkNrById(String id) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            if (StringUtils.isNotBlank(id)) {
                List<RsRlzyHjqkPO> list = this.hjqkMapper.getHjqkNrById(id, userid);
                return list;
            } else {
                throw new AppException("缺少简历流水号");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public List<RsRlzyZcqkPO> getZcqkNrById(String id) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            if (StringUtils.isNotBlank(id)) {
                List<RsRlzyZcqkPO> list = this.zcqkMapper.getZcqkNrById(id, userid);
                return list;
            } else {
                throw new AppException("缺少简历流水号");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public void addgzjynr(SelectJlxxDTO dto) {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        RsRlzyGzjyWhPO dybpo = new RsRlzyGzjyWhPO();
        //从维护表中选择
        if (StringUtils.isNotBlank(userid)) {
            if (!isfb(dto.getRsrlzyjlxxlsh(),null)){
                HashMap<String, Object> qmap = new HashMap<>();
//                qmap.put("userid", userid);
                qmap.put("rsrlzygzjylsh", dto.getZjlsh());
                Map<String, Object> qres = this.jlxxMapper.getJlgzjy(qmap);
                if (qres != null) {
                    dybpo.setRsrlzyjlxxlsh(dto.getRsrlzyjlxxlsh());
                    dybpo.setTscjsj(dataString);//创建时间
                    gzjyWhMapper.insert(dybpo);
                } else {
                    throw new AppException("请确认参数输入是否有误");
                }
            }else{
                throw new AppException("该简历已发布，不可修改!");
            }

        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public void addjyjlnr(SelectJlxxDTO dto) {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        RsRlzyJyjlWhPO dybpo = new RsRlzyJyjlWhPO();
        //从维护表中选择
        if (StringUtils.isNotBlank(userid)) {
            if (!isfb(dto.getRsrlzyjlxxlsh(),null)){
                HashMap<String, Object> qmap = new HashMap<>();
//                qmap.put("userid", userid);
                qmap.put("rsrlzyjyjllsh", dto.getZjlsh());
                Map<String, Object> qres = this.jlxxMapper.getJljyjl(qmap);
                if (qres != null) {
                    dybpo.setRsrlzyjlxxlsh(dto.getRsrlzyjlxxlsh());
                    dybpo.setTscjsj(dataString);//创建时间
                    jyjlWhMappper.insert(dybpo);
                } else {
                    throw new AppException("请确认参数输入是否有误");
                }
            }else{
                throw new AppException("该简历已发布，不可修改!");
            }

        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public void addpxjlnr(SelectJlxxDTO dto) {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        RsRlzyPxjlWhPO dybpo = new RsRlzyPxjlWhPO();
        //从维护表中选择
        if (StringUtils.isNotBlank(userid)) {
            if (!isfb(dto.getRsrlzyjlxxlsh(),null)){
                HashMap<String, Object> qmap = new HashMap<>();
//                qmap.put("userid", userid);
                qmap.put("rsrlzypxjllsh", dto.getZjlsh());
                Map<String, Object> qres = this.jlxxMapper.getJlpxjl(qmap);
                if (qres != null) {
                    dybpo.setTscjsj(dataString);//创建时间
                    pxjlWhMapper.insert(dybpo);
                } else {
                    throw new AppException("请确认参数输入是否有误");
                }
            }else {
                throw new AppException("该简历已发布，不可修改!");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public void addzyjnnr(SelectJlxxDTO dto) {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        RsRlzyZyjnWhPO dybpo = new RsRlzyZyjnWhPO();
        //从维护表中选择
        if (StringUtils.isNotBlank(userid)) {
            if (!isfb(dto.getRsrlzyjlxxlsh(),null)){
                HashMap<String, Object> qmap = new HashMap<>();
//                qmap.put("userid", userid);
                qmap.put("rsrlzyzyjnlsh", dto.getZjlsh());
                Map<String, Object> qres = this.jlxxMapper.getJlzyjn(qmap);
                if (qres != null) {
                    dybpo.setTscjsj(dataString);//创建时间
                    zyjnWhMapper.insert(dybpo);
                } else {
                    throw new AppException("请确认参数输入是否有误");
                }
            }else {
                throw new AppException("该简历已发布，不可修改!");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public void addshzsnr(SelectJlxxDTO dto) {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        RsRlzyShzsWhPO dybpo = new RsRlzyShzsWhPO();
        //从维护表中选择
        if (StringUtils.isNotBlank(userid)) {
            if (!isfb(dto.getRsrlzyjlxxlsh(),null)){
                HashMap<String, Object> qmap = new HashMap<>();
//                qmap.put("userid", userid);
                qmap.put("rsrlzyshzslsh", dto.getZjlsh());
                Map<String, Object> qres = this.jlxxMapper.getJlshzs(qmap);
                if (qres != null) {
                    dybpo.setTscjr(userid);//创建人
                    dybpo.setTscjsj(dataString);//创建时间
                    shzsWhMapper.insert(dybpo);
                } else {
                    throw new AppException("请确认参数输入是否有误");
                }
            }else {
                throw new AppException("该简历已发布，不可修改!");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public void addhjqknr(SelectJlxxDTO dto) {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        RsRlzyHjqkWhPO dybpo = new RsRlzyHjqkWhPO();
        //从维护表中选择
        if (StringUtils.isNotBlank(userid)) {
            if (!isfb(dto.getRsrlzyjlxxlsh(),null)){
                HashMap<String, Object> qmap = new HashMap<>();
//                qmap.put("userid", userid);
                qmap.put("rsrlzyhjqklsh", dto.getZjlsh());
                Map<String, Object> qres = this.jlxxMapper.getJlhjqk(qmap);
                if (qres != null) {
                    dybpo.setTscjr(userid);//创建人
                    dybpo.setTscjsj(dataString);//创建时间
                    hjqkWhMapper.insert(dybpo);
                } else {
                    throw new AppException("请确认参数输入是否有误");
                }
            }else {
                throw new AppException("该简历已发布，不可修改!");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public void addzcqknr(SelectJlxxDTO dto) {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        RsRlzyZcqkWhPO dybpo = new RsRlzyZcqkWhPO();
        //从维护表中选择
        if (StringUtils.isNotBlank(userid)) {
            if (!isfb(dto.getRsrlzyjlxxlsh(),null)){
                HashMap<String, Object> qmap = new HashMap<>();
//                qmap.put("userid", userid);
                qmap.put("rsrlzyzcqklsh", dto.getZjlsh());
                Map<String, Object> qres = this.jlxxMapper.getJlzcqk(qmap);
                if (qres != null) {
                    dybpo.setTscjsj(dataString);//创建时间
                    zcqkWhMapper.insert(dybpo);
                } else {
                    throw new AppException("请确认参数输入是否有误");
                }
            }else {
                throw new AppException("该简历已发布，不可修改!");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public int getGzgsNum() {
        QueryWrapper<GzgsPO> queryWrapper = new QueryWrapper();
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            queryWrapper.eq("ts_yxbz", "1");
            queryWrapper.eq("gsxszt", "1");
            return this.gzgsMapper.selectCount(queryWrapper);
        } else {
            throw new AppException("获取不到该用户信息");
        }

    }

    @Override
    public int getSczwNum() {
        QueryWrapper<GwxxPO> queryWrapper = new QueryWrapper();
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            queryWrapper.eq("gwzt", "1");
            return this.gwxxMapper.selectCount(queryWrapper);
        } else {
            throw new AppException("获取不到该用户信息");
        }

    }

    @Override
    public int getSqzwNum() {
        QueryWrapper<GwxxPO> queryWrapper = new QueryWrapper();
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            queryWrapper.eq("gwzt", "2");
            return this.gwxxMapper.selectCount(queryWrapper);
        } else {
            throw new AppException("获取不到该用户信息");
        }

    }

    @Override
    public void getSczw(GrqzSczwDTO dto) { //收藏职位
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            Date t = new Date();
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            QueryWrapper<GwxxPO> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("gwzt", "1");
            int count = this.gwxxMapper.selectCount(queryWrapper);
            if (count != 0) {
                throw new AppException("您已收藏过该职位!");
            } else {
                GwxxPO po = new GwxxPO();
                BeanUtils.copyProperties(dto, po);
                po.setTscjsj(df.format(t));
                this.gwxxMapper.insert(po);
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override //申请职位
    public void Sqzw(GrqzSczwDTO dto) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            Date t = new Date();
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            QueryWrapper<GwxxPO> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("gwzt", "2");
            int count = this.gwxxMapper.selectCount(queryWrapper);
            if (count != 0) {
                throw new AppException("您已投递过该职位,请勿重复投递");
            } else {
                QueryWrapper<JlxxPO> jlxxquery = new QueryWrapper<>();
                jlxxquery.eq("rs_yhlsh",userid).eq("RS_RLZY_JLXX",dto.getRsrlzyjlxxlsh())
                        .eq("ts_yxbz","1");
                JlxxPO jlxxPO = this.jlxxMapper.selectOne(jlxxquery);
                if (null == jlxxPO){
                    //throw new AppException("您当前未设置默认简历,无法进行求职操作!");
                    throw new AppException("您当前在湛江人社网上公共服务平台上不存在简历信息，请新建简历后再进行求职操作！");
                }
                if (!("1".equals(jlxxPO.getSftjnwsh())&&"1".equals(jlxxPO.getShjg()))){
                    throw new AppException("您的简历可能尚未提交审核或待审核,无法进行求职操作!");
                }
                if ("1".equals(jlxxPO.getGkcd())){
                    throw new AppException("您的简历暂未公开，无法进行求职操作!");
                }
                if (!("1".equals(jlxxPO.getFbzt()))){
                    throw new AppException("您当前的简历未发布,无法进行求职操作!");
                }
                GwxxPO po1 = new GwxxPO();
                po1.setRsrlzyzwxxlsh(dto.getRsrlzyzwxxlsh());
                po1.setRsyhlsh(userid);
                this.gwxxMapper.insert(po1);

                RsRlzyJlglPO po = new RsRlzyJlglPO();
                po.setTsCjr(userid);
                po.setTsCjsj(df.format(t));
                po.setZt("0");
                po.setRsrlzygwxxlsh(po1.getRsrlzygwxxlsh());
                this.jlglMapper.insert(po);
            }
        } else {
            throw new AppException("您当前处于未登录状态,请先登录才可进行此操作");
        }
    }

    @Override
    public void toGrspTjsh(DwTxSpQueryDTO dto) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            //保存信息并更新状态
            JlxxPO po = new JlxxPO();
            UpdateWrapper<JlxxPO> updateWrapper = new UpdateWrapper();
            po.setSptycclsh(dto.getTyccid());
            po.setSpshr("");
            po.setSpshjg("0");//将视频审核状态置为0，0为未审核，1为审核通过 2为未通过
            po.setSftjnwsh("1");////将状态置为已提交审核
            updateWrapper.eq("sfmrjl", "1");
            jlxxMapper.update(po, updateWrapper);
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public void toGrtxTjsh(DwTxSpQueryDTO dto) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            //保存信息并更新状态
            JlxxPO po = new JlxxPO();
            UpdateWrapper<JlxxPO> updateWrapper = new UpdateWrapper();
            po.setTxtycclsh(dto.getTyccid());
            po.setTxshr("");
            updateWrapper.eq("sfmrjl", "1");
            jlxxMapper.update(po, updateWrapper);
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override //获取默认简历流水号
    public JlxxPO getMrjllsh() {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            JlxxPO jlxxlsh = this.jlxxMapper.getMrjllsh(userid);
            return jlxxlsh;
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public JlxxPO getzxJlxx() {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            JlxxPO jlxxpo = this.jlxxMapper.getzxJlxx(userid);
            return jlxxpo;
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public Map getGrzxJljbxx(ZjQueryDTO dto1) {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            Map<String, Object> data = jlxxMapper.getGrzxJljbxx(userid,dto1.getZjlsh());
            return data;
        }else{
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public List<RsRlzyZwxxPO> getZwzntjList() {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            JlxxPO mrjllsh = this.jlxxMapper.getMrjllsh(userid);
        } 
        return this.zwxxMapper.getNoLoginZwzntj();
    }

    @Override
    public List<RsRlzyZwxxPO> getRgtjzw() {
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            return this.zwxxMapper.getRgtjzw(userid);
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public PageResult getMyJlxxlist(PageDTO dto) {
        QueryWrapper<JlxxPO> queryWrapper = new QueryWrapper<JlxxPO>();
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            Page<Map<String, Object>> page = new Page<>(dto.getPagenum(), dto.getPagesize());
            Page<Map<String, Object>> pageResult = (Page) jlxxMapper.getMyJlxxlist(page,userid);
            PageResult result = PageUtil.PageResult(pageResult);
            return result;
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public PageResult getMyJlxxMrlist(PageDTO dto) {
        QueryWrapper<JlxxPO> queryWrapper = new QueryWrapper<JlxxPO>();
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(userid)) {
            Page<Map<String, Object>> page = new Page<>(dto.getPagenum(), dto.getPagesize());
            Page<Map<String, Object>> pageResult = (Page) jlxxMapper.getMyJlxxMrlist(page, userid);
            PageResult result = PageUtil.PageResult(pageResult);
            return result;
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    public boolean isfb(String id) {
//        CurrentUser currentUser = getCurrentUser();
//        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
//        if (StringUtils.isNotBlank(userid)){
            int cnt = jlxxMapper.selectCount(new QueryWrapper<JlxxPO>()
                    .eq("rs_rlzy_jlxx", id)
                    .eq("fbzt", "1"));
            if (cnt > 0) {
                return true;
            } else {
                return false;
            }
//        } else {
//            throw new AppException("获取不到该用户信息");
//        }
    }

    public boolean isfb(String id, String userid) {
        if (userid == null) {
            return isfb(id);
        } else {
            int cnt = jlxxMapper.selectCount(new QueryWrapper<JlxxPO>().eq("rs_rlzy_jlxx", id)
                    .eq(StringUtils.isNotBlank(userid), "rs_yhlsh", userid));
            LOG.info(id + " " + userid + " ");
            if (cnt > 0) {
                return true;
            } else {
                return false;
            }
        }
    }

    @Override
    public void deleteMyJlxx(String id) {
        if (!isfb(id)) {
            if (StringUtils.isNotBlank(id)) {
                JlxxPO po = new JlxxPO();
                po.setTsyxbz("0");
            } else {
                throw new AppException("缺少主键参数");
            }
        } else {
            throw new AppException("该简历已发布，不能操作！");
        }

    }


    @Override
    public void updateMyJlmrzt(MrjlUDTO dto) {
        String jlssr = dto.getJlssr();
        JlxxPO po = new JlxxPO();
        po.setRsrlzyjlxxlsh(dto.getZjlsh());

        if (StringUtils.isBlank(jlssr)){
            CurrentUser currentUser = getCurrentUser();
            jlssr = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        }

        if (StringUtils.isNotBlank(jlssr)) {
            if ("1".equals(dto.getFlag())) {
                //先将之前默认的数据改为普通状态
                HashMap<String, Object> map = new HashMap<String, Object>();
                map.put("userid", jlssr);
                jlxxMapper.updateMrToWmr(map);


            } else if ("0".equals(dto.getFlag())) {
                //修改这条数据的默认简历状态
                po.setSfmrjl("0");
                jlxxMapper.updateById(po);
            } else {
                throw new AppException("状态参数取值有误");
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }


    @Override
    public void copyMyJlxx(CopyJlDTO dto) throws Exception {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        String jlssr = dto.getJlssr();
        if (StringUtils.isBlank(jlssr)){
            jlssr = userid;
        }

        if (StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(jlssr)) {
            //查询现在拥有简历个数
            int jltotalcnt = jlxxMapper.selectCount(new QueryWrapper<JlxxPO>()
                    .eq("ts_yxbz", "1")
                    .eq("sfjdjl","0"));
            if (jltotalcnt >= 10) {
                throw new AppException("简历个数不能超过10个！");
            }

            String rsrlzyjlxxlsh = dto.getZjlsh();

            JljbxxDTO jljbxxdto = new JljbxxDTO();
            jljbxxdto.setFlag("edit");
            jljbxxdto.setJlssr(jlssr);

            //查询简历信息v_rs_rlzy_jlxx
            Map<String, Object> jbxxmap = this.getJljbxx(jljbxxdto);
            if (jbxxmap == null) {
                return;
            }
            GrqzWdjlJbxxDTO jbxxdto = new GrqzWdjlJbxxDTO();
            org.apache.commons.beanutils.BeanUtils.populate(jbxxdto, jbxxmap);
            if (StringUtils.isNotBlank(jbxxdto.getRsrlzyjlxxlsh())) {
                //复制简历信息v_rs_rlzy_jlxx
                jbxxdto.setRsrlzyjlxxlsh("");//清空主键，以便新增
                //更改复制简历名称
                String jlmc = "";
                //复制的简历名始终是我的简历（数字递增）
                //查询数据库里面我的简历的最大数字
                int jlmccnt = jlxxMapper.selectCount(new QueryWrapper<JlxxPO>()
                        .eq("rs_yhlsh",jlssr)
                        .like("jlmc", "我的简历（%"));
                jbxxdto.setJlmc(jlmc);
                jbxxdto.setJlssr(dto.getJlssr());
                jbxxdto.setLy("fz");
                JlxxPO jlxxpo = this.saveJljbxx(jbxxdto);
                String newjlxxlsh = jlxxpo.getRsrlzyjlxxlsh() == null ? "" : jlxxpo.getRsrlzyjlxxlsh();

                if (StringUtils.isNotBlank(newjlxxlsh)) {
                    ZjQueryDTO zjquerydto = new ZjQueryDTO();
                    zjquerydto.setZjlsh(rsrlzyjlxxlsh);
                    zjquerydto.setFlag("edit");
                    //查询求职意向v_rs_rlzy_qzyx
                    Map<String, Object> qzyxmap = this.getJlqzyx(zjquerydto);
                    if (qzyxmap != null) {
                        //复制求职意向v_rs_rlzy_qzyx
                        //插入求职意向对应表v_rs_rlzy_qzyx_dyb
                        GrqzWdjlQzyxDTO qzyxdto = new GrqzWdjlQzyxDTO();
                        org.apache.commons.beanutils.BeanUtils.populate(qzyxdto, qzyxmap);
                        qzyxdto.setRsrlzyqzyxlsh("");//清空主键，以便新增
                        qzyxdto.setJlssr(jlssr);
                        qzyxdto.setLy("fz");
                        RsRlzyQzyxPO qzyxpo = this.saveJlqzyx(qzyxdto);
                    }

                    ZjDTO zjdto = new ZjDTO();
                    zjdto.setZjlsh(rsrlzyjlxxlsh);

                    //查询工作经验v_rs_rlzy_gzjy
                    List<RsRlzyGzjyPO> gzjypoList = gzjyMapper.getgzjypoList(zjdto);
                    if (gzjypoList != null) {
                        for (int i = 0; i < gzjypoList.size(); i++) {
                            RsRlzyGzjyPO po = gzjypoList.get(i);
                            RsRlzyGzjyWhPO gzjywhpo = new RsRlzyGzjyWhPO();
                            gzjywhpo.setTscjsj(dataString);
                            gzjyWhMapper.insert(gzjywhpo);
                        }
                    }

                    //查询教育经历v_rs_rlzy_jyjl
                    List<RsRlzyJyjlPO> jyjlpoList = jyjlMapper.getJyjlpoList(zjdto);
                    if (gzjypoList != null) {
                    }
                    for (int i = 0; i < jyjlpoList.size(); i++) {
                        RsRlzyJyjlPO po = jyjlpoList.get(i);
                        RsRlzyJyjlWhPO jyjlwhpo = new RsRlzyJyjlWhPO();
                        jyjlwhpo.setRsrlzyjlxxlsh(newjlxxlsh);
                        //插入教育经历对应表v_rs_rlzy_jyjl_dyb
                        jyjlWhMappper.insert(jyjlwhpo);
                    }


                    //查询培训经历v_rs_rlzy_pxjl
                    List<RsRlzyPxjlPO> pxjlpoList = pxjlMapper.getPxjlpoList(zjdto);
                    if (pxjlpoList != null) {
                        for (int i = 0; i < pxjlpoList.size(); i++) {
                            RsRlzyPxjlPO po = pxjlpoList.get(i);
                            RsRlzyPxjlWhPO pxjlwhpo = new RsRlzyPxjlWhPO();
                            pxjlwhpo.setRsrlzyjlxxlsh(newjlxxlsh);
                            pxjlwhpo.setTscjsj(dataString);
                            pxjlWhMapper.insert(pxjlwhpo);
                        }
                    }

                    //查询职业技能v_rs_rlzy_zyjn
                    List<RsRlzyZyjnPO> zyjnpoList = zyjnMapper.getZyjnpoList(zjdto);
                    if (zyjnpoList != null) {
                        for (int i = 0; i < zyjnpoList.size(); i++) {
                            RsRlzyZyjnPO po = zyjnpoList.get(i);
                            RsRlzyZyjnWhPO zyjnwhpo = new RsRlzyZyjnWhPO();
                            zyjnwhpo.setRsrlzyjlxxlsh(newjlxxlsh);
                            zyjnwhpo.setTscjsj(dataString);
                            zyjnWhMapper.insert(zyjnwhpo);
                        }
                    }


                    //查询职称情况v_rs_rlzy_zcqk
                    List<RsRlzyZcqkPO> zcqkpoList = zcqkMapper.getZcqkpoList(zjdto);
                    if (zcqkpoList != null) {
                        for (int i = 0; i < zcqkpoList.size(); i++) {
                            RsRlzyZcqkPO po = zcqkpoList.get(i);
                            RsRlzyZcqkWhPO zcqkwhpo = new RsRlzyZcqkWhPO();
                            zcqkwhpo.setRsrlzyjlxxlsh(newjlxxlsh);
                            zcqkwhpo.setTscjsj(dataString);
                            zcqkWhMapper.insert(zcqkwhpo);
                        }
                    }


                    //查询所获证书v_rs_rlzy_shzs
                    List<RsRlzyShzsPO> shzspoList = shzsMapper.getShzspoList(zjdto);
                    if (shzspoList != null) {
                        for (int i = 0; i < shzspoList.size(); i++) {
                            RsRlzyShzsPO po = shzspoList.get(i);
                            RsRlzyShzsWhPO shzwhpo = new RsRlzyShzsWhPO();
                            shzwhpo.setRsrlzyjlxxlsh(newjlxxlsh);
                            shzwhpo.setTscjsj(dataString);
                            shzsWhMapper.insert(shzwhpo);
                        }
                    }


                    //查询获奖情况v_rs_rlzy_hjqk
                    List<RsRlzyHjqkPO> hjqkpoList = hjqkMapper.getHjqkpoList(zjdto);
                    if (hjqkpoList != null) {
                        for (int i = 0; i < hjqkpoList.size(); i++) {
                            RsRlzyHjqkPO po = hjqkpoList.get(i);
                            RsRlzyHjqkWhPO hjqkwhpo = new RsRlzyHjqkWhPO();
                            hjqkwhpo.setTscjr(userid);
                            hjqkwhpo.setTscjsj(dataString);
                            hjqkWhMapper.insert(hjqkwhpo);
                        }
                    }
                }

            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public void exportMyJlxx(ExportJlDTO dto, HttpServletResponse res) throws IllegalAccessException, IOException, InvocationTargetException {
        String rsrlzyjlxxlsh = dto.getZjlsh();

        String jlssr = dto.getJlssr();
        JljbxxDTO jljbxxdto = new JljbxxDTO();
        jljbxxdto.setJlssr(jlssr);
        jljbxxdto.setZjlsh(rsrlzyjlxxlsh);
        jljbxxdto.setFlag("edit");

        InputStream inputStream = null;
        try {
            //查询简历信息v_rs_rlzy_jlxx
            Map<String, Object> jbxxmap = this.getJljbxx(jljbxxdto);
            JlxxPO jlxxpo = new JlxxPO();
            if (jbxxmap != null) {
                org.apache.commons.beanutils.BeanUtils.populate(jlxxpo, jbxxmap);
            }

            String id = jlxxpo.getTxtycclsh();
            byte[] fileByte = null;
            if(StringUtils.isNotEmpty(id)) {
                FileDTO fileDTO = new FileDTO();
                fileDTO.setBusiness("business1");
                fileDTO.setId(id);
                ResponseEntity<byte[]> filebyte = wjfwFeignClientBPO.getObject(fileDTO);
                fileByte = filebyte.getBody();
            } else {
                InputStream photo = this.getClass().getClassLoader()
                        .getResourceAsStream("templates" + File.separator + "rlzysc" + File.separator + "tx.png");
                fileByte = IOUtils.toByteArray(photo);
            }
            ZjQueryDTO zjquerydto = new ZjQueryDTO();
            zjquerydto.setZjlsh(rsrlzyjlxxlsh);
            zjquerydto.setFlag("edit");
            //查询求职意向v_rs_rlzy_qzyx
            Map<String, Object> qzyxmap = this.getJlqzyx(zjquerydto);
            RsRlzyQzyxPO qzyxpo = new RsRlzyQzyxPO();
            if (qzyxmap != null) {
                org.apache.commons.beanutils.BeanUtils.populate(qzyxpo, qzyxmap);
            }

            ExportJlxxBtDTO jlxxbtdto = new ExportJlxxBtDTO();

            ZjDTO zjdto = new ZjDTO();
            zjdto.setZjlsh(rsrlzyjlxxlsh);

            //查询工作经验v_rs_rlzy_gzjy
            List<RsRlzyGzjyPO> gzjypoList = gzjyMapper.getgzjypoList(zjdto);
            if (gzjypoList!=null && gzjypoList.size()<=0){
                jlxxbtdto.setGzjy("：无");
            }

            //查询教育经历v_rs_rlzy_jyjl
            List<RsRlzyJyjlPO> jyjlpoList = jyjlMapper.getJyjlpoList(zjdto);
            if (jyjlpoList!=null && jyjlpoList.size()<=0){
                jlxxbtdto.setJyjl("：无");
            }

            //查询培训经历v_rs_rlzy_pxjl
            List<RsRlzyPxjlPO> pxjlpoList = pxjlMapper.getPxjlpoList(zjdto);
            if (pxjlpoList!=null && pxjlpoList.size()<=0){
                jlxxbtdto.setPxjl("：无");
            }

            //查询所获证书v_rs_rlzy_shzs
            List<RsRlzyShzsPO> shzspoList = shzsMapper.getShzspoList(zjdto);
            if (shzspoList!=null && shzspoList.size()<=0){
                jlxxbtdto.setShzs("：无");
            }

            //查询获奖情况v_rs_rlzy_hjqk
            List<RsRlzyHjqkPO> hjqkpoList = hjqkMapper.getHjqkpoList(zjdto);
            if (hjqkpoList!=null && hjqkpoList.size()<=0){
                jlxxbtdto.setHjqk("：无");
            }

            inputStream = this.getClass().getClassLoader()
                    .getResourceAsStream("templates" + File.separator + "rlzysc" + File.separator + "jlxx.docx");
            
        } catch (Exception e) {
            throw e;
        } finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    @Override
    public Map getJlxx(JltotalDTO dto) {
        Map<String, Object> res = new HashMap<>();

        String rsrlzyjlxxlsh = dto.getZjlsh() == null ? "" : dto.getZjlsh();
        String jlssr = dto.getJlssr();

        ZjQueryDTO zjquerydto = new ZjQueryDTO();
        zjquerydto.setZjlsh(rsrlzyjlxxlsh);
        zjquerydto.setFlag("edit");

        ZjDTO zjdto = new ZjDTO();
        zjdto.setZjlsh(rsrlzyjlxxlsh);

        JljbxxDTO jljbxxdto = new JljbxxDTO();
        jljbxxdto.setJlssr(jlssr);

        //查询简历信息v_rs_rlzy_jlxx
        Map<String, Object> jbxxmap = this.getJljbxx(jljbxxdto);
        if (jbxxmap != null) {
            res.putAll(jbxxmap);
        }

        if (StringUtils.isNotBlank(rsrlzyjlxxlsh)) {
            //查询求职意向v_rs_rlzy_qzyx
            Map<String, Object> qzyxmap = this.getJlqzyx(zjquerydto);
            if (qzyxmap != null) {
                res.putAll(qzyxmap);
            }

            //查询工作经验v_rs_rlzy_gzjy
            List<RsRlzyGzjyPO> gzjypoList = gzjyMapper.getgzjypoList(zjdto);
            if (gzjypoList != null) {
                res.put("gzjy", gzjypoList);
            }

            //查询职业技能v_rs_rlzy_zyjn
            List<RsRlzyZyjnPO> zyjnpoList = zyjnMapper.getZyjnpoList(zjdto);
            if (zyjnpoList != null) {
                res.put("zyjn", zyjnpoList);
            }

            //查询职称情况v_rs_rlzy_zcqk
            List<RsRlzyZcqkPO> zcqkpoList = zcqkMapper.getZcqkpoList(zjdto);
            if (zcqkpoList != null) {
                res.put("zcqk", zcqkpoList);
            }
        }
        return res;
    }

    @Override
    public JlxxPO saveJljbxx(GrqzWdjlJbxxDTO dto) {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        String fbzt = "0";//发布状态设置为未发布
        String shjg = "0";//审核结果置为未审核
        String sftjnwsh= "0";//是否提交审核置为未提交

        String jlssr = dto.getJlssr();
        String ly = dto.getLy() == null ? "" : dto.getLy();
        if (StringUtils.isBlank(jlssr)){
            jlssr = userid;
        } else {
                sftjnwsh= "1";//是否提交审核置为已提交
        }
        String rsrlzyjlxxlsh = dto.getRsrlzyjlxxlsh();

        if (StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(jlssr)) {
            JlxxPO po = new JlxxPO();
            BeanUtils.copyProperties(dto, po);
            po.setTsxgr(userid);//修改人
            po.setTsxgsj(dataString);//修改时间

            if (StringUtils.isNotBlank(dto.getRsrlzyjlxxlsh())) {
                if (!isfb(dto.getRsrlzyjlxxlsh(), null)) {
                    //修改
                    //提交审核，审核通过，已发布的简历仍然可以直接修改
                    po.setFbzt("0");
                    //更新数据
                    jlxxMapper.updateById(po);
                } else {
                    throw new AppException("该简历已发布，不允许修改！");
                }
            } else {
                LOG.info("新增个人简历信息.................." + userid);
                //新增
                //查询现在拥有简历个数
                int jltotalcnt = jlxxMapper.selectCount(new QueryWrapper<JlxxPO>()
                        .eq("ts_yxbz", "1")
                        .eq("sfjdjl","0")
                        .eq("rs_yhlsh", jlssr));
                if (jltotalcnt >= 10) {
                    throw new AppException("简历个数不能超过10个！");
                }
                //从登录信息里面取出个人姓名
                HashMap<String, Object> qmap = new HashMap<String, Object>();
                qmap.put("userid", jlssr);
                Map<String, Object> rmap = jlxxMapper.getGrXm(qmap);
                String xm = rmap == null ? "" : (rmap.get("xm") == null ? "" : (String) rmap.get("xm"));
                po.setXm(xm);
                po.setShjg(shjg);//设置审核结果为未审核
                jlxxMapper.insert(po);
                rsrlzyjlxxlsh = po.getRsrlzyjlxxlsh();
            }

            if (StringUtils.isNotBlank(dto.getJlssr())){
                if (!"fz".equals(ly)){
                    //如果由内网新增或修改，则直接审核通过，且基本信息回写
                    ShUDTO shudto = new ShUDTO();
                    shudto.setShjg("1");
                    jbxxglFeignClientBPO.doGrqzxxsh(shudto);
                }
            }


            if (StringUtils.isNotBlank(dto.getIsfbzt()) && "1".equals(dto.getIsfbzt())){
                JlxxPO newpo = new JlxxPO();
                newpo.setFbzt("1");
                jlxxMapper.update(newpo,new UpdateWrapper<JlxxPO>().eq("RS_RLZY_JLXX",rsrlzyjlxxlsh));

            }
            JlxxPO newpo2 = jlxxMapper.selectOne(new QueryWrapper<JlxxPO>().eq("RS_RLZY_JLXX",rsrlzyjlxxlsh));
            return newpo2;
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    @Transactional( rollbackFor = Exception.class)
    public JlxxPO saveJljbxx(GrJlxxDTO dto) {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        LOG.info("新增个人简单简历信息并申请职位.................." + userid);
        JlxxPO po = new JlxxPO();
        po.setTsxgr(userid);
        po.setTsxgsj(dataString);
        BeanUtils.copyProperties(dto,po);
        if (StringUtils.isNotBlank(po.getRsrlzyjlxxlsh())) { //更新
            UpdateWrapper<JlxxPO> updateWrapper = new UpdateWrapper<>();
            updateWrapper.eq("RS_RLZY_JLXX",po.getRsrlzyjlxxlsh());
            jlxxMapper.update(po,updateWrapper);
        } else { //新增
            po.setXm(dto.getAac003());
            po.setGkcd("2");//设置公开程度
            po.setSfjdjl("1");//设为简单简历
            jlxxMapper.insert(po);

            //插入求职意向表
            RsRlzyQzyxPO rsRlzyQzyxPO = new RsRlzyQzyxPO();
            rsRlzyQzyxPO.setRsyhlsh(userid);
            rsRlzyQzyxPO.setTscjr(userid);
            rsRlzyQzyxPO.setTscjsj(dataString);

            qzyxMapper.insert(rsRlzyQzyxPO);

            //插入求职意向对应表
            RsRlzyQzyxWhPO rsRlzyQzyxWhPO = new RsRlzyQzyxWhPO();

            rsRlzyQzyxWhPO.setRsrlzyjlxxlsh(po.getRsrlzyjlxxlsh());
            rsRlzyQzyxWhMapper.insert(rsRlzyQzyxWhPO);
        }

        //申请职位
        GrqzSczwDTO grqzSczwDTO = new GrqzSczwDTO();
        BeanUtils.copyProperties(dto,grqzSczwDTO);
        grqzSczwDTO.setRsrlzyjlxxlsh(po.getRsrlzyjlxxlsh());
        Sqzw(grqzSczwDTO);

        return po;
    }

    @Override
    public Map getJljbxx(JljbxxDTO dto) {
        Map<String, Object> res = new HashMap<>();
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        if (StringUtils.isNotBlank(dto.getFlag()) && dto.getFlag().equals("jdjlQuery")) {
            Map<String, Object> jdjlMap = jlxxMapper.getJdjlxx(userid);
            if (jdjlMap != null) {
                res.putAll(jdjlMap);
                return res;
            }
        }
        String jlssr = dto.getJlssr();
        if (StringUtils.isBlank(jlssr)){
            if(StringUtils.isNotBlank(dto.getZjlsh())) {
                QueryWrapper<JlxxPO> queryWrapper = new QueryWrapper<>();
                queryWrapper.eq("rs_rlzy_jlxx",  dto.getZjlsh());
                JlxxPO jlxx = jlxxMapper.selectOne(queryWrapper);
                jlssr = jlxx.getRsyhlsh();
            } else {
                jlssr = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
            }
        }

        if (StringUtils.isNotBlank(jlssr)) {
            if (StringUtils.isNotBlank(dto.getZjlsh())) {
                //查询简历信息，如果简历审核状态为未审核，则取备份的管理信息
                HashMap<String, Object> qmap = new HashMap<>();
                qmap.put("userid", jlssr);
                Map<String, Object> qres = jlxxMapper.getJljbxx(qmap);
                if (qres!=null){
                    if ("0".equals(qres.get("shjg"))){
                        qres = jlxxMapper.getJljbxxAndJbxx(qmap);
                        if (qres != null) {
                            res.putAll(qres);
                        }
                    } else {
                        res.putAll(qres);
                        //获取基本信息管理中的个人基本信息
                        Map<String, Object> data = jlxxMapper.getJbxxglGrjbxx(jlssr);
                        if (data != null) {
                            res.putAll(data);
                        }
                    }
                }
            } else {
                //如果没有该简历信息，取最新基本管理信息
                //获取基本信息管理中的个人基本信息
                Map<String, Object> data = jlxxMapper.getJbxxglGrjbxx(jlssr);
                if (data != null) {
                    res.putAll(data);
                }
            }
        } else {
            throw new AppException("获取不到该用户信息");
        }
        return res;
    }

    @Override
    public Map getJljbxxForDw(ZjQueryDTO dto) {
        //给企业用户查看简历使用，单位只能查询发布的简历，不涉及基本信息备份的事情
        //获取单位用户的id,用来查询该单位是否邀请该简历用户面试
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

        Map<String, Object> res = new HashMap<>();
        if ("edit".equals(dto.getFlag()) || "view".equals(dto.getFlag())){
            if (StringUtils.isNotBlank(dto.getZjlsh())){
                //根据简历流水号直接查询简历信息
                HashMap<String, Object> qmap = new HashMap<>();
                qmap.put("rsrlzyjlxxlsh", dto.getZjlsh());
                Map<String, Object> qres = jlxxMapper.getJljbxxForDw(qmap);
                if (qres != null) {
                    res.putAll(qres);
                    String rsyhlsh = qres.get("rsyhlsh") == null ? "" : (String) qres.get("rsyhlsh");
                    if (StringUtils.isNotBlank(rsyhlsh)){
                        //获取基本信息管理中的个人基本信息
                        Map<String, Object> data = jlxxMapper.getJbxxglGrjbxx(rsyhlsh);
                        if (data != null) {
                            res.putAll(data);
                        }
                    }
                }

                String zjhm = (String) res.get("aac147");

                String yx = (String) res.get("yx");
                if (StringUtils.isNotBlank(yx)){
//                    res.put("yx", RlzyscUtils.str2SercurityStr(yx, 2,0));
                }

                String aac006 = String.valueOf(res.get("aac006"));
                if (StringUtils.isNotBlank(aac006)){
                    res.put("aac006", RlzyscUtils.str2SercurityStr(aac006, 2,1));
                }

                //判断是否邀请面试
                HashMap<String, Object> map = new HashMap<>();
                map.put("rsrlzyjlxxlsh", dto.getZjlsh());
                Integer mszt = jlxxMapper.getJlAndDwMszt(map);

                if (!(mszt!=null&&mszt>0)){
                    //则被该单位邀请面试，简历联系方式需要做处理
                    String sjhm = (String) res.get("sjhm");
//                    if (StringUtils.isNotBlank(sjhm)){
//                        res.put("sjhm",sjhm.replaceAll("(\\d{3})\\d{8}","$1*********"));
//                    }
                }
            } else {
                throw new AppException("缺少主键参数");
            }
        }
        return res;
    }

    @Override
    public RsRlzyQzyxPO saveJlqzyx(GrqzWdjlQzyxDTO dto) {
        LOG.info("求职意向保存开始................");
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataString = dateFormat.format(date);
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        String fbzt = "0";
        String shjg = "0";
        String sftjnwsh = "0";

        String jlssr = dto.getJlssr();
        String ly = dto.getLy() == null ? "" : dto.getLy();
        if (StringUtils.isBlank(jlssr)){
            jlssr = userid;
        } else {
            if (!"fz".equals(ly)){
                fbzt = "0";
                shjg = "1";
            }
            sftjnwsh = "1";
        }

        if (StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(jlssr)) {
            RsRlzyQzyxPO po = new RsRlzyQzyxPO();
            BeanUtils.copyProperties(dto, po);

            po.setTsxgr(userid);//修改人
            po.setTsxgsj(dataString);//修改时间
            if (StringUtils.isNotBlank(dto.getRsrlzyqzyxlsh())) {
                if (!isfb(dto.getRsrlzyjlxxlsh(), null)) {
                    //修改
                    //提交审核，审核通过，已发布的简历仍然可以直接修改
                    //需要通过对应表查出简历主表，更新主表的提交审核状态，审核结果，发布状态
                    //查出求职意向表，更新求职意向表数据
                    HashMap<String, Object> qmap = new HashMap<>();
                    qmap.put("userid", jlssr);
                    qmap.put("rsrlzyjlxxlsh", dto.getRsrlzyjlxxlsh());
                    Map<String, Object> qres = jlxxMapper.getjlyxbydyb(qmap);
                    if (qres != null) {
                        String rsrlzyjlxxlsh = qres.get("rsrlzyjlxxlsh") == null ? "" : (String) qres.get("rsrlzyjlxxlsh");
                        String rsrlzyqzyxlsh = qres.get("rsrlzyqzyxlsh") == null ? "" : (String) qres.get("rsrlzyqzyxlsh");
                        if (StringUtils.isNotBlank(rsrlzyjlxxlsh) && StringUtils.isNotBlank(rsrlzyqzyxlsh)) {
                            //更新简历主表的提交审核状态，审核结果，发布状态
                            JlxxPO jlxxpo = new JlxxPO();
                            LOG.info("求职意向保存开始................" + fbzt);
                            jlxxpo.setFbzt(fbzt);
                            jlxxMapper.updateById(jlxxpo);
                            //更新求职意向表数据
                            po.setRsrlzyqzyxlsh(rsrlzyqzyxlsh);
                            qzyxMapper.updateById(po);
                        }
                    }
                } else {
                    throw new AppException("该简历已发布，不允许修改！");
                }
            } else {
                //新增
                //插入求职意向表数据
                po.setTscjr(userid);//创建人
                qzyxMapper.insert(po);
                //插入对应表数据
                String rsrlzyqzyxlsh = po.getRsrlzyqzyxlsh();
                RsRlzyQzyxWhPO dybpo = new RsRlzyQzyxWhPO();
                dybpo.setTscjr(userid);//创建人
                dybpo.setTscjsj(dataString);//创建时间
                rsRlzyQzyxWhMapper.insert(dybpo);
            }
            return po;
        } else {
            throw new AppException("获取不到该用户信息");
        }
    }

    @Override
    public Map getJlqzyx(ZjQueryDTO dto) {
//        CurrentUser currentUser = getCurrentUser();
//        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();

//        if (StringUtils.isNotBlank(userid)) {
            Map<String, Object> res = new HashMap<>();
            if ("edit".equals(dto.getFlag()) || "view".equals(dto.getFlag())) {
                if (StringUtils.isNotBlank(dto.getZjlsh())) {
                    HashMap<String, Object> qmap = new HashMap<>();
//                    qmap.put("userid", userid);
                    qmap.put("rsrlzyjlxxlsh", dto.getZjlsh());
                    Map<String, Object> qres = jlxxMapper.getJlqzyx(qmap);
                    if (qres != null) {
                        res.putAll(qres);
                    }
                } else {
                    throw new AppException("缺少主键参数");
                }
            }
            return res;
//        } else {
//            throw new AppException("获取不到该用户信息");
//        }
    }

    @Override
    public Map getJlqzyxForDw(ZjQueryDTO dto) {
        Map<String, Object> res = new HashMap<>();
        if ("edit".equals(dto.getFlag()) || "view".equals(dto.getFlag())){
            if (StringUtils.isNotBlank(dto.getZjlsh())){
                HashMap<String, Object> qmap = new HashMap<>();
                Map<String, Object> qres = jlxxMapper.getJlqzyxForDw(qmap);
                if (qres != null) {
                    res.putAll(qres);
                }
            }
        }
        return res;
    }

    @Override
    public void updateFbzt(ZjUDTO dto) {
        //校验要发布的简历是否审核通过
        CurrentUser currentUser = getCurrentUser();
        String userid = currentUser.getUsername() == null ? "" : currentUser.getUsername().trim();
        int cnt = jlxxMapper.selectCount(new QueryWrapper<JlxxPO>()
                .eq("rs_rlzy_jlxx", dto.getZjlsh())
                .eq("rs_rg_jbxx_jlzt", "1"));
        if (cnt > 0) {
            JlxxPO po = new JlxxPO();
            if ("1".equals(dto.getFlag())) {
                po.setFbzt("1");
            } else if ("0".equals(dto.getFlag())) {
                po.setFbzt("0");
            } else {
                throw new AppException("状态参数取值有误");
            }
            Date date = new Date();
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String dataString = dateFormat.format(date);
            po.setTsxgr(userid);//修改人
            jlxxMapper.updateById(po);
        } else {
            throw new AppException("该简历未审核通过，不能操作！");
        }
    }

    @Override
    public void toNwsh(ZjDTO dto) {
        //提交审核时应校验求职意向,基本信息不能为空
        HashMap map = new HashMap();
        map.put("rsrlzyjlxxlsh", dto.getZjlsh());
        int cnt = jlxxMapper.ajaxJltjsh(map);
        if (cnt > 0) {
            JlxxPO po = new JlxxPO();
            po.setShjg("0");
            jlxxMapper.updateById(po);
        } else {
            throw new AppException("请完善个人基本信息与求职意向后再提交审核！");
        }
    }
}



