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
  public List findSubDeptByMap(String deptId) throws AppException, SysException {
    List oList = new ArrayList();
    OrgDeptSVO vo = new OrgDeptSVO();
    OrgDeptSVO svo = new OrgDeptSVO();
    vo.setDeptId(deptId);
    vo.setSts(Constant.STS_IN_USE);
    vo = (OrgDeptSVO) orgDeptSDao.findByPK(vo);

    oList.add(vo.getDeptId());
    if (!vo.getLocalNetId().equals("0")) {
      svo.setLocalNetId(vo.getLocalNetId());
      if (!vo.getAreaId().equals("0")) {
        svo.setAreaId(vo.getAreaId());
      }
    }
    svo.setSts(Constant.STS_IN_USE);
    List list = orgDeptSDao.findByMap(svo);
    HashMap keyMap = (HashMap) list.get(1);
    this.findByIdMap(vo.getDeptId(), oList, keyMap);
    return oList;
  }
Exemplo n.º 4
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();
  }
Exemplo n.º 5
0
  public List findSubDeptById(String deptId) throws AppException, SysException {
    List oList = new ArrayList();
    OrgDeptSVO vo = new OrgDeptSVO();
    OrgDeptSVO svo = new OrgDeptSVO();
    vo.setDeptId(deptId);
    vo.setSts(Constant.STS_IN_USE);
    vo = (OrgDeptSVO) orgDeptSDao.findByPK(vo);

    oList.add(vo);
    svo.setParentDeptId(deptId);
    svo.setSts(Constant.STS_IN_USE);
    List list = orgDeptSDao.findIdByVO(svo);
    if (list != null && list.size() > 0) {
      for (int i = 0; i < list.size(); i++) {
        svo = (OrgDeptSVO) list.get(i);
        if (!svo.getDeptId().equals(vo.getDeptId())) {
          oList.add(svo);
          this.findById(svo.getDeptId(), oList);
        }
      }
    }
    return oList;
  }
Exemplo n.º 6
0
  /**
   * 根据主键查询组织机构信息
   *
   * @param deptId Long
   * @throws SysException
   * @return OrgDeptPartyVO
   */
  public OrgDeptSVO findOrgDeptById(String deptId) throws AppException, SysException {

    OrgDeptSVO svo = new OrgDeptSVO();
    svo.setDeptId(deptId);
    return (OrgDeptSVO) orgDeptSDao.findByPK(svo);
  }