Exemplo n.º 1
0
  /** @param 从业人员信息(t_cyryxx) 注销 */
  public boolean updateQyryxxZx(Qyryxx qyryxx) throws Exception {
    // TODO Auto-generated method stub
    boolean isSuccess = false;
    Date currentDate = new Date();
    // 保存人员历史信息
    Qyryxx_lsxx qyryxx_lsxx = new Qyryxx_lsxx();
    Qyryxx qyryxx_bak = new Qyryxx();
    Wgcyryxx wgcyryxx_bak = new Wgcyryxx();
    qyryxx_bak.setRyid(qyryxx.getRyid());
    wgcyryxx_bak.setRyid(qyryxx.getRyid());
    qyryxx_bak = qyryxxDao.getQyryxx(qyryxx_bak);
    wgcyryxx_bak = wgcyryxxDao.getWgcyryxx(wgcyryxx_bak);
    if (qyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, qyryxx_bak);
    if (wgcyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, wgcyryxx_bak);
    qyryxx_lsxx.setCzlx("注销");
    qyryxx_lsxxDao.insertQyryxx_lsxx(qyryxx_lsxx);
    // 修改从业人员信息
    qyryxx.setZxbz("1");
    qyryxx.setZxsj(currentDate);
    qyryxx.setCyryzt("离职");
    qyryxxDao.updateQyryxx(qyryxx);

    // 人员信息操作日志
    Qyjbxx qyjbxx = new Qyjbxx();
    qyjbxx.setQyid(qyryxx.getQyid());
    qyjbxx = qyjbxxDao.getQyjbxx(qyjbxx);
    Ryxxczrz ryxxczrz = new Ryxxczrz();
    ryxxczrz.setCzsj(currentDate);
    ryxxczrz.setCzlx("注销");
    ryxxczrz.setCzr(qyryxx.getZxr());
    ryxxczrz.setQybm(qyjbxx.getQybm());
    ryxxczrz.setCyrybh(qyryxx.getCyrybh());
    ryxxczrzDao.insertRyxxczrz(ryxxczrz);

    // 更新场所总人数
    // if(!cyryxx_bak.getCsid().equals(cyryxx.getCsid()))
    // {
    Map map = new HashMap();
    map.put("p_oldQyid", qyryxx_bak.getQyid());
    map.put("p_newQyid", 0);
    qyZrsProcDao.updateQyzrs(map);
    // }

    //// 注销员工用户
    int errResult = 0;
    if (sczhFlag(qyryxx_bak.getHylbdm(), qyryxx_bak.getGwbh()).equals("1")) {
      if (getUser(qyryxx_bak.getCyrybh()).equals("1")) {
        GgQyyh qyyh = new GgQyyh();
        qyyh.setRyid(qyryxx.getRyid());
        qyyh.setIsval("0"); // 是否可见
        errResult = ggQyyhDao.zhuxQyYgyh(qyyh);
      }
    }

    if (errResult == 1) {
      return false;
    }
    isSuccess = true;
    return isSuccess;
  }
