阅读更多
/*
* Copyright (c) 2016, S.F. Express Inc. All rights reserved.
*/
package com.sf.novatar.tpl.task;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.xml.datatype.XMLGregorianCalendar;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sf.novatar.tpl.base.TaskBase;
import com.sf.novatar.tpl.bean.PayBusiness;
import com.sf.novatar.tpl.dao.IPayBusinessDao;
import com.sf.novatar.tpl.dao.ISysConfigurationsDao;
import com.sf.novatar.tpl.dto.PayBusinessDto;
import com.sf.novatar.tpl.enums.PayBusinessCallbackStatusEnum;
import com.sf.novatar.tpl.enums.PayBusinessStatusEnum;
import com.sf.novatar.tpl.enums.PayTypeEnum;
import com.sf.novatar.tpl.util.B2EUtil;
import com.sf.novatar.tpl.util.CurrencyUtil;
import com.sf.novatar.tpl.util.TaskThreadPoolUtil;
import com.sf.novatar.tpl.ws.client.cbe.PaymentInServiceClient;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentReq;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentResp;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.GrpHdr;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.CdtTrfTxInf;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.CdtTrfTxInf.Amt;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.CdtTrfTxInf.Amt.InstdAmt;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.CdtTrfTxInf.Cdtr;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.CdtTrfTxInf.CdtrAcct;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.CdtTrfTxInf.CdtrAgt;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.CdtTrfTxInf.CdtrAgt.FinInstnId;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.CdtTrfTxInf.CdtrAgt.FinInstnId.ClrSysMmbId;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.CdtTrfTxInf.PmtId;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.CdtTrfTxInf.Purp;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.CdtTrfTxInf.RmtInf;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.DbtrAcct;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.DbtrAcct.Id;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.DbtrAcct.Id.Othr;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyReq.CstmrCdtTrfInitn.PmtInf.PmtTpInf;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyResp;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyResp.CstmrPmtStsRpt.OrgnlPmtInfAndSts;
import com.sf.novatar.tpl.ws.client.cbe.pay.DTPaymentSBodyResp.CstmrPmtStsRpt.OrgnlPmtInfAndSts.TxInfAndSts;
import com.sfpay.framework.base.exception.ServiceException;
/**
* 描述:
*
*
* HISTORY
* ****************************************************************************
* ID DATE PERSON REASON
* 1 2016年3月7日 601008 Create
* ****************************************************************************
*
*
* @author 601008
* @since 1.0
*/
@Service("payTask")
public class PayTask extends TaskBase {
@Autowired
private ISysConfigurationsDao sysConfigurationsDao;
@Override
public void processor() throws Exception {
boolean ok = lock.tryLock();
if (ok) {
try {
this.logger.info("================开始向银行提交支付指令===============");
List