NC入职自动创建用户

设计思想:员工的入职申请审批完成,在执行后创建用户,执行的代码类为:EntrymngManageServiceImpl.java
在执行动作后添加方法去创建用户;
创建用户方法:

//(获取入职人员的主键和用户组主键——组织;运行方法创建用户:
EntryCreateUser.entryCreateUser(entrypkpsndoc, pk_userGroup));

详细代码:

EntryCreateUser EntryCreateUser=new EntryCreateUser();
String entrypkpsndoc = null;
String pk_userGroup = null;
for (int i = 0; i < retVOs.length; i++){
	entrypkpsndoc =(String)retVOs[i].getParentVO().getAttributeValue("pk_psndoc");
	pk_userGroup =(String)retVOs[i].getParentVO().getAttributeValue("pk_org");
}
if (entrypkpsndoc!=null && pk_userGroup!=null) {
	try {
		EntryCreateUser.entryCreateUser(entrypkpsndoc, pk_userGroup);
	} catch (Exception e) {
		Logger.error(e.getMessage(), e);
	}
}

创建用户类:(主要是获取PsndocVO,通过queryPsndocByPks查询——nc.vo.bd.psn.PsndocVO[] vos = getPsndocQueryService().queryPsndocVOsByCondition(“pk_psndoc =’”+pkpsndoc+”’”);)

package nc.ui.hi.psndoc.action;
import java.util.ArrayList;
import nc.bs.framework.common.NCLocator;
import nc.itf.bd.psn.psndoc.IPsndocQueryService;
import nc.itf.hi.IPsndocService;
import nc.itf.uap.IUAPQueryBS;
import nc.vo.bd.psn.PsndocExtend;
import nc.vo.bd.psn.PsndocVO;
import nc.vo.pub.BusinessException;

public class EntryCreateUser {

private IUAPQueryBS uapQuery;
private IPsndocQueryService psndocQryService = null;

public void entryCreateUser(String pkpsndoc, String pk_userGroup)
            throws BusinessException
          {
            PsndocVO[] vos = queryPsndocByPks(pkpsndoc);
            PsndocExtend[] vosWithMes = new PsndocExtend[vos.length];
            vosWithMes = (PsndocExtend[])createUser(vos, pk_userGroup);            
          }

private PsndocExtend[] createUser(PsndocVO[] vos, String pk_userGroup) throws BusinessException {
    // TODO 自动生成的方法存根
    return ((IPsndocService)NCLocator.getInstance().lookup(IPsndocService.class)).createUser((PsndocVO[]) vos, pk_userGroup);
}

private PsndocVO[] queryPsndocByPks(String pkpsndoc) throws BusinessException {
    nc.vo.bd.psn.PsndocVO[] vos = getPsndocQueryService().queryPsndocVOsByCondition("pk_psndoc ='"+pkpsndoc+"'");
    ArrayList<nc.vo.bd.psn.PsndocVO> al = new ArrayList();
    for (int i = 0; (vos != null) && (i < vos.length); i++) {
      if ((vos[i].getPsnjobs() != null) && (vos[i].getPsnjobs().length != 0)) {
        al.add(vos[i]);
      }
    }
    vos = (nc.vo.bd.psn.PsndocVO[])al.toArray(new nc.vo.bd.psn.PsndocVO[0]);
    if (vos == null) {
        throw new BusinessException("NULL.");
      }

    return vos;
}

private IPsndocQueryService getPsndocQueryService() {
    // TODO 自动生成的方法存根
    if (this.psndocQryService == null) {
          this.psndocQryService = ((IPsndocQueryService)NCLocator.getInstance().lookup(IPsndocQueryService.class));
        }
        return this.psndocQryService;
}
public IUAPQueryBS getUapQuery()
  {
if (this.uapQuery == null) {
  this.uapQuery = ((IUAPQueryBS)NCLocator.getInstance().lookup(IUAPQueryBS.class));
}
return this.uapQuery;
  }  
}

原文链接:https://blog.csdn.net/hwq293/article/details/79540746

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值