Exemplo n.º 1
0
  public void uniteOrgDept(String deptId, String newDeptId) throws SysException, AppException {

    Date curDate = SysDateUtil.getCurrentDate();
    try {

      OrgDeptSVO ovo = new OrgDeptSVO();
      OrgDeptSVO oldVo = new OrgDeptSVO();
      StaffSVO staffVo = new StaffSVO();
      List list = null;

      ovo.setDeptId(newDeptId);
      ovo = (OrgDeptSVO) orgDeptSDao.findByPK(ovo);
      oldVo.setDeptId(deptId);
      oldVo.setParentDeptId(ovo.getParentDeptId());
      oldVo.setStsDate(curDate);
      orgDeptSDao.update(oldVo);

      staffVo.setDeptId(deptId);
      staffVo.setSts("A");
      list = staffDao.findByVO(staffVo);
      if (list != null) {
        Iterator it = list.iterator();
        while (it.hasNext()) {
          staffVo = (StaffSVO) it.next();
          staffVo.setDeptId(newDeptId);
          staffVo.setStsDate(SysDateUtil.getCurrentTimestamp());
          staffDao.update(staffVo);
        }
      }
      oldVo.setSts("P");
      orgDeptSDao.update(oldVo);
    } catch (SysException se) {
      throw new SysException("sss", "OrgDeptDOM.uniteOrgDept", se);
    }
  }
Exemplo n.º 2
0
  /**
   * 删除组织机构
   *
   * @param deptId Long
   * @throws SysException
   * @throws AppException
   */
  public void delOrgDept(String deptId, List logList) throws SysException, AppException {

    OrgDeptSVO deptVo = new OrgDeptSVO();
    StaffSVO staffVo = new StaffSVO();
    staffVo.setSts("A");
    staffVo.setDeptId(deptId);
    List list = staffDao.findByVO(staffVo);
    if (list != null) {
      throw new AppException("3250007", "该组织结构下存在员工,请先删除该组织结构下员工!");
    }

    deptVo.setDeptId(deptId);
    OrgDeptSVO deptVoRet = new OrgDeptSVO();
    deptVoRet.setDeptId(deptId);
    deptVoRet = (OrgDeptSVO) orgDeptSDao.findByPK(deptVoRet);
    deptVo.setSts("P");
    deptVo.setStsDate(SysDateUtil.getCurrentDate());
    orgDeptSDao.update(deptVo);
    // 记录操作日志
    List actionLogList = null;
    if (logList != null && logList.size() > 0) {
      actionLogList = new ArrayList();
      for (int i = 0; i < logList.size(); i++) {
        ActionLogSVO actionLog = (ActionLogSVO) logList.get(i);
        actionLog.setActionId(MaxId.getSequenceNextVal(SysConstants.ACTION_LOG_SEQ));
        actionLogList.add(actionLog);
      }
      IActionLogSDAO actionLogDao =
          (IActionLogSDAO) com.cattsoft.pub.dao.DAOFactory.getDAO(IActionLogSDAO.class);
      actionLogDao.addBat(actionLogList);
    }
  }
Exemplo n.º 3
0
  /**
   * 修改组织机构信息
   *
   * @param ovo OrgDeptVO
   * @param pvo PartyVO
   * @throws SysException
   * @throws AppException
   * @throws NoSuchMethodException
   * @throws InvocationTargetException
   * @throws IllegalAccessException
   */
  public void modOrgDept(OrgDeptSVO vo) throws Exception {
    if (log.isDebugEnabled()) {
      log.debug("需要修改组织结构的id为:" + vo.getDeptId());
    }
    orgDeptSDao.update(vo);

    // 记录操作日志
    ActionLogSVO actionLog = vo.getActionLog();
    actionLog.setActionId(MaxId.getSequenceNextVal(SysConstants.ACTION_LOG_SEQ));
    IActionLogSDAO actionLogDao =
        (IActionLogSDAO) com.cattsoft.pub.dao.DAOFactory.getDAO(IActionLogSDAO.class);
    actionLogDao.add(actionLog);
  }