waf2 代码思路参考

编辑界面:

 --初始化代码

package com.kingdee.eas.custom.wbfa.prescriptionprocedure;

import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Date;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.eventbus.application.IApplication;
import com.kingdee.bos.eventbus.event.model.ModelCreateEvent;
import com.kingdee.bos.eventbus.handler.model.AbstractModelCreateEventHandler;
import com.kingdee.bos.webframework.context.WafContext;
import com.kingdee.bos.webframework.dynamic.application.ApplicationSessionContext;
import com.kingdee.eas.base.codingrule.CodingRuleManagerFactory;
import com.kingdee.eas.base.codingrule.ICodingRuleManager;
import com.kingdee.eas.base.permission.UserFactory;
import com.kingdee.eas.basedata.assistant.CurrencyFactory;
import com.kingdee.eas.basedata.assistant.CurrencyInfo;
import com.kingdee.eas.basedata.org.AdminOrgUnitFactory;
import com.kingdee.eas.basedata.org.AdminOrgUnitInfo;
import com.kingdee.eas.basedata.org.CompanyOrgUnitInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.cp.bc.BizCollBillBaseInfo;
import com.kingdee.eas.cp.bc.CommonUtilFacadeFactory;
import com.kingdee.eas.custom.wbfa.receipts.marketingaactivity.MarketingActivitiesInfo;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.DevelopmentVerificationE1Info;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.DevelopmentVerificationFactory;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.DevelopmentVerificationInfo;
import com.kingdee.eas.util.app.DbUtil;
import com.kingdee.jdbc.rowset.IRowSet;

public class CflhxdAssignValue extends AbstractModelCreateEventHandler  {
	@Override
	protected IApplication getApplication() {
		// TODO Auto-generated method stub
		return ApplicationSessionContext.getApplication();
	}
	/**
	 *处方类开发核销单  DevelopmentVerification
	 */
	 @Override
	public void onModelCreate(ModelCreateEvent arg0) throws BOSException {
		// TODO Auto-generated method stub
		    super.onModelCreate(arg0);
		    
			Context ctx = WafContext.getInstance().getContext();
			
			DevelopmentVerificationInfo developmentVerificationInfo=(DevelopmentVerificationInfo)arg0.getModel();
			
			developmentVerificationInfo.setBizDate(new Date());//业务日期
			 //调用编码规则,设置默认值
		   String billNumber="";
		    ICodingRuleManager iCodingRuleManager = CodingRuleManagerFactory.getRemoteInstance();
		    try{
			    String strCompanyID = iCodingRuleManager.getCurrentAppOUID(developmentVerificationInfo);
			   boolean isAutoNumber= iCodingRuleManager.isExist(developmentVerificationInfo, strCompanyID);  //第一步判断是否有编码规则
			   if(isAutoNumber){
				   boolean isAddView=iCodingRuleManager.isAddView(developmentVerificationInfo, strCompanyID);//是否新增显示
				  if(isAddView){
					  billNumber= iCodingRuleManager.readNumber(developmentVerificationInfo, strCompanyID);//读取编码
				  }
				   boolean isAddNotBreak=iCodingRuleManager.getRuleStatus(developmentVerificationInfo,strCompanyID).isAddNoBreak();//新增且不允许短号
				  if(isAddNotBreak){
					  billNumber=DevelopmentVerificationFactory.getRemoteInstance().readNewNumber(strCompanyID, developmentVerificationInfo, 1);
				  }
				  developmentVerificationInfo.setNumber(billNumber);
			   }
		    }catch(Exception e){
		    	throw new BOSException(e);
		    }

//			com.kingdee.eas.base.permission.UserInfo userInfo;
			try {
//				userInfo = UserFactory.getRemoteInstance().getUserInfo(new ObjectUuidPK(ctx.getCaller().toString()));
			    BizCollBillBaseInfo baseInfo = CommonUtilFacadeFactory.getRemoteInstance().forLoanBillCreateNewData();
			    developmentVerificationInfo.setApplicant(baseInfo.getApplier());//申请人
			    developmentVerificationInfo.setDepartments(baseInfo.getOrgUnit());//部门
			    CompanyOrgUnitInfo company = baseInfo.getCompany();
			    developmentVerificationInfo.setPosition(baseInfo.getPosition());//职位
			     developmentVerificationInfo.setCompany(baseInfo.getApplierCompany());
			     developmentVerificationInfo.setCreator(UserFactory.getRemoteInstance().getUserInfo(ctx.getCaller()));
			     developmentVerificationInfo.setCreateTime(new Timestamp(new  Date().getTime()));
			     
			   //币别赋值 默认人民币
				    IRowSet rowSet = DbUtil.executeQuery(ctx, "SELECT fid FROM T_BD_Currency where FISOCODE  = 'RMB'");
				    try {
						if (rowSet.next()) {
							String currencyId = rowSet.getString("fid");
							CurrencyInfo currencyInfo = CurrencyFactory.getRemoteInstance().getCurrencyInfo(new ObjectUuidPK(currencyId));
							developmentVerificationInfo.setCurrency(currencyInfo);
						}
					} catch (SQLException e) {
						// TODO Auto-generated catch block
						throw new BOSException(e);
					}
			     //费用承担部门  费用承担公司赋值
				  DevelopmentVerificationE1Info info = new DevelopmentVerificationE1Info();
			      info.setFeiyongcdbm(baseInfo.getCostedDept());
			      info.setFeiyongcdgs(company);
			      
			      developmentVerificationInfo.getE1().add(info);
		
			} catch (EASBizException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				throw new BOSException(e);
			}
			
	}
}