Exemplo n.º 2
0
  /** @param 企业人员信息(t_qyryxx) 删除 */
  public boolean deleteQyryxx(Qyryxx qyryxx) throws Exception {
    // TODO: implement
    boolean isSuccess = false;
    Date currentDate = new Date();
    // 保存人员历史信息
    Qyryxx_lsxx qyryxx_lsxx = new Qyryxx_lsxx();
    Qyryxx qyryxx_bak = new Qyryxx();
    Wgcyryxx wgcyryxx_bak = new Wgcyryxx();
    qyryxx_bak.setRyid(qyryxx.getRyid());
    qyryxx_bak = qyryxxDao.getQyryxx(qyryxx_bak);
    wgcyryxx_bak.setRyid(qyryxx.getRyid());
    wgcyryxx_bak = wgcyryxxDao.getWgcyryxx(wgcyryxx_bak);
    if (qyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, qyryxx_bak);
    if (wgcyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, wgcyryxx_bak);
    qyryxx_lsxx.setCzlx("删除");
    qyryxx_lsxxDao.insertQyryxx_lsxx(qyryxx_lsxx);

    // 修改从业人员信息表
    qyryxx.setScbz(1);
    qyryxx.setZxsj(currentDate);
    qyryxx.setZxr(qyryxx.getCzr());
    qyryxxDao.updateQyryxx(qyryxx);

    // 更新场所总人数
    Map map = new HashMap();
    map.put("p_oldQyid", qyryxx_bak.getQyid());
    map.put("p_newQyid", 0);
    qyZrsProcDao.updateQyzrs(map);

    // 人员信息操作日志
    Qyjbxx qyjbxx = new Qyjbxx();
    qyjbxx.setQyid(qyryxx_bak.getQyid());
    qyjbxx = qyjbxxDao.getQyjbxx(qyjbxx);
    Ryxxczrz ryxxczrz = new Ryxxczrz();
    ryxxczrz.setCzsj(currentDate);
    ryxxczrz.setCzlx("删除");
    ryxxczrz.setCzr(qyryxx.getZxr());
    ryxxczrz.setQybm(qyjbxx.getQybm());
    ryxxczrz.setCyrybh(qyryxx_bak.getCyrybh());
    ryxxczrzDao.insertRyxxczrz(ryxxczrz);

    int errCode = 0;

    // 删除员工用户
    if (sczhFlag(qyryxx_bak.getHylbdm(), qyryxx_bak.getGwbh()).equals("1")) {
      if (getUser(qyryxx_bak.getCyrybh()).equals("1")) {
        GgQyyh qyyh = new GgQyyh();
        qyyh.setRyid(qyryxx_bak.getRyid());
        errCode = ggQyyhDao.delQyYgyh(qyyh); // 删除员工用户
      }
    }

    if (errCode == 1) return false;

    return isSuccess;
  }
Exemplo n.º 3
0
  public boolean makeCyryxxLizhiByqyZx(Qyjbxx qyjbxx) throws Exception {
    // TODO Auto-generated method stub

    Qyryxx qyryxx = new Qyryxx();
    qyryxx.setQyid(qyjbxx.getQyid());
    List rylist = qyryxxDao.getMakeRyLzList(qyryxx);

    if (rylist != null && rylist.size() > 0) {
      // 更新企业下的员工离职状态和离职时间
      qyryxx.setLzrq(new Date());
      qyryxx.setCyryztdm("20");
      qyryxx.setCyryzt("离职");
      qyryxxDao.updateQyryxxLzByqyzxGg(qyryxx);
      Qyryxx_lsxx qyryxx_lsxx = new Qyryxx_lsxx();
      Qyryxx qyryxxbak = new Qyryxx();
      int errResult = 0;
      for (int i = 0; i < rylist.size(); i++) {
        qyryxxbak = (Qyryxx) rylist.get(i);
        if (qyryxxbak != null) {
          BeanUtils.copyProperties(qyryxx_lsxx, qyryxxbak);
        }
        qyryxx_lsxx.setCzlx("公司注销员工离职");
        qyryxx_lsxxDao.insertQyryxx_lsxx(qyryxx_lsxx);
        // 操作日志
        Ryxxczrz ryxxczrz = new Ryxxczrz();
        ryxxczrz.setCzsj(new Date());
        ryxxczrz.setCzlx("公司注销员工离职");

        ryxxczrz.setCzr(qyjbxx.getCzr());
        ryxxczrz.setCyrybh(qyryxxbak.getCyrybh());
        ryxxczrz.setQybm(qyjbxx.getQybm());
        ryxxczrzDao.insertRyxxczrz(ryxxczrz);
        // 注销员工用户

        if (sczhFlag(qyryxxbak.getHylbdm(), qyryxxbak.getGwbh()).equals("1")) {
          if (getUser(qyryxxbak.getCyrybh()).equals("1")) {
            GgQyyh qyyh = new GgQyyh();
            qyyh.setRyid(qyryxxbak.getRyid());
            qyyh.setIsval("0"); // 是否可见
            errResult = ggQyyhDao.zhuxQyYgyh(qyyh);
            if (errResult == 1) {
              return false;
            }
          }
        }
      }
    }
    return true;
  }
