Example #1
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);
    }
  }
Example #2
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);
  }
Example #3
0
  /**
   * 增加组织机构
   *
   * @param ovo
   * @return
   * @throws Exception
   */
  public String addOrgDept(OrgDeptSVO ovo) throws Exception {

    OrgDeptSVO deptVo = new OrgDeptSVO();
    deptVo.setDeptId(ovo.getParentDeptId());
    deptVo = (OrgDeptSVO) orgDeptSDao.findByPK(deptVo);
    if (deptVo.getAreaId().equals("0")) {
      if (deptVo.getLocalNetId().equals("0")) {
        ovo.setAreaId("0");
      }
    } else {
      ovo.setLocalNetId(deptVo.getLocalNetId());
      ovo.setAreaId(deptVo.getAreaId());
    }
    try {
      // ovo.setServDeptId(deptVo.getServDeptId());
      // ovo.setBranchId(deptVo.getBranchId());
      ovo.setDeptId(SMMaxId.getOrgDeptMaxId(ovo.getLocalNetId()));
      Date curDate = SysDateUtil.getCurrentDate();
      // 赋初值
      ovo.setCreateDate(curDate);
      ovo.setSts("A");
      ovo.setStsDate(curDate);

      orgDeptSDao.add(ovo);

      // 记录操作日志
      ActionLogSVO actionLog = ovo.getActionLog();
      actionLog.setActionId(MaxId.getSequenceNextVal(SysConstants.ACTION_LOG_SEQ));
      actionLog.setActionText(ovo.getDeptId() + "" + ovo.getDeptName() + ":增加");
      IActionLogSDAO actionLogDao =
          (IActionLogSDAO) com.cattsoft.pub.dao.DAOFactory.getDAO(IActionLogSDAO.class);
      actionLogDao.add(actionLog);

    } catch (SysException e) {
      throw new SysException("", "addOrgDept", e);
    }

    return ovo.getDeptId();
  }