/**************************提示:只允许修改开发区域,其他区域会被覆盖!********************************/
mod.definePage("extend/custom/wbfa/prescriptionprocedure/js/CDevelopmentVerificationEdit",function(waf){
    //@beginUseModule
    //@endUseModule
    var _public = {},_private = {},me=_self;
    //@beginPublic
    waf.extend(_public,{
        //页面事件描述:
        filterPosition:function(e){
             return _private.filterPosition(e);
        }
	    ,
        //页面事件描述:
        unAudit:function(e){
             return _private.unAudit(e);
        }
    });
    _self.subscribeEvent("fieldOnLoadEvent",_public.filterPosition,"after");
    _self.subscribeEvent("unAuditActionEvent",_public.unAudit,"overwrite");
    //@endPublic
    //@beginTemplateFunctions

    //@endTemplateFunctions

    /**************************开发区域开始**********************************************/
    //@beginPrivate
    waf.extend(_private,{
    	filterPosition:function(e){
			var applicant = waf("#applicant").wafPromptBox("getValue");
			if(applicant){
				waf.doPost({
                action:"commonDataProcess",
                data:{
				  _method: "getPositionIds",
				  applicantId:applicant.id
				},
                success:function(data){
				  if(data!=null && data.ids!=null){
					var ids = data.ids;
					waf("#position").wafPromptStandard("option", "filteritem", "id in (" + ids+")");
					//waf("#position").wafPromptStandard("option", "filteritem", "id ='5bx7ck1URSaYjmunKDspfgEnvWg='");
				  }
                }
            });
			}
			 waf.doPost({
			  action:"commonDataProcess",
			  data:{
			   _method: "filterCostAccount",
			   billtype:"003"
			  },
			 success:function(data){
				  if(data!=null && data.ids!=null){
					var ids = data.ids;
					//waf("#feiyongkemu").wafPromptStandard("option", "filteritem", "id in (" + ids+")");
					//waf("#position").wafPromptStandard("option", "filteritem", "id ='5bx7ck1URSaYjmunKDspfgEnvWg='");
					waf('#editgrid1').wafGrid('setCellEditorAllConfig', "feiyongkem","filteritem","id in (" + ids+")","promptGrid",null); 
				  }
                }
			 });
			
        }
	    ,
      unAudit:function(e){
			waf.doPost({
                action:"unAuditService",
                 data:{
				  _method: "deveVer_unAudit",
				  billId:value.current.id
				},
                success:function(data){
                   
                }
            });
        }
    });//@endPrivate
    /**************************开发区域结束**********************************************/
    return _public;
		
	});

 

package com.kingdee.eas.custom.wbfa.prescriptionprocedure;

import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import javax.servlet.http.HttpServletRequest;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.dao.query.ISQLExecutor;
import com.kingdee.bos.dao.query.SQLExecutorFactory;
import com.kingdee.bos.eventbus.event.action.IActionEventHandler;
import com.kingdee.bos.eventbus.event.action.KDActionEvent;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.entity.SelectorItemInfo;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.bos.webframework.context.WafContext;
import com.kingdee.bos.webframework.dynamic.handler.AbstractWebEventHandler;
import com.kingdee.bos.webframework.exception.WafException;
import com.kingdee.bos.webframework.json.JSONUtils;
import com.kingdee.eas.basedata.org.AdminOrgUnitInfo;
import com.kingdee.eas.basedata.org.CompanyOrgUnitInfo;
import com.kingdee.eas.basedata.org.IPositionMember;
import com.kingdee.eas.basedata.org.PositionFactory;
import com.kingdee.eas.basedata.org.PositionInfo;
import com.kingdee.eas.basedata.org.PositionMemberCollection;
import com.kingdee.eas.basedata.org.PositionMemberFactory;
import com.kingdee.eas.basedata.org.PositionMemberInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.cp.bc.BizCollBillBaseInfo;
import com.kingdee.eas.cp.bc.CommonUtilFacadeFactory;
import com.kingdee.eas.custom.wbfa.receipts.otherbill.CostAccountBillTypeCollection;
import com.kingdee.eas.custom.wbfa.receipts.otherbill.CostAccountBillTypeEntryCollection;
import com.kingdee.eas.custom.wbfa.receipts.otherbill.CostAccountBillTypeEntryInfo;
import com.kingdee.eas.custom.wbfa.receipts.otherbill.CostAccountBillTypeFactory;
import com.kingdee.eas.custom.wbfa.receipts.otherbill.CostAccountBillTypeInfo;
import com.kingdee.eas.scm.ws.app.importbill.ScmbillImportUtils;
import com.kingdee.eas.util.app.DbUtil;
import com.kingdee.jdbc.rowset.IRowSet;