Exemplo n.º 4
0
  // 更新账号
  public String updateUser(Qyryxx qyryxx, Qyryxx qyryxx_bak) throws Exception {

    int errCode = 0;
    // 更新账号
    if (sczhFlag(qyryxx_bak.getHylbdm(), qyryxx_bak.getGwbh()).equals("1")) {
      if (getUser(qyryxx_bak.getCyrybh()).equals("1")) {
        // 如果旧的有账号,
        if (sczhFlag(qyryxx.getHylbdm(), qyryxx.getGwbh()).equals("1")) {
          // 新的也要生成账号,则更新

          GgQyyh qyyh = new GgQyyh();
          qyyh.setRyid(qyryxx.getRyid());
          errCode = ggQyyhDao.updateQyYgyh(qyyh);
          if (errCode == 1) {
            return "1";
          }
        } else {
          // 新的不生成账号,则删除账号

          GgQyyh qyyh = new GgQyyh();
          qyyh.setRyid(qyryxx.getRyid());
          errCode = ggQyyhDao.delQyYgyh(qyyh); // 删除员工用户
          if (errCode == 1) {
            return "1";
          }
        }
      }
    } else {
      // 如果旧的没有账号,

      if (sczhFlag(qyryxx.getHylbdm(), qyryxx.getGwbh()).equals("1")) {
        // 新的要生成账号

        if ("1".equals(queryQjbl(qyryxx.getHylbdm() + "tbsczh"))) { // 同步生成账号
          GgQyyh qyyh = new GgQyyh();
          qyyh.setRyid(qyryxx.getRyid());
          errCode = ggQyyhDao.insertQyYgyh(qyyh);
          if (errCode == 1) {
            return "1";
          }
        }
      }
    }

    return "0";
  }
Exemplo n.º 5
0
  /** @param 从业人员信息(t_cyryxx) 修改 公用服务 */
  public boolean updateQyryxxCommon(Qyryxx qyryxx) throws Exception {
    // TODO Auto-generated method stub
    boolean isSuccess = false;
    Date currentDate = new Date();
    // 保存人员历史信息
    Qyryxx_lsxx qyryxx_lsxx = new Qyryxx_lsxx();
    Qyryxx qyryxx_bak = new Qyryxx();
    Wgcyryxx wgcyryxx_bak = new Wgcyryxx();
    qyryxx_bak.setRyid(qyryxx.getRyid());
    wgcyryxx_bak.setRyid(qyryxx.getRyid());
    qyryxx_bak = qyryxxDao.getQyryxx(qyryxx_bak);
    wgcyryxx_bak = wgcyryxxDao.getWgcyryxx(wgcyryxx_bak);
    if (qyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, qyryxx_bak);
    if (wgcyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, wgcyryxx_bak);
    qyryxx_lsxx.setCzlx(qyryxx.getCzlx());
    qyryxx_lsxxDao.insertQyryxx_lsxx(qyryxx_lsxx);
    // 修改从业人员信息
    qyryxxDao.updateQyryxx(qyryxx);
    // 更新账号
    String errCode = "0";
    errCode = updateUser(qyryxx, qyryxx_bak);
    if (errCode.equals("1")) return false;

    // 人员信息操作日志
    Qyjbxx qyjbxx = new Qyjbxx();
    Qyryxx qyryxxTemp = new Qyryxx();
    qyryxxTemp.setRyid(qyryxx.getRyid());
    qyryxxTemp = qyryxxDao.getQyryxx(qyryxxTemp);
    qyjbxx.setQyid(qyryxxTemp.getQyid());
    qyjbxx = qyjbxxDao.getQyjbxx(qyjbxx);
    Ryxxczrz ryxxczrz = new Ryxxczrz();
    ryxxczrz.setCzsj(currentDate);
    ryxxczrz.setCzlx(qyryxx.getCzlx());
    ryxxczrz.setCzr(qyryxx.getCzr());
    ryxxczrz.setQybm(qyjbxx.getQybm());
    ryxxczrz.setCyrybh(qyryxxTemp.getCyrybh());
    ryxxczrzDao.insertRyxxczrz(ryxxczrz);

    isSuccess = true;
    return isSuccess;
  }
