NC入职自动创建用户
2018-03-13 15:09
761 查看
设计思想:员工的入职申请审批完成,在执行后创建用户,执行的代码类为: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+”’”);)
在执行动作后添加方法去创建用户;
创建用户方法:
(获取入职人员的主键和用户组主键——组织;运行方法创建用户: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; } }
相关文章推荐
- NC入职自动创建用户
- 活动目录用户自动创建工具(含源代码) 推荐
- 一步一步SharePoint 2007之二十一:解决实现注册用户后,自动具备访问网站的权限的问题(3)——创建用户
- winxp系统开机就会自动创建一个特定用户怎么办?
- linux里, 创建用户的过程直接写在脚本里,自动创建
- linux创建新用户后shell无法自动补…
- 用户登陆Samba后自动创建主目录
- 自动备份SQL Server数据库中用户创建的Stored Procedures
- linux创建用户、修改密码(自动修改密码)
- linux创建新用户后shell无法自动补全命令
- 如何在Linux下用shell自动创建用户并设置密码
- Linux入职基础-7.8_自动创建Makefile的工具(附上实例讲解)
- Linux 创建用户使用-p参数自动设置密码
- MySQL如何创建用户表并将其ID设置为自动增长列?
- windows2012利用Excel生成批处理自动批量创建域用户
- 自动创建域用户
- Linux入职基础-7.9_自动创建Makefile入门(实战1:Flat目录结构)
- Shell脚本进阶篇——编写自动判断自动创建添加用户和用户密码的脚本
- 自动创建域用户
- 通过读取用户和密码文件自动创建用户脚本