|  | @@ -0,0 +1,122 @@
 | 
	
		
			
				|  |  | +package nccloud.web.cmp.billmanagement.paybills.action;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | +import java.util.Map;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import nc.bs.framework.common.NCLocator;
 | 
	
		
			
				|  |  | +import nc.bs.logging.Logger;
 | 
	
		
			
				|  |  | +import nc.impl.pubapp.pattern.data.vo.VOQuery;
 | 
	
		
			
				|  |  | +import nc.itf.uap.IVOPersistence;
 | 
	
		
			
				|  |  | +import nc.vo.cmp.bill.BillAggVO;
 | 
	
		
			
				|  |  | +import nc.vo.cmp.bill.BillDetailVO;
 | 
	
		
			
				|  |  | +import nc.vo.cmp.bill.BillVO;
 | 
	
		
			
				|  |  | +import nc.vo.cmp.informer.InformerVO;
 | 
	
		
			
				|  |  | +import nc.vo.pub.BusinessException;
 | 
	
		
			
				|  |  | +import nc.vo.pub.lang.UFDouble;
 | 
	
		
			
				|  |  | +import nc.vo.tmpub.util.StringUtil;
 | 
	
		
			
				|  |  | +import nccloud.framework.core.exception.ExceptionUtils;
 | 
	
		
			
				|  |  | +import nccloud.framework.service.ServiceLocator;
 | 
	
		
			
				|  |  | +import nccloud.framework.web.ui.pattern.billcard.BillCard;
 | 
	
		
			
				|  |  | +import nccloud.itf.tmpub.util.PerformanceLog;
 | 
	
		
			
				|  |  | +import nccloud.pubitf.cmp.paybill.IPaybillMgrServiceForNCC;
 | 
	
		
			
				|  |  | +import nccloud.pubitf.cmp.paybill.PaybillSagaInfoAdapter;
 | 
	
		
			
				|  |  | +import nccloud.pubitf.tmpub.pub.ISagasBizService;
 | 
	
		
			
				|  |  | +import nccloud.web.cmp.billmanagement.paybills.common.PaybillsUtil;
 | 
	
		
			
				|  |  | +import nccloud.web.tmpub.action.AbstrSaveCommitAction;
 | 
	
		
			
				|  |  | +import nccloud.web.tmpub.pub.ms.util.SagasBizUtil;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +public class PaybillSaveCommitAction extends AbstrSaveCommitAction<BillAggVO> {
 | 
	
		
			
				|  |  | +	private final String PARAM_CONTENT = "content";
 | 
	
		
			
				|  |  | +	protected PerformanceLog btplog = new PerformanceLog();
 | 
	
		
			
				|  |  | +	private static volatile ISagasBizService bizService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	protected static ISagasBizService getISagasBizService() {
 | 
	
		
			
				|  |  | +		if (bizService == null) {
 | 
	
		
			
				|  |  | +			Class var0 = ISagasBizService.class;
 | 
	
		
			
				|  |  | +			synchronized (ISagasBizService.class) {
 | 
	
		
			
				|  |  | +				if (bizService == null) {
 | 
	
		
			
				|  |  | +					return (ISagasBizService) ServiceLocator.find(ISagasBizService.class);
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		return bizService;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	protected Object doSaveCommit(BillAggVO aggVO, Map<String, String> extParam) throws BusinessException {
 | 
	
		
			
				|  |  | +		try {
 | 
	
		
			
				|  |  | +			this.btplog.start("baocuntijiao-zhurusagaxinxi");
 | 
	
		
			
				|  |  | +			SagasBizUtil.setOperInfo("36070PBR_D5_card", "savecommit");
 | 
	
		
			
				|  |  | +			getISagasBizService().checkFrozen(new PaybillSagaInfoAdapter(), aggVO.getPrimaryKey());
 | 
	
		
			
				|  |  | +			this.btplog.end("baocuntijiao-zhurusagaxinxi");
 | 
	
		
			
				|  |  | +		} catch (Exception var5) {
 | 
	
		
			
				|  |  | +			Logger.error(var5);
 | 
	
		
			
				|  |  | +			ExceptionUtils.wrapException(var5);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		BillVO headvo=(BillVO) aggVO.getParentVO();
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		if (null != aggVO.getParentVO()) {
 | 
	
		
			
				|  |  | +			((BillVO) aggVO.getParentVO()).setBill_status(-10);
 | 
	
		
			
				|  |  | +			((BillVO) aggVO.getParentVO()).setBill_type("F5");
 | 
	
		
			
				|  |  | +			BillDetailVO[] detailvos = (BillDetailVO[]) aggVO.getChildrenVO();
 | 
	
		
			
				|  |  | +			for (BillDetailVO detailvo: detailvos) {
 | 
	
		
			
				|  |  | +				detailvo.setBill_type("F5");
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		if (null != headvo.getDef11()) {
 | 
	
		
			
				|  |  | +	    	if(!headvo.getDef12().equals("")) {
 | 
	
		
			
				|  |  | +	    		UFDouble srcmoney = new UFDouble(headvo.getDef12());
 | 
	
		
			
				|  |  | +	    		if(!srcmoney.equals(headvo.getPrimal_money())) {
 | 
	
		
			
				|  |  | +	    			ExceptionUtils.wrapBusinessException("付款金额和到账通知的金额不等,请检验。 ");
 | 
	
		
			
				|  |  | +	    		}
 | 
	
		
			
				|  |  | +	    	}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		this.btplog.start("baocuntijiao-yewu xinxi hebing");
 | 
	
		
			
				|  |  | +		PaybillsUtil.Paybills2BusiAgg(aggVO);
 | 
	
		
			
				|  |  | +		this.btplog.end("baocuntijiao-yewu xinxi hebing");
 | 
	
		
			
				|  |  | +		String contentStr = (String) extParam.get("content");
 | 
	
		
			
				|  |  | +		JSONObject assign = StringUtil.isNull(contentStr) ? null : (JSONObject) JSON.parse(contentStr);
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		Object  objet= this.getNCCService().doSaveCommit(aggVO, assign);
 | 
	
		
			
				|  |  | +		if (null != headvo.getDef11()) {
 | 
	
		
			
				|  |  | +	    	 VOQuery<InformerVO> querysordr = new VOQuery<InformerVO>(InformerVO.class);
 | 
	
		
			
				|  |  | +	         //到账通知发布主表
 | 
	
		
			
				|  |  | +	    	 String [] pks=new String[] {headvo.getDef11()};
 | 
	
		
			
				|  |  | +	   	     InformerVO[] informerVO = querysordr.query(pks);
 | 
	
		
			
				|  |  | +	    	 informerVO[0].setGenerateflag("hasgenerate");//已生成
 | 
	
		
			
				|  |  | +	    	 informerVO[0].setUsemoney(headvo.getPrimal_money());//赎回金额--付款原币金额(付款结算)
 | 
	
		
			
				|  |  | +	    	 informerVO[0].setPk_claimer(headvo.getBillmaker());//认证人
 | 
	
		
			
				|  |  | +	    	 informerVO[0].setClaimdate(headvo.getBill_date());//认证日期
 | 
	
		
			
				|  |  | +	    	 informerVO[0].setPk_lower(headvo.getPk_paybill());//主键
 | 
	
		
			
				|  |  | +	    	 informerVO[0].setLowerbilltype("F5");
 | 
	
		
			
				|  |  | +	    	 informerVO[0].setDr(0);
 | 
	
		
			
				|  |  | +	    	 
 | 
	
		
			
				|  |  | +	    	 IVOPersistence ivopce=(IVOPersistence) NCLocator.getInstance().lookup(IVOPersistence.class.getName());
 | 
	
		
			
				|  |  | +	    	 
 | 
	
		
			
				|  |  | +	    	 try {
 | 
	
		
			
				|  |  | +				ivopce.updateVO(informerVO[0]);
 | 
	
		
			
				|  |  | +			} catch (BusinessException e) {
 | 
	
		
			
				|  |  | +				// TODO Auto-generated catch block
 | 
	
		
			
				|  |  | +			   ExceptionUtils.wrapBusinessException(e.getMessage());
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		
 | 
	
		
			
				|  |  | +		return objet;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	protected Class<?> getFrontDataClass() {
 | 
	
		
			
				|  |  | +		return BillCard.class;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	protected IPaybillMgrServiceForNCC getNCCService() {
 | 
	
		
			
				|  |  | +		return (IPaybillMgrServiceForNCC) ServiceLocator.find(IPaybillMgrServiceForNCC.class);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	protected Object beforeReturn(Object billcard) throws BusinessException {
 | 
	
		
			
				|  |  | +		PaybillsUtil.afterProcess((BillCard) billcard);
 | 
	
		
			
				|  |  | +		PaybillsUtil.sourceFlagTranslate((BillCard) billcard);
 | 
	
		
			
				|  |  | +		return billcard;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +}
 |