Exemplo n.º 6
0
  /**
   * @author mds 其他人请不要修改此方法,或在修改之前通知我!! 公用方法 修改主表 不包含修改所属企业,不能修改人员姓名
   * @throws InvocationTargetException
   * @throws IllegalAccessException
   */
  public boolean updateQyryxxOnly(Qyryxx qyryxx) throws Exception {
    boolean isSuccess = false;
    Date currentDate = new Date();
    // 保存人员历史信息
    Qyryxx_lsxx qyryxx_lsxx = new Qyryxx_lsxx();
    Qyryxx qyryxx_bak = new Qyryxx();
    Wgcyryxx wgcyryxx_bak = new Wgcyryxx();
    qyryxx_bak.setRyid(qyryxx.getRyid());
    wgcyryxx_bak.setRyid(qyryxx.getRyid());
    qyryxx_bak = qyryxxDao.getQyryxx(qyryxx_bak);
    wgcyryxx_bak = wgcyryxxDao.getWgcyryxx(wgcyryxx_bak);
    if (qyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, qyryxx_bak);
    if (wgcyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, wgcyryxx_bak);
    qyryxx_lsxx.setCzlx(qyryxx.getCzlx());
    qyryxx_lsxxDao.insertQyryxx_lsxx(qyryxx_lsxx);
    // 修改从业人员信息
    qyryxx.setBcsj(currentDate);
    qyryxxDao.updateQyryxx(qyryxx);

    // 人员信息操作日志
    Qyjbxx qyjbxx = new Qyjbxx();
    Qyryxx qyryxxTemp = new Qyryxx();
    qyryxxTemp.setRyid(qyryxx.getRyid());
    qyryxxTemp = qyryxxDao.getQyryxx(qyryxxTemp);
    qyjbxx.setQyid(qyryxxTemp.getQyid());
    qyjbxx = qyjbxxDao.getQyjbxx(qyjbxx);
    Ryxxczrz ryxxczrz = new Ryxxczrz();
    ryxxczrz.setCzsj(currentDate);
    ryxxczrz.setCzlx(qyryxx.getCzlx());
    ryxxczrz.setCzr(qyryxx.getCzr());
    ryxxczrz.setQybm(qyjbxx.getQybm());
    ryxxczrz.setCyrybh(qyryxxTemp.getCyrybh());
    ryxxczrzDao.insertRyxxczrz(ryxxczrz);

    isSuccess = true;
    return isSuccess;
  }