public class CommonDataProcessHandler extends AbstractWebEventHandler implements
		IActionEventHandler {
	public void onAction(KDActionEvent event) throws WafException, BOSException {
		HttpServletRequest request = event.getReqeustContext()
				.getHttpServletRequest();
		try {
			super.getClass().getMethod(request.getParameter("_method"),
					new Class[] { KDActionEvent.class }).invoke(this,
					new Object[] { event });
		} catch (Exception e) {
			JSONUtils.ERROR(e.getCause().getMessage(), e);
			throw new WafException(e);
		}
	}

	/***
	 * 过滤费用科目,根据单据类型
	 * 
	 * @param event
	 * @throws EASBizException
	 * @throws BOSException
	 */
	public void filterCostAccount(KDActionEvent event) throws EASBizException,
			BOSException {
		StringBuffer ids = new StringBuffer();
		HashMap<String, String> dataMap = new HashMap<String, String>();
		HttpServletRequest request = event.getReqeustContext()
				.getHttpServletRequest();
		String billtype = request.getParameter("billtype");
		CostAccountBillTypeCollection costAccountBillTypeC = CostAccountBillTypeFactory
				.getRemoteInstance().getCostAccountBillTypeCollection(
						" where billType.number='" + billtype + "'");
		if (costAccountBillTypeC != null && costAccountBillTypeC.size() > 0) {
			CostAccountBillTypeInfo costAccountBillTypeInfo = costAccountBillTypeC
					.get(0);
			CostAccountBillTypeEntryCollection costTypeEntryC = costAccountBillTypeInfo
					.getEntrys();
			for (int i = 0; i < costTypeEntryC.size(); i++) {
				CostAccountBillTypeEntryInfo entryInfo = costTypeEntryC.get(i);
				String id = entryInfo.getCostAccount().getId().toString();
				ids.append("'").append(id).append("',");
			}
		}
		dataMap.put("ids", ids.substring(0, ids.length() - 1));
		String result = JSONUtils.convertObjectToJson(dataMap);
		JSONUtils.SUCCESS(result, false);
	}

	/***
	 * 获得申请用户的 岗位IDS
	 * 
	 * @param event
	 * @throws EASBizException
	 * @throws BOSException
	 */
	public void getPositionIds(KDActionEvent event) throws EASBizException, BOSException {
		 Context ctx = WafContext.getInstance().getContext(); 
	    StringBuffer ids=new StringBuffer();
	    BizCollBillBaseInfo baseInfo = CommonUtilFacadeFactory.getRemoteInstance().forLoanBillCreateNewData();
	    CompanyOrgUnitInfo applierCompany = baseInfo.getApplierCompany();
	    String conpanyId=null;
	    if(applierCompany!=null){
	    	conpanyId=	applierCompany.getId().toString();
	    }
	    StringBuffer deparmentids=new StringBuffer();
	    HashMap<String,String> dataMap=new HashMap<String,String>();
	     HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
		 String applicantId =request.getParameter("applicantId");
		 PositionMemberCollection positionMemberC= getPersonPosiMember(BOSUuid.read(applicantId));//获得用户的职位列表
		 for(int i=0;i<positionMemberC.size();i++){
			 PositionMemberInfo positionMemInfo=positionMemberC.get(i);
			 String id=positionMemInfo.getPosition().getId().toString();
			
			  AdminOrgUnitInfo adminOrgUnit = positionMemInfo.getPosition().getAdminOrgUnit();
			  if(adminOrgUnit!=null){
				  String id2 = adminOrgUnit.getId().toString();
				  CompanyOrgUnitInfo companyInfo=null;
				  try {
					  companyInfo = ScmbillImportUtils.getCompanyInfo(ctx,  adminOrgUnit, 0);//财务组织
					} catch (Exception e) {
						
					}
					if(companyInfo!=null){
				  String conpanyid = companyInfo.getId().toString();
				  if(conpanyid.equals(conpanyId)){
				  deparmentids.append("'").append(id2).append("',");}}
			  }
   	 ids.append("'").append(id).append("',");
   	
		 }
		
		 dataMap.put("ids", ids.substring(0, ids.length()-1));
		 if(!(deparmentids==null||"".equals(deparmentids.toString()))){
		 dataMap.put("deparmentids", deparmentids.substring(0, deparmentids.length()-1));}else{
			 dataMap.put("deparmentids", "'XXXXXXXXXXXXXXXXSUXXXXXXXXXAAAAAX'");
		 }
		 String result = JSONUtils.convertObjectToJson(dataMap);
	     JSONUtils.SUCCESS(result, false);
 }
	/**
	 * 给职位赋值
	 */
	public void positionChange(KDActionEvent event) throws EASBizException,
			BOSException {
		Context ctx = WafContext.getInstance().getContext();
		StringBuffer ids = new StringBuffer();
		HashMap<String, String> dataMap = new HashMap<String, String>();
		HttpServletRequest request = event.getReqeustContext()
				.getHttpServletRequest();
		String departments = request.getParameter("departments");
		String applicant = request.getParameter("applicant");
		StringBuffer sql = new StringBuffer();
		if (departments != null && sql != null) {

			sql
					.append(
							" SELECT t3.fid as fid FROM  T_ORG_PositionMember t1")
					.append(" left join T_BD_person t2 on t1.FPersonID=t2.fid")
					.append(
							" left join T_ORG_Position  t3 on t3.fid=t1.FPositionID")
					.append(
							" left join T_ORG_Admin  t4 on t4.fid=t3.FAdminOrgUnitID")
					.append(
							"	where t2.fid='" + applicant + "' and t4.fid='"
									+ departments + "'");
			IRowSet rowSet = DbUtil.executeQuery(ctx, sql.toString());
			try {
				if (rowSet.next()) {
					String fid = rowSet.getString("fid");
					PositionInfo positionInfo = PositionFactory
							.getRemoteInstance().getPositionInfo(
									new ObjectUuidPK(fid));
					JSONUtils.SUCCESS(positionInfo, false);

				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	private PositionMemberCollection getPersonPosiMember(BOSUuid personId)
			throws EASBizException, BOSException {
		PositionMemberCollection posiMemberColl = null;
		IPositionMember iPosiMember = PositionMemberFactory.getRemoteInstance();
		posiMemberColl = iPosiMember
				.getPositionMemberCollection(getPMEntityViewInfo(personId));
		return posiMemberColl;
	}

	public void checkDeducation(KDActionEvent event) throws BOSException,
			SQLException {
		HttpServletRequest request = event.getReqeustContext()
				.getHttpServletRequest();
		String applicant = null;
		String supplier = null;
		String bizType = null;
		if (request.getParameter("applicant") == null
				|| "".equals(request.getParameter("applicant").toString())) {
			throw new BOSException("申请人不能为空");
		} else {
			applicant = request.getParameter("applicant");
		}
		applicant = request.getParameter("supplier");
		if (request.getParameter("bizType") == null
				|| "".equals(request.getParameter("bizType").toString())) {
			throw new BOSException("业务类型不能为空");
		} else {
			bizType = request.getParameter("bizType");
		}
		StringBuffer sql = new StringBuffer();
		sql
				.append(
						"SELECT  t2.fid,T2.FNUMBER,t2.fbizdate,t2.CFRemark,T3.FNAME_L2 as applicant,t4.fname_l2 as supplier,T2.CFFineType,T1.FSEQ,T1.CFBizType,T1.CFUnCancledAmt,T1.CFCancledAmt,t1.CFActualPayee  FROM CT_OTH_DeducationE1 T1 ")
				.append(
						"  LEFT JOIN  CT_OTH_Deducation T2 ON T1.FPARENTID = T2.fid  ")
				.append(
						" LEFT join T_BD_Person T3 ON T2.CFAppPerpleID = T3.FID ")
				.append(
						" LEFT JOIN T_BD_Supplier T4 ON T1.CFSupplierID = T4.FID")
				.append(" WHERE T2.CFAppPerpleID = '").append(applicant)
				.append("' ");
		if (supplier != null) {
			sql.append(" and t1.CFSupplierID = '").append(supplier).append("'");
		}
		sql
				.append(" and t1.CFBizType = ")
				.append(bizType)
				.append(
						" and t2.CFBillState = 4 and (t2.CFFineType = 1 or t2.CFFineType = 2)");
		ISQLExecutor isqlEmployeeType = SQLExecutorFactory
				.getRemoteInstance(sql.toString());
		IRowSet rowSet = isqlEmployeeType.executeSQL();
		Map result = new HashMap();
		Map rowMap = null;
		List rows = new ArrayList();
		while (rowSet.next()) {
			rowMap = new ConcurrentHashMap();
			String number = rowSet.getString("FNUMBER");
			String bizDate = rowSet.getString("fbizdate");
			String remark = rowSet.getString("CFRemark");
			String applicantName = rowSet.getString("applicant");
			String supplierName = rowSet.getString("supplier");
			int fineType = rowSet.getInt("CFFineType");
			int type = rowSet.getInt("CFBizType");
			int seq = rowSet.getInt("FSEQ");
			BigDecimal unCancledAmt = rowSet.getBigDecimal("CFUnCancledAmt");
			BigDecimal cancledAmt = rowSet.getBigDecimal("CFCancledAmt");
			String CFActualPayee = rowSet.getString("CFActualPayee");
			rowMap.put("number", number);
			rowMap.put("bizDate", bizDate);
			rowMap.put("appPerple", applicantName);
			rowMap.put("remark", remark);
			rowMap.put("fineType", fineType);
			rowMap.put("seq", seq);
			rowMap.put("bizType", type);
			rowMap.put("supplier", supplierName);
			rowMap.put("actualPayee", CFActualPayee);
			rowMap.put("unCancledAmt", unCancledAmt);
			rowMap.put("cancledAmt", cancledAmt);
			rowMap.put("entryID", rowSet.getString("fid"));
			rows.add(rowMap);
		}
		JSONUtils.SUCCESS(rows);
	}

	private EntityViewInfo getPMEntityViewInfo(BOSUuid personId)
			throws EASBizException, BOSException {
		FilterInfo filter = new FilterInfo();
		FilterItemInfo filterItemPosi = new FilterItemInfo("person.id",
				personId.toString().trim());
		filter.getFilterItems().add(filterItemPosi);
		EntityViewInfo viewInfo = new EntityViewInfo();
		viewInfo.setFilter(filter);
		viewInfo.getSelector().add(new SelectorItemInfo("id"));
		viewInfo.getSelector().add(new SelectorItemInfo("isPrimary"));
		viewInfo.getSelector().add(new SelectorItemInfo("position.id"));
		viewInfo.getSelector().add(new SelectorItemInfo("position.name"));
		viewInfo.getSelector().add(
				new SelectorItemInfo("position.adminOrgUnit.id"));
		viewInfo.getSelector().add(
				new SelectorItemInfo("position.adminOrgUnit.name"));
		return viewInfo;
	}
	public void stafffilter(KDActionEvent event) throws EASBizException, BOSException { 
		  Context ctx = WafContext.getInstance().getContext();
		  BizCollBillBaseInfo baseInfo = CommonUtilFacadeFactory.getRemoteInstance().forLoanBillCreateNewData();
		  CompanyOrgUnitInfo applierCompany = baseInfo.getApplierCompany();
		  String longNumber = applierCompany.getLongNumber();
		  StringBuffer ids=new StringBuffer();
		  StringBuffer orgids=new StringBuffer();
		  HashMap<String,String> dataMap=new HashMap<String,String>();
	      StringBuffer sql = new 	StringBuffer();
	      sql.append("select t3.fid as id  from T_ORG_POSITIONMEMBER t1 ")
		      .append("inner join T_ORG_POSITION t2 on t1.FPOSITIONID =t2.fid ") 
		      .append( "inner join T_BD_PERSON t3 on t3.fid=t1.fpersonid ")
		     .append( "inner join t_org_admin t4 on t4.fid=t2.fadminorgunitid ")
		     .append("where  t4.FLONGNUMBER  like  '"+longNumber+"%'");
	     IRowSet rowSet = DbUtil.executeQuery(ctx, sql.toString());
     	  try {
					while (rowSet.next()) {
						String fid = rowSet.getString("id");
						 ids.append("'").append(fid).append("',");
					} 
       	} catch (SQLException e) {
			// TODO Auto-generated catch block
			   throw new BOSException(e);
		   }
       	
       	sql.setLength(0);
     
       	sql.append("select fid from T_ORG_COSTCENTER where FLONGNUMBER like '").append(longNumber).append("%'")
       	.append(" and  fid in  (select a.fid from T_ORG_BaseUnit a left join T_ORG_OUPartCostCenter b ON A.FPARTCOSTCENTERID = B.FID where b.FISBIZUNIT=1)" );
       
	       IRowSet rowSetOrg = DbUtil.executeQuery(ctx, sql.toString());
     	  try {
					while (rowSetOrg.next()) {
						String fid = rowSetOrg.getString("fid");
						orgids.append("'").append(fid).append("',");
					} 
       	} catch (SQLException e) {
			// TODO Auto-generated catch block
			   throw new BOSException(e);
		   }
       	
       	
       	 dataMap.put("ids", ids.length()>0?ids.substring(0, ids.length()-1):"");
       	 dataMap.put("orgids", orgids.length()>0?orgids.substring(0, orgids.length()-1):"");
			 String result = JSONUtils.convertObjectToJson(dataMap);
			 JSONUtils.SUCCESS(result, false);
     }
	 
}

 反审核功能前端

 

 

 反审核后后端

 

 反审核的后端代码    作者把多个单据的反审核逻辑 都放在这个类里了,通过不同的方法  参数来判断

package com.kingdee.eas.custom.wbfa.prescriptionprocedure;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.dao.query.SQLExecutorFactory;
import com.kingdee.bos.eventbus.event.action.IActionEventHandler;
import com.kingdee.bos.eventbus.event.action.KDActionEvent;
import com.kingdee.bos.webframework.dynamic.handler.AbstractWebEventHandler;
import com.kingdee.bos.webframework.exception.WafException;
import com.kingdee.bos.webframework.json.JSONUtils;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.CancellationSpecialFactory;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.CancellationSpecialInfo;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.DevelopmentFeeApplicationFactory;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.DevelopmentFeeApplicationInfo;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.DevelopmentVerificationFactory;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.DevelopmentVerificationInfo;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.MarketingActivityApplicationFactory;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.MarketingActivityApplicationInfo;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.SpecialBillsApplicationFactory;
import com.kingdee.eas.custom.wbfa.receipts.prescriptionprocedure.SpecialBillsApplicationInfo;
import com.kingdee.eas.custom.wbfa.receipts.util.SupplyUtil;
import com.kingdee.jdbc.rowset.IRowSet;

public class UnAuditServiceHandler extends AbstractWebEventHandler implements IActionEventHandler {
	public void onAction(KDActionEvent event) throws WafException,BOSException {
		HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
	    try {
		    super.getClass().getMethod(request.getParameter("_method"),new Class[] { KDActionEvent.class }).invoke(this,new Object[] { event });
	    } catch (Exception e) {
		    JSONUtils.ERROR(e.getCause().getMessage(), e);
		    throw new WafException(e);
	      }
	}
		  /***
		   * 借款申请反审核
		   * @param event
		   * @throws EASBizException
		   * @throws BOSException
		   */
	 public void special_rejected(KDActionEvent event) throws EASBizException, BOSException {
		  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			 String billId =request.getParameter("billId");
			 try {
				 SpecialBillsApplicationInfo specialBillsApplicationInfo=SpecialBillsApplicationFactory.getRemoteInstance().getSpecialBillsApplicationInfo(new ObjectUuidPK(billId));
				// SpecialBillsApplicationFactory.getRemoteInstance().rejected(specialBillsApplicationInfo);
				} catch (EASBizException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					throw new WafException(e);
		      }
	 }
	
	  public void special_audit(KDActionEvent event) throws EASBizException, BOSException {
		  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			 String billId =request.getParameter("billId");
			 String djzt =request.getParameter("djzt");
			  
			try {
				 if("-1".equals(djzt)){
					 throw new  BOSException("该单据没有保存或提交不能反审核");
				 }
				 SpecialBillsApplicationInfo  specialBillsApplicationInfo=SpecialBillsApplicationFactory.getRemoteInstance().getSpecialBillsApplicationInfo(new ObjectUuidPK(billId));
				SpecialBillsApplicationFactory.getRemoteInstance().audio( specialBillsApplicationInfo);
			} catch (EASBizException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				throw new WafException(e);
	      }
	  }
	  public void special_unAudit(KDActionEvent event) throws EASBizException, BOSException {
		     HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			 String billId =request.getParameter("billId");
			 String djzt =request.getParameter("djzt");
			 try {
				 if("-1".equals(djzt)){
					 throw new  BOSException("该单据没有保存或提交不能反审核");
				 }
				 SpecialBillsApplicationInfo  specialBillsApplicationInfo=SpecialBillsApplicationFactory.getRemoteInstance().getSpecialBillsApplicationInfo(new ObjectUuidPK(billId));
				SpecialBillsApplicationFactory.getRemoteInstance().unAudio( specialBillsApplicationInfo);
			} catch (EASBizException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				throw new WafException(e);
	      }
	  }  
	  public  void special_close(KDActionEvent event) throws BOSException {
		// TODO Auto-generated method stub
		  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			 String billId =request.getParameter("billId");
			 try {
				 SpecialBillsApplicationInfo specialBillsApplicationInfo=SpecialBillsApplicationFactory.getRemoteInstance().getSpecialBillsApplicationInfo(new ObjectUuidPK(billId));
				SpecialBillsApplicationFactory.getRemoteInstance().close( specialBillsApplicationInfo);
				} catch (EASBizException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					throw new WafException(e);
		      }
	}
	  
	  public void special_unClose(KDActionEvent event) throws BOSException {
		// TODO Auto-generated method stub
		   HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			 String billId =request.getParameter("billId");
			 try {
				 SpecialBillsApplicationInfo specialBillsApplicationInfo=SpecialBillsApplicationFactory.getRemoteInstance().getSpecialBillsApplicationInfo(new ObjectUuidPK(billId));
				 SpecialBillsApplicationFactory.getRemoteInstance().unClose( specialBillsApplicationInfo);
				} catch (EASBizException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					throw new WafException(e);
		      }
	}
	
		  

		  /***
		   * 处方类开发费申请  审核 反审核、关闭、反关闭
		   * @param event DevelopmentFeeApplication
		   * @throws EASBizException
		   * @throws BOSException
		   */
		  public void development_audit(KDActionEvent event) throws EASBizException, BOSException {
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
				 String billId =request.getParameter("billId");
				 String djzt =request.getParameter("djzt");
				  
				try {
					 if("-1".equals(djzt)){
						 throw new  BOSException("该单据没有保存或提交不能反审核");
					 }
					 DevelopmentFeeApplicationInfo developmentFeeApplicationInfo=DevelopmentFeeApplicationFactory.getRemoteInstance().getDevelopmentFeeApplicationInfo(new ObjectUuidPK(billId));
					 DevelopmentFeeApplicationFactory.getRemoteInstance().audit(developmentFeeApplicationInfo);
				} catch (EASBizException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					throw new WafException(e);
		      }
		  }
		  public void development_unAudit(KDActionEvent event) throws EASBizException, BOSException {
			     HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
				 String billId =request.getParameter("billId");
				 String djzt =request.getParameter("djzt");
				 try {
					 if("-1".equals(djzt)){
						 throw new  BOSException("该单据没有保存或提交不能反审核");
					 }
					 DevelopmentFeeApplicationInfo developmentFeeApplicationInfo=DevelopmentFeeApplicationFactory.getRemoteInstance().getDevelopmentFeeApplicationInfo(new ObjectUuidPK(billId));
					DevelopmentFeeApplicationFactory.getRemoteInstance().unAudit(developmentFeeApplicationInfo);
				} catch (EASBizException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					throw new WafException(e);
		      }
		  }  
		  public  void development_close(KDActionEvent event) throws BOSException {
			// TODO Auto-generated method stub
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
				 String billId =request.getParameter("billId");
				 try {
					 DevelopmentFeeApplicationInfo developmentFeeApplicationInfo=DevelopmentFeeApplicationFactory.getRemoteInstance().getDevelopmentFeeApplicationInfo(new ObjectUuidPK(billId));
						DevelopmentFeeApplicationFactory.getRemoteInstance().close(developmentFeeApplicationInfo);
					} catch (EASBizException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
						throw new WafException(e);
			      }
		}
		  
		  public void development_unClose(KDActionEvent event) throws BOSException {
			// TODO Auto-generated method stub
			   HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
				 String billId =request.getParameter("billId");
				 try {
					 DevelopmentFeeApplicationInfo developmentFeeApplicationInfo=DevelopmentFeeApplicationFactory.getRemoteInstance().getDevelopmentFeeApplicationInfo(new ObjectUuidPK(billId));
					 DevelopmentFeeApplicationFactory.getRemoteInstance().unClose(developmentFeeApplicationInfo);
					} catch (EASBizException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
						throw new WafException(e);
			      }
		}
		  
		  
		  
		  /***
		   * 事业部市场活动申请  审核 反审核、关闭、反关闭
		   * @param event MarketingActivityApplication
		   * @throws EASBizException
		   * @throws BOSException
		   */
		  public void marketing_audit(KDActionEvent event) throws EASBizException, BOSException {
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String billId =request.getParameter("billId");
			  String djzt =request.getParameter("djzt");
			  
			  try {
				  if("-1".equals(djzt)){
					  throw new  BOSException("该单据没有保存或提交不能反审核");
				  }
				  MarketingActivityApplicationInfo marketingActivityApplicationInfo=MarketingActivityApplicationFactory.getRemoteInstance().getMarketingActivityApplicationInfo(new ObjectUuidPK(billId));
				  MarketingActivityApplicationFactory.getRemoteInstance().audit(marketingActivityApplicationInfo);
			  } catch (EASBizException e) {
				  // TODO Auto-generated catch block
				  e.printStackTrace();
				  throw new WafException(e);
			  }
		  }
		  public void marketing_unAudit(KDActionEvent event) throws EASBizException, BOSException {
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String billId =request.getParameter("billId");
			  String djzt =request.getParameter("djzt");
			  try {
				  if("-1".equals(djzt)){
					  throw new  BOSException("该单据没有保存或提交不能反审核");
				  }
				  MarketingActivityApplicationInfo marketingActivityApplicationInfo=MarketingActivityApplicationFactory.getRemoteInstance().getMarketingActivityApplicationInfo(new ObjectUuidPK(billId));
				  MarketingActivityApplicationFactory.getRemoteInstance().unAudit(marketingActivityApplicationInfo);
			  } catch (EASBizException e) {
				  // TODO Auto-generated catch block
				  e.printStackTrace();
				  throw new WafException(e);
			  }
		  }  
		  public  void marketing_close(KDActionEvent event) throws BOSException {
			  // TODO Auto-generated method stub
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String billId =request.getParameter("billId");
			  try {
				  MarketingActivityApplicationInfo marketingActivityApplicationInfo=MarketingActivityApplicationFactory.getRemoteInstance().getMarketingActivityApplicationInfo(new ObjectUuidPK(billId));
				  MarketingActivityApplicationFactory.getRemoteInstance().close(marketingActivityApplicationInfo);
			  } catch (EASBizException e) {
				  // TODO Auto-generated catch block
				  e.printStackTrace();
				  throw new WafException(e);
			  }
		  }
		  
		  public void marketing_unClose(KDActionEvent event) throws BOSException {
			  // TODO Auto-generated method stub
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String billId =request.getParameter("billId");
			  try {
				  MarketingActivityApplicationInfo marketingActivityApplicationInfo=MarketingActivityApplicationFactory.getRemoteInstance().getMarketingActivityApplicationInfo(new ObjectUuidPK(billId));
				  MarketingActivityApplicationFactory.getRemoteInstance().unClose(marketingActivityApplicationInfo);
			  } catch (EASBizException e) {
				  // TODO Auto-generated catch block
				  e.printStackTrace();
				  throw new WafException(e);
			  }
		  }
		  
		  /***
		   * 特殊票据核销申请  审核 反审核、关闭、反关闭
		   * @param event CancellationSpecial
		   * @throws EASBizException
		   * @throws BOSException
		   */
		  public void cancell_audit(KDActionEvent event) throws EASBizException, BOSException {
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
				 String billId =request.getParameter("billId");
				 String djzt =request.getParameter("djzt");
				  
				try {
					 if("-1".equals(djzt)){
						 throw new  BOSException("该单据没有保存或提交不能反审核");
					 }
					 CancellationSpecialInfo CancellationSpecialinfo=CancellationSpecialFactory.getRemoteInstance().getCancellationSpecialInfo(new ObjectUuidPK(billId));
					 CancellationSpecialFactory.getRemoteInstance().audit(CancellationSpecialinfo);
				} catch (EASBizException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					throw new WafException(e);
		      }
		  }
		  public void cancell_unAudit(KDActionEvent event) throws EASBizException, BOSException {
			     HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
				 String billId =request.getParameter("billId");
				 String djzt =request.getParameter("djzt");
				 try {
					 if("-1".equals(djzt)){
						 throw new  BOSException("该单据没有保存或提交不能反审核");
					 }
					 CancellationSpecialInfo CancellationSpecialinfo=CancellationSpecialFactory.getRemoteInstance().getCancellationSpecialInfo(new ObjectUuidPK(billId));
					 CancellationSpecialFactory.getRemoteInstance().unAudit(CancellationSpecialinfo);
				} catch (EASBizException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					throw new WafException(e);
		      }
		  }  
		  public  void cancell_close(KDActionEvent event) throws BOSException {
			// TODO Auto-generated method stub
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
				 String billId =request.getParameter("billId");
				 try {
					 CancellationSpecialInfo CancellationSpecialinfo=CancellationSpecialFactory.getRemoteInstance().getCancellationSpecialInfo(new ObjectUuidPK(billId));
					 CancellationSpecialFactory.getRemoteInstance().close(CancellationSpecialinfo);
					} catch (EASBizException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
						throw new WafException(e);
			      }
		}
		  
		  public void cancell_unClose(KDActionEvent event) throws BOSException {
			// TODO Auto-generated method stub
			   HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
				 String billId =request.getParameter("billId");
				 try {
					 CancellationSpecialInfo CancellationSpecialinfo=CancellationSpecialFactory.getRemoteInstance().getCancellationSpecialInfo(new ObjectUuidPK(billId));
					 CancellationSpecialFactory.getRemoteInstance().unClose(CancellationSpecialinfo);
					} catch (EASBizException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
						throw new WafException(e);
			      }
		} 
		  
	
		  
		  /**
		   * 借款单分录中供应商改变会赋值给开户行和银行账号
		   * @param event
		   * @throws EASBizException
		   * @throws BOSException
		   */
		  public void supplierChange(KDActionEvent event) throws EASBizException, BOSException {
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String billId =request.getParameter("supplierId");
			  if(null==billId)return;
			  String sql ="/*dialect*/select nvl(a.fbank,'空') 开户银行,nvl(a.fbankaccount,'空') 银行账号 from T_BD_SupplierCompanyBank a left join T_BD_SupplierCompanyInfo b on a.FSupplierCompanyInfoID= b.fid where b.FSupplierID='"+billId+"'";
			  IRowSet rs = SQLExecutorFactory.getRemoteInstance(sql).executeSQL();
			  Map map = new HashMap();
			  try {
				while(rs.next()){
					  map.put("bank", rs.getString("开户银行"));
					  map.put("bankAccount", rs.getString("银行账号"));
				  }
			} catch (SQLException e) {
				e.printStackTrace();
			}
			  
			  JSONUtils.SUCCESS(map);
		  } 
		  
		  
		  public void employeeChange(KDActionEvent event) throws EASBizException, BOSException {
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String billId =request.getParameter("employeeId");
			  if(null==billId)return;
			  String sql ="/*dialect*/select nvl(cfbankName,'空') 开户银行,nvl(cfbankNo,'空') 银行账号 from CT_JIC_WithholdCompany a where cfemployeeid='"+billId+"'";
			  IRowSet rs = SQLExecutorFactory.getRemoteInstance(sql).executeSQL();
			  Map map = new HashMap();
			  try {
				while(rs.next()){
					  map.put("bank", rs.getString("开户银行"));
					  map.put("bankAccount", rs.getString("银行账号"));
				  }
			} catch (SQLException e) {
				e.printStackTrace();
			}
			  JSONUtils.SUCCESS(map);
		  } 
		  
		  
		  public void getBankInformation(KDActionEvent event) throws EASBizException, BOSException,Exception {
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String textSupplier =request.getParameter("textSupplier");
			  if(null==textSupplier)return;
			  SupplyUtil util=new SupplyUtil();
			  Map map = util.getBankInformation(textSupplier);
			  JSONUtils.SUCCESS(map);
		  }
		  
		  
		  public void jiekuanunAudit(KDActionEvent event) throws EASBizException, BOSException {
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String billId =request.getParameter("billId");
			  String djzt =request.getParameter("djzt");
			  try {
				  if("-1".equals(djzt)){
					  throw new  BOSException("该单据没有保存或提交不能反审核");
				  }
				  SpecialBillsApplicationInfo info=SpecialBillsApplicationFactory.getRemoteInstance().getSpecialBillsApplicationInfo(new ObjectUuidPK(billId));
				  SpecialBillsApplicationFactory.getRemoteInstance().unAudio(info);
			  } catch (EASBizException e) {
				  // TODO Auto-generated catch block
				  e.printStackTrace();
				  throw new WafException(e);
			  }
		  } 
		  
		  
		  
		  /***
		   * 处方类开发核销单  审核 反审核、关闭、反关闭
		   * @param event DevelopmentVerification
		   * @throws EASBizException
		   * @throws BOSException
		   */
		  public void deveVer_audit(KDActionEvent event) throws EASBizException, BOSException {
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String billId =request.getParameter("billId");
			  String djzt =request.getParameter("djzt");
			  
			  try {
				  if("-1".equals(djzt)){
					  throw new  BOSException("该单据没有保存或提交不能反审核");
				  }
				  DevelopmentVerificationInfo developmentVerificationinfo=DevelopmentVerificationFactory.getRemoteInstance().getDevelopmentVerificationInfo(new ObjectUuidPK(billId));
				  DevelopmentVerificationFactory.getRemoteInstance().audit(developmentVerificationinfo);
			  } catch (EASBizException e) {
				  // TODO Auto-generated catch block
				  e.printStackTrace();
				  throw new WafException(e);
			  }
		  }
		  public void deveVer_unAudit(KDActionEvent event) throws EASBizException, BOSException {
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String billId =request.getParameter("billId");
			  String djzt =request.getParameter("djzt");
			  try {
				  if("-1".equals(djzt)){
					  throw new  BOSException("该单据没有保存或提交不能反审核");
				  }
				  DevelopmentVerificationInfo developmentVerificationinfo=DevelopmentVerificationFactory.getRemoteInstance().getDevelopmentVerificationInfo(new ObjectUuidPK(billId));
				  DevelopmentVerificationFactory.getRemoteInstance().unAudit(developmentVerificationinfo);
			  } catch (EASBizException e) {
				  // TODO Auto-generated catch block
				  e.printStackTrace();
				  throw new WafException(e);
			  }
		  }  
		  public  void deveVer_close(KDActionEvent event) throws BOSException {
			  // TODO Auto-generated method stub
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String billId =request.getParameter("billId");
			  try {
				  DevelopmentVerificationInfo developmentVerificationinfo=DevelopmentVerificationFactory.getRemoteInstance().getDevelopmentVerificationInfo(new ObjectUuidPK(billId));
				  DevelopmentVerificationFactory.getRemoteInstance().close(developmentVerificationinfo);
			  } catch (EASBizException e) {
				  // TODO Auto-generated catch block
				  e.printStackTrace();
				  throw new WafException(e);
			  }
		  }
		  
		  public void deveVer_unClose(KDActionEvent event) throws BOSException {
			  // TODO Auto-generated method stub
			  HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
			  String billId =request.getParameter("billId");
			  try {
				  DevelopmentVerificationInfo developmentVerificationinfo=DevelopmentVerificationFactory.getRemoteInstance().getDevelopmentVerificationInfo(new ObjectUuidPK(billId));
				  DevelopmentVerificationFactory.getRemoteInstance().unClose(developmentVerificationinfo);
			  } catch (EASBizException e) {
				  // TODO Auto-generated catch block
				  e.printStackTrace();
				  throw new WafException(e);
			  }
		  } 
		  
		  
		  
	}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值