📄 contractguiaction.java
字号:
package com.mdcl.mocha.jlcmcc.contract.action;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.mdcl.mocha.bpm.portal.common.security.BPMUserInfo;
import com.mdcl.mocha.bpm.sdk.boins.entity.IBoInstance;
import com.mdcl.mocha.bpm.sdk.document.entity.IContent;
import com.mdcl.mocha.bpm.sdk.document.entity.IDocument;
import com.mdcl.mocha.bpm.sdk.license.ExpiryException;
import com.mdcl.mocha.bpm.sdk.license.LicenseException;
import com.mdcl.mocha.bpm.sdk.license.NotFoundModuleException;
import com.mdcl.mocha.bpm.sdk.osm.IAccountsMgmtService;
import com.mdcl.mocha.bpm.sdk.osm.OsmException;
import com.mdcl.mocha.bpm.sdk.osm.entity.AccountsBean;
import com.mdcl.mocha.bpm.webcommons.action.BPMBaseAction;
import com.mdcl.mocha.jlcmcc.contract.bean.ContractGuiBean;
import com.mdcl.mocha.jlcmcc.contract.serviceimp.guidang.findDocbyguidang;
/**
* <strong>Title : ContractGuiAction<br>
* </strong> <strong>Description : 获得流程归档信息 </strong><br>
* <strong>Create on : 2007-10-14<br>
* </strong>
* <p>
* <strong>Copyright (C) Mocha Software Co.,Ltd.<br>
* </strong>
* <p>
*
* @author zhanghd zhanghd@mochasoft.com.cn<br>
* @version <strong>吉林移动BPM一期</strong><br>
* <br>
* <strong>修改历史:</strong><br>
* 修改人 修改日期 修改描述<br>
* -------------------------------------------<br>
* <br>
* <br>
*/
public class ContractGuiAction extends BPMBaseAction {
/**
* action 方法
*
* @throws OsmException
* @throws LicenseException
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws LicenseException, OsmException {
System.out.println(">>>>>>>>>>>>>>execute方法运");
// 取得参数
String unit = request.getParameter("unit");
if (unit == null || unit.equals("0"))
unit = findDocbyguidang.GUIDANG_STATE_TRUE;// 上面的两个标题
else if (unit.equals("1"))
unit = findDocbyguidang.GUIDANG_STATE_FALSE;// 上面的两个标题
System.out.println(">>>>>>>>>>>>>>execute方法运"+unit+":"+request.getParameter("flag"));
// 获取所有业务流程实例
findDocbyguidang getAllBoins = new findDocbyguidang();
// 已归档业务流程实例
List list = (List) getAllBoins.getDocByGuiDang(unit);
// 获取人员信息
BPMUserInfo t_userInfo = getUser(request);
AccountsBean t_accountBean = t_userInfo.getAccount();
System.out.println(">>>>>>>>>>>>>" + t_accountBean.getId());
Set t_set = t_accountBean.getPrincipal();
String[] t_principalsIds = new String[t_set.size()];
Iterator iter = t_set.iterator();
int i = 0;
while (iter.hasNext()) {
String element = (String) iter.next();
t_principalsIds[i] = element;
i++;
}
// 合同类型
List t_datalist = (List) getFilertDocument(t_principalsIds, list);
System.out.println("/*-/-/-//-/-/-/*t_totalSize=" + list.size());
request.setAttribute("flag", request.getParameter("flag"));
request.setAttribute("unit", unit);
request.setAttribute("t_datalist", list);
System.out.println("<<<<<<<<<<<<<<<<execute方法运");
return mapping.findForward("SUCCESS");
}
/**
* 通过 pageList 筛选 数据
*
* @param iboinstance
* @param idocService
* @param pagedlist
* 要筛选的列表pageList
* @param state
* 传入的状态
* @return
* @throws OsmException
* @throws LicenseException
*/
private List getFilertDocument(String[] t_principalsIds, List Boinslist) {
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>pageList 筛选 数据");
List document_List = new ArrayList();//
if (Boinslist != null && !Boinslist.isEmpty()) {
for (Iterator iter = Boinslist.iterator(); iter.hasNext();) {
IBoInstance iBoIns = (IBoInstance) iter.next();
String create_id = iBoIns.getCreaterID();// 获得起草人id
for (int i = 0; i < t_principalsIds.length; i++) {
if (create_id.equals(t_principalsIds[i])) {
IDocument t_IDocument = (IDocument) iBoIns
.getDocument();
try {
ContractGuiBean getAllinfo = setContractBean(
t_IDocument, create_id);
document_List.add(getAllinfo);
} catch (LicenseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (OsmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}
System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<pageList 筛选 数据");
return document_List;
}
/**
* 把数据装载到 ContractManageBean 中
*
* @param start_time
* 起草时间
* @param idocument
* IDocument对象
* @param create_id
* 起草人id
* @param iBoIns
* IBoInstance对象
* @return ContractManageBean
* @throws LicenseException
* @throws OsmException
*/
private ContractGuiBean setContractBean(IDocument idocument,
String create_id) throws LicenseException, OsmException {
ContractGuiBean contractBean = new ContractGuiBean();
contractBean.setContractNo(getConractNo(idocument));// 编号
contractBean.setTitle(idocument.getDocTitle() == null ? "" : idocument
.getDocTitle());// 标题
contractBean.setSmallContract(getSmallConract(idocument));// 合同小类
contractBean.setCreaterName(getCreateName(create_id));// 起草人姓名
contractBean.setBoInsId(idocument.getBoInstanceID());// 流程实例
return contractBean;
}
/**
* 根据起草人id得到起草人姓名
*
* @param create_id
* @return
* @throws LicenseException
* @throws OsmException
*/
private String getCreateName(String create_id) throws LicenseException,
OsmException {
// 获取起草人姓名
String createName = null;
try {
if (create_id != null && !"".equals(create_id)) {
IAccountsMgmtService iAccountservice = null;
iAccountservice = (IAccountsMgmtService) getBusinessService(IAccountsMgmtService.class
.getName());
AccountsBean accountsbean = iAccountservice
.getAccountsById(create_id);
createName = accountsbean.getEmpinfo().getEmpname();
}
} catch (NotFoundModuleException e) {
try {
throw e;
} catch (NotFoundModuleException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} catch (ExpiryException e) {
try {
throw e;
} catch (ExpiryException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} catch (LicenseException e) {
throw e;
} catch (OsmException e) {
throw e;
}
return createName;
}
/**
* 方法描述 取得合同编号
*
* @param idocument
* @return
*/
public String getConractNo(IDocument idocument) {
String ContractNo = "";
IContent SContract = (IContent) idocument.getContent("hetongbianhao");
ContractNo = SContract.getItemValue();
return ContractNo;
}
/**
* 方法描述 取得合同小类
*
* @param idocument
* @return
*/
public String getSmallConract(IDocument idocument) {
String SmallContract = "";
IContent SContract = (IContent) idocument.getContent("xiaoleitext");
if (SContract != null)
SmallContract = SContract.getItemValue();
return SmallContract;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -