Beispiel #1
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;
  }
Beispiel #2
0
  /** @param 从业人员信息(t_qyryxx) 修改与t_qyryxx表有直接或间接外键关联的所有表的qyid,但不包括人员历史表 */
  public boolean updateQyryxxForeignKey(Qyryxx qyryxx, Qyryxx qyryxx_bak) {
    int ryid_bak = qyryxx_bak.getRyid();
    int qyid_bak = qyryxx_bak.getQyid();

    boolean isSuccess = false;
    Qyryxx qyryxxlz = new Qyryxx();
    qyryxxlz.setRyid(qyryxx_bak.getRyid());
    Date currentDate = new Date();
    qyryxxlz.setScbz(2);

    qyryxxDao.updateQyryxx(qyryxxlz);

    // 插入旧的从业人员信息,企业id改变了
    Qyryxx qyryxxOld = new Qyryxx();
    qyryxxOld = qyryxx_bak;
    qyryxxOld.setQyid(qyryxx.getQyid());
    qyryxxOld = qyryxxDao.insertQyryxx(qyryxxOld);
    qyryxx.setRyid(qyryxxOld.getRyid());
    // 更新新插入的信息
    qyryxxDao.updateQyryxx(qyryxx);

    // 更新icksl表

    Qyjbxx qyjbxxa = new Qyjbxx();
    qyjbxxa.setQyid(qyryxx.getQyid());
    qyjbxxa = qyjbxxDao.getQyjbxx(qyjbxxa);

    /*Icksl icksla = new Icksl();
    icksla.setRyid(ryid_bak);
    icksla.setZxbz("0");
    icksla =ickslDao.getIckslyj(icksla);//拿出这个ryid的最后的icksl记录

    Icksl ickslgx = new Icksl();
    ickslgx.setIckslid(icksla.getIckslid());
    ickslgx.setQybm(qyjbxxa.getQybm());
    ickslgx.setQyid(qyjbxxa.getQyid());
    ickslgx.setRyid(qyryxx.getRyid());
    ickslgx.setHylbdm(qyryxx.getHylbdm());
    ickslgx.setHylb(qyryxx.getHylb());
    ickslDao.updateIckslByqybg(ickslgx);*/

    // 更新qyrysh
    Qyrysh qyrysh = new Qyrysh();
    qyrysh.setRyid(ryid_bak);
    qyrysh.setQyid(qyjbxxa.getQyid());
    qyrysh.setNewRyid(qyryxx.getRyid());

    isSuccess = qyryshDao.updateQyryshByqybg(qyrysh) > 0;

    // 新插入从表数据
    int ryid = qyryxx.getRyid();
    int qyid = qyryxx.getQyid();

    // 照片
    Qyry_zp qyry_zp = new Qyry_zp();
    qyry_zp.setRyid(ryid_bak);
    qyry_zp.setQyid(qyid_bak);
    qyry_zp.setTplx("0");
    qyry_zp = qyry_zpDao.getQyry_zp(qyry_zp);
    if (qyry_zp != null) {
      qyry_zp.setRyid(ryid);
      qyry_zp.setQyid(qyid);
      qyry_zpDao.updateQyrybg_zp(qyry_zp);
      qyryxx.setZpid(qyry_zp.getZpid());
    }

    // 外国
    Wgcyryxx wgcyryxx = new Wgcyryxx();
    wgcyryxx.setRyid(ryid_bak);
    wgcyryxx.setQyid(qyid_bak);
    wgcyryxx = wgcyryxxDao.getWgcyryxx(wgcyryxx);
    if (wgcyryxx != null) {
      wgcyryxx.setRyid(ryid);
      wgcyryxx.setQyid(qyid);
      wgcyryxxDao.insertWgcyryxx(wgcyryxx);
    }
    // 奖惩
    Ryjcxx ryjcxx = new Ryjcxx();
    ryjcxx.setRyid(ryid_bak);
    ryjcxx.setQyid(qyid_bak);

    List list = ryjcxxDao.getListRyjcxx(ryjcxx);

    if (list != null) {
      for (int i = 0; i < list.size(); i++) {
        ryjcxx = (Ryjcxx) list.get(i);
        ryjcxx.setRyid(ryid);
        ryjcxx.setQyid(qyid);
        ryjcxxDao.insertRyjcxx(ryjcxx);
      }
    }
    // 核查
    Qyryxxhc qyryxxhc = new Qyryxxhc();
    qyryxxhc.setRyid(ryid_bak);
    qyryxxhc.setQyid(qyid_bak);
    qyryxxhc = qyryxxhcDao.getQyryxxhc(qyryxxhc);
    if (qyryxxhc != null) {
      qyryxxhc.setRyid(ryid);
      qyryxxhc.setQyid(qyid);
      qyryxxhcDao.insertQyryxxhc(qyryxxhc);
    }

    // 体检
    Qyry_tjxx qyry_tjxx = new Qyry_tjxx();
    qyry_tjxx.setRyid(ryid_bak);
    qyry_tjxx.setQyid(qyid_bak);

    List listTjxx = qyry_tjxxDao.getListQyry_tjxx(qyry_tjxx);

    if (listTjxx != null) {
      for (int j = 0; j < listTjxx.size(); j++) {
        qyry_tjxx = (Qyry_tjxx) listTjxx.get(j);
        qyry_tjxx.setRyid(ryid);
        qyry_tjxx.setQyid(qyid);
        qyry_tjxxDao.insertQyry_tjxx(qyry_tjxx);
      }
    }
    qyryxx_bak.setRyid(ryid_bak);
    qyryxx_bak.setQyid(qyid_bak);

    return isSuccess;
  }