package com.kingdee.shr.common; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import com.kingdee.bos.BOSException; import com.kingdee.bos.Context; import com.kingdee.eas.base.permission.util.ToolUtils; import com.kingdee.eas.basedata.person.IPerson; import com.kingdee.eas.basedata.person.PersonCollection; import com.kingdee.eas.basedata.person.PersonFactory; import com.kingdee.eas.basedata.person.PersonInfo; import com.kingdee.eas.framework.CoreBaseInfo; import com.kingdee.eas.hr.affair.EmpEnrollBizBillEntryCollection; import com.kingdee.eas.hr.affair.EmpEnrollBizBillEntryFactory; import com.kingdee.eas.hr.affair.EmpEnrollBizBillEntryInfo; import com.kingdee.eas.hr.affair.IEmpEnrollBizBillEntry; import com.kingdee.util.StringUtils; /** * 合同工具类 * @author coyle *202410 */ public class ContractUtils { public static Map getParty(Context ctx ,String personId) throws BOSException { IEmpEnrollBizBillEntry entryIns = EmpEnrollBizBillEntryFactory.getLocalInstance(ctx); EmpEnrollBizBillEntryCollection col = entryIns.getEmpEnrollBizBillEntryCollection("select ldhtzt.name,ldhtzt.id,ldhtzt.number " + " where person.id = '"+personId+"'"); String name = ""; String id = ""; String number = ""; if(col.size()>0) { EmpEnrollBizBillEntryInfo empEnrollBizBillEntryInfo = col.get(0); CoreBaseInfo ldhtzt = (CoreBaseInfo) empEnrollBizBillEntryInfo.get("ldhtzt"); if(null != ldhtzt) { name = StringUtils.cnulls(ldhtzt.getString("name")); number = StringUtils.cnulls(ldhtzt.getString("number")); id = StringUtils.cnulls( ldhtzt.getId()); } }else { IPerson personIns = PersonFactory.getLocalInstance(ctx); PersonCollection personCol = personIns.getPersonCollection("select ldhtzt.name,ldhtzt.id,ldhtzt.number" + " where id = '"+personId+"'"); PersonInfo personInfo = null; if(personCol.size()> 0) { personInfo = personCol.get(0); } CoreBaseInfo ldhtzt = (CoreBaseInfo) personInfo.get("ldhtzt"); if(null != ldhtzt) { name = StringUtils.cnulls(ldhtzt.getString("name")); number = StringUtils.cnulls(ldhtzt.getString("number")); id = StringUtils.cnulls( ldhtzt.getId()); } } Map hashMap = new HashMap(); hashMap.put("id", id); hashMap.put("name", name); hashMap.put("number", number); return hashMap; } public static ArrayList getPersonsParty(Context ctx , String personIds,String partyId) throws BOSException{ String[] split = personIds.split(","); String aryToStr = ToolUtils.aryToStr(split); IEmpEnrollBizBillEntry entryIns = EmpEnrollBizBillEntryFactory.getLocalInstance(ctx); EmpEnrollBizBillEntryCollection col = entryIns.getEmpEnrollBizBillEntryCollection("select ldhtzt.name , person.name " + "where person.id in ( "+aryToStr+") and ldhtzt.id <> '"+partyId+"'" ); ArrayList> resultList = new ArrayList(); for(int i = 0;i resultMap = new HashMap(); resultMap.put("partName", partName); resultMap.put("personName", personName); resultList.add(resultMap); } } return resultList; } }