Exemplo n.º 7
0
  /** @param 企业人员信息(t_qyryxx) 修改 */
  public boolean updateQyryxx(Qyryxx qyryxx) throws Exception {
    //	qyryxx.setQyid(2);
    // TODO: implement
    boolean isSuccess = false;
    Date currentDate = new Date();
    Qyry_zp qyry_zp = new Qyry_zp();
    Wgcyryxx wgcyryxx = new Wgcyryxx();

    // 保存人员历史信息
    Qyryxx_lsxx qyryxx_lsxx = new Qyryxx_lsxx();
    Qyryxx qyryxx_bak = new Qyryxx();
    Wgcyryxx wgcyryxx_bak = new Wgcyryxx();
    qyryxx_bak.setRyid(qyryxx.getRyid());
    wgcyryxx_bak.setRyid(qyryxx.getRyid());
    qyryxx_bak = qyryxxDao.getQyryxx(qyryxx_bak);
    wgcyryxx_bak = wgcyryxxDao.getWgcyryxx(wgcyryxx_bak);
    if (qyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, qyryxx_bak);
    if (wgcyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, wgcyryxx_bak);
    qyryxx_lsxx.setCzlx("修改");
    qyryxx_lsxx.setBcsj(new Date());
    qyryxx_lsxx = qyryxx_lsxxDao.insertQyryxx_lsxx(qyryxx_lsxx);

    // 修改从业人员信息表
    if ("11".equals(qyryxx.getCyryztdm())) {
      qyryxx.setIslzrqNull("1");
    } else if (null == qyryxx.getLzrq() || "".equals(qyryxx.getLzrq())) {
      qyryxx.setCyryzt("在职");
      qyryxx.setIslzrqNull("1");
    } else {
      qyryxx.setCyryzt("离职");
    }

    if (qyryxx.getWgcyryxx() == null) {
      if (qyryxx_bak.getZt() != null) {
        if (qyryxx_bak.getZt().equals("2")) {
          qyryxx.setZt("3");
        } else if (qyryxx_bak.getZt().equals("0")) {
          if ("1".equals(qyryxx.getZjzt())) {
            qyryxx.setZt("5");
          }
        } else if (qyryxx_bak.getZt().equals("11")) {
          qyryxx.setZt("12");
        }
      }
    } else {
      // 若为境外从业人员,则姓名字段为英文名+" "+英文姓

      if (qyryxx.getXm() == null || "".equals(qyryxx.getXm())) {
        qyryxx.setXm(qyryxx.getWgcyryxx().getYwm() + " " + qyryxx.getWgcyryxx().getYwx());
      }

      if (qyryxx_bak.getZt() != null) {
        if (qyryxx_bak.getZt().equals("2")) {
          qyryxx.setZt("3");
        } else if (qyryxx_bak.getZt().equals("11")) {
          qyryxx.setZt("12");
        }
      }
    }
    if (qyryxx.getXm() != null) qyryxx.setXmpy(PinYinUtil.getHanyuPingYin(qyryxx.getXm()));

    int zpidfalg = 0; // 0 表示没有变更企业,1表示变更企业了

    // 若从业人员服务场所改变,则需修改与t_cyryxx表有直接或间接外键关联的所有表的qyid,但不包括人员历史表和IC卡受理变更表
    if (!qyryxx_bak.getQyid().equals(qyryxx.getQyid())) {
      Qyjbxx qyjbxxNow = new Qyjbxx();
      qyjbxxNow.setQyid(qyryxx.getQyid());
      qyjbxxNow = qyjbxxDao.getQyjbxx(qyjbxxNow);
      qyryxx.setHylbdm(qyjbxxNow.getHylbdm());
      qyryxx.setHylb(qyjbxxNow.getHylb());
      updateQyryxxForeignKey(qyryxx, qyryxx_bak);
      zpidfalg = 1;

    } else {
      qyryxxDao.updateQyryxx(qyryxx);
    }

    // 更新账号
    String errCode = "0";
    qyryxx.setGwbh(qyryxx_bak.getGwbh());
    errCode = updateUser(qyryxx, qyryxx_bak);
    if (errCode.equals("1")) return false;

    if (null != qyryxx.getLzrq() && !"".equals(qyryxx.getLzrq())) {
      //// 注销员工用户
      int errResult = 0;
      if (sczhFlag(qyryxx.getHylbdm(), qyryxx.getGwbh()).equals("1")) {
        if (getUser(qyryxx.getCyrybh()).equals("1")) {
          GgQyyh qyyh = new GgQyyh();
          qyyh.setRyid(qyryxx.getRyid());
          qyyh.setIsval("0"); // 是否可见
          errResult = ggQyyhDao.zhuxQyYgyh(qyyh);
        }
      }
    } else {
      int errResult = 0;
      if (sczhFlag(qyryxx.getHylbdm(), qyryxx.getGwbh()).equals("1")) {
        if (getUser(qyryxx.getCyrybh()).equals("1")) {
          GgQyyh qyyh = new GgQyyh();
          qyyh.setRyid(qyryxx.getRyid());
          qyyh.setIsval("1"); // 是否可见
          errResult = ggQyyhDao.zhuxQyYgyh(qyyh);
        }
      }
    }
    // 修改从业人员照片表
    if (qyryxx.getQyry_zp() != null) {
      // 照片
      Qyry_zp qyry_zpbak = new Qyry_zp();
      qyry_zpbak.setRyid(qyryxx_bak.getRyid());
      qyry_zpbak.setQyid(qyryxx_bak.getQyid());
      qyry_zpbak.setTplx("0");
      qyry_zpbak = qyry_zpDao.getQyry_zp(qyry_zpbak);

      if (qyry_zpbak == null) {
        // 无,新增
        qyry_zp = qyryxx.getQyry_zp();
        qyry_zp.setRyid(qyryxx.getRyid());
        qyry_zp.setQyid(qyryxx.getQyid());
        qyry_zp.setTplx("0");
        qyry_zp = qyry_zpDao.insertQyry_zp(qyry_zp);
        qyryxx.setZpid(qyry_zp.getZpid());
      } else {
        // 有,更新
        qyry_zp = qyryxx.getQyry_zp();
        qyry_zp.setTplx("0");
        qyry_zp.setRyid(qyryxx.getRyid());
        if (zpidfalg == 1) {
          qyry_zp.setZpid(qyryxx.getZpid());
        }
        qyry_zpDao.updateQyry_zp(qyry_zp);
      }
    }

    // 若从业人员状态为5-证件号码错,则插入从业人员核查表
    if (qyryxx.getWgcyryxx() == null) {
      if ("5".equals(qyryxx.getZt())) {
        Garkktbsj garkktbsj = new Garkktbsj();
        garkktbsj = garkktbsjService.insertGarkktbsj(garkktbsj);
        Qyryxxhc qyryxxhc = new Qyryxxhc();
        qyryxxhc.setRyid(qyryxx.getRyid());
        qyryxxhc.setGarkktbsjid(garkktbsj.getGarkktbsjid());
        qyryxxhc.setHcwt("证件号码错");
        qyryxxhcService.insertQyryxxhcByRyid(qyryxxhc);
      }
    }

    // 更新外国从业人员信息
    if (qyryxx.getWgcyryxx() != null) {
      wgcyryxx = qyryxx.getWgcyryxx();
      wgcyryxx.setRyid(qyryxx.getRyid());
      wgcyryxxDao.updateWgcyryxx(wgcyryxx);
    }

    // 更新场所总人数
    if (!qyryxx_bak.getQyid().equals(qyryxx.getQyid())) {
      Map map = new HashMap();
      map.put("p_oldQyid", qyryxx_bak.getQyid());
      map.put("p_newQyid", qyryxx.getQyid());
      qyZrsProcDao.updateQyzrs(map);
    }
    // 人员信息操作日志
    Qyjbxx qyjbxx = new Qyjbxx();
    qyjbxx.setQyid(qyryxx.getQyid());
    qyjbxx = qyjbxxDao.getQyjbxx(qyjbxx);
    Ryxxczrz ryxxczrz = new Ryxxczrz();
    ryxxczrz.setCzsj(currentDate);
    ryxxczrz.setCzlx("修改");
    ryxxczrz.setCzr(qyryxx.getCzr());
    ryxxczrz.setQybm(qyjbxx.getQybm());
    ryxxczrz.setCyrybh(qyryxx_bak.getCyrybh());
    ryxxczrzDao.insertRyxxczrz(ryxxczrz);

    isSuccess = true;
    return isSuccess;
  }
Exemplo n.º 8
0
  /** @param 企业人员信息(t_qyryxx) 增加 */
  public Qyryxx insertQyryxx(Qyryxx qyryxx) throws Exception {
    // TODO: implement
    Date currentDate = new Date();
    Qyryxx qyryxxNew = new Qyryxx();
    Qyry_zp qyry_zp = new Qyry_zp();
    Wgcyryxx wgcyryxx = new Wgcyryxx();
    List qyry_zpList = new ArrayList();
    Qyryxx qyryxxExistList = new Qyryxx();

    Qyjbxx qyjbxx = new Qyjbxx();

    qyjbxx.setQyid(qyryxx.getQyid());
    qyjbxx = qyjbxxDao.getQyjbxx(qyjbxx);
    // 得到从业人员编号
    // 娱乐业、公共场所行业规则:企业编码前9位+8位年份+4位流水号
    // 其他行业规则 :企业编码+2位年份+4位流水号 (modified by mds at 20100120)
    String hylbdm = qyjbxx.getHylbdm();

    Map scbmMap = new HashMap();
    scbmMap.put("p_bmfl", "RY");
    if (hylbdm.equals("J") || hylbdm.equals("K"))
      scbmMap.put("p_xzqh", qyjbxx.getQybm().substring(0, 9));
    else scbmMap.put("p_xzqh", qyjbxx.getQybm());
    String sssf = QjblUtil.queryQjblVal("sssf"); // 所属省份

    scbmMap.put("p_sssf", sssf);
    if (hylbdm.equals("J") || hylbdm.equals("K")) scbmMap.put("p_scgz", 2);
    else scbmMap.put("p_scgz", 4);
    // 若前台传入的cyrybh为空,则调用编码生成程序生成编码。

    if (qyryxx.getCyrybh() == null || "".equals(qyryxx.getCyrybh()))
      qyryxx.setCyrybh(scbmDao.getScbm(scbmMap));
    qyryxxExistList = qyryxxDao.getIsQyrybhExist(qyryxx);
    while (qyryxxExistList != null) { // 校验从业人员编号是否存在,存在从新生成
      qyryxx.setCyrybh(scbmDao.getScbm(scbmMap));
      qyryxxExistList = qyryxxDao.getIsQyrybhExist(qyryxx);
    }
    // 增加从业人员信息表
    qyryxx.setScbz(0);
    qyryxx.setZxbz("0");
    qyryxx.setBiduiflag("0"); // 未比对

    // 增加从业人员信息表
    if ("0".equals(qyryxx.getCyrylbdm())) {
      qyryxx.setCyzjdm("111");
      qyryxx.setCyzj("公民身份号码");
      qyryxx.setGjdm("CHN");
      qyryxx.setGj("中国");
      if (qyryxx.getZjzt() != null) {
        if ("0".equals(qyryxx.getZjzt())) // 公民身份号码符合校验规则
        {
          qyryxx.setZt("0");
        } else qyryxx.setZt("5");
      } else qyryxx.setZt("0");
    } else {
      // 若为境外从业人员,则姓名字段为英文名+" "+英文姓

      if (qyryxx.getXm() == null || "".equals(qyryxx.getXm())) {
        qyryxx.setXm(qyryxx.getWgcyryxx().getYwm() + " " + qyryxx.getWgcyryxx().getYwx());
      }

      qyryxx.setZt("0");
    }
    qyryxx.setXmpy(PinYinUtil.getHanyuPingYin(qyryxx.getXm()));
    qyryxx.setLrsj(currentDate);
    if (null != qyryxx.getLzrq() && !"".equals(qyryxx.getLzrq())) {
      qyryxx.setCyryzt("离职");
    }
    qyryxxNew = qyryxxDao.insertQyryxx(qyryxx);
    if (qyryxx.getQyry_zp() != null) {
      qyry_zp = qyryxx.getQyry_zp();
      qyry_zp.setRyid(qyryxxNew.getRyid());
      qyry_zp.setQyid(qyryxxNew.getQyid());
      qyry_zp.setTplx("0");
      qyry_zp = qyry_zpDao.insertQyry_zp(qyry_zp);
    }
    // 增加外国从业人员信息表

    if (qyryxx.getWgcyryxx() != null) {
      wgcyryxx = qyryxx.getWgcyryxx();
      wgcyryxx.setRyid(qyryxxNew.getRyid());
      wgcyryxx = wgcyryxxDao.insertWgcyryxx(wgcyryxx);
    }

    // 若从业人员状态为5-证件号码错,则插入从业人员核查表
    if (qyryxx.getWgcyryxx() == null) {
      if ("5".equals(qyryxxNew.getZt())) {
        Garkktbsj garkktbsj = new com.aisino2.publicsystem.domain.Garkktbsj();
        garkktbsj = garkktbsjService.insertGarkktbsj(garkktbsj);
        Qyryxxhc qyryxxhc = new Qyryxxhc();
        qyryxxhc.setRyid(qyryxxNew.getRyid());
        qyryxxhc.setGarkktbsjid(garkktbsj.getGarkktbsjid());
        qyryxxhc.setHcwt("证件号码错");
        qyryxxhcService.insertQyryxxhcByRyid(qyryxxhc);
      }
    }
    // 更新场所总人数

    Map map = new HashMap();
    map.put("p_oldQyid", 0);
    map.put("p_newQyid", qyryxxNew.getQyid());

    qyZrsProcDao.updateQyzrs(map);
    // 人员信息操作日志
    Ryxxczrz ryxxczrz = new Ryxxczrz();
    ryxxczrz.setCzsj(currentDate);
    ryxxczrz.setCzlx("增加");
    ryxxczrz.setQybm(qyjbxx.getQybm());
    ryxxczrz.setCzr(qyryxx.getLrr());
    ryxxczrz.setCyrybh(qyryxxNew.getCyrybh());
    ryxxczrzDao.insertRyxxczrz(ryxxczrz);

    qyryxxNew.setQyry_zp(qyry_zp);
    qyryxxNew.setWgcyryxx(wgcyryxx);

    // 生成从业人员账号
    int errCode = 0;
    if (sczhFlag(qyryxxNew.getHylbdm(), qyryxxNew.getGwbh()).equals("1")) {
      if ("1".equals(queryQjbl(qyryxxNew.getHylbdm() + "tbsczh"))) { // 同步生成账号
        GgQyyh qyyh = new GgQyyh();
        qyyh.setRyid(qyryxxNew.getRyid());
        errCode = ggQyyhDao.insertQyYgyh(qyyh);
        if (errCode == 1) return null;
      }
    }
    if (null != qyryxx.getLzrq() && !"".equals(qyryxx.getLzrq())) {
      //// 注销员工用户
      int errResult = 0;
      if (sczhFlag(qyryxxNew.getHylbdm(), qyryxxNew.getGwbh()).equals("1")) {
        if (getUser(qyryxxNew.getCyrybh()).equals("1")) {
          GgQyyh qyyh = new GgQyyh();
          qyyh.setRyid(qyryxx.getRyid());
          qyyh.setIsval("0"); // 是否可见
          errResult = ggQyyhDao.zhuxQyYgyh(qyyh);
        }
      }
    }

    return qyryxxNew;
  }