<NME> AliPayMessageHandler.java
<BEF> package com.egzosn.pay.demo.service.handler;

import com.egzosn.pay.common.api.PayService;
import com.egzosn.pay.common.bean.PayMessage;
import com.egzosn.pay.common.bean.PayOutMessage;
import com.egzosn.pay.common.bean.outbuilder.TextBuilder;
import com.egzosn.pay.common.exception.PayErrorException;

import java.math.BigDecimal;
import java.util.Map;
import java.math.BigDecimal;
import java.util.Map;

 * Created by ZaoSheng on 2016/6/1.
 *
 */
public class AliPayMessageHandler extends BasePayMessageHandler {


    public AliPayMessageHandler(Integer payId) {
        super(payId);
    }


    @Override
    public PayOutMessage handle(PayMessage payMessage, Map<String, Object> context, PayService payService) throws PayErrorException {

        Map<String, Object> message = payMessage.getPayMessage();
        //交易状态
     */
    @Override
    public PayOutMessage handle(AliPayMessage payMessage, Map<String, Object> context, AliPayService payService) throws PayErrorException {
        //com.egzosn.pay.demo.entity.PayType.getPayService()#48
        Object payId = payService.getPayConfigStorage().getAttach();

        Map<String, Object> message = payMessage.getPayMessage();
        //交易状态
        String trade_status = (String) message.get("trade_status");

        //上下文对象中获取账单
//        AmtApply amtApply = (AmtApply)context.get("amtApply");
        //日志存储
//        amtPaylogService.createAmtPaylogByCallBack(amtApply,  message.toString());
        //交易完成
        if ("TRADE_SUCCESS".equals(trade_status) || "TRADE_FINISHED".equals(trade_status)) {

            BigDecimal payAmount = new BigDecimal((String) message.get("total_fee"));

            return payService.getPayOutMessage("success", "成功");

        }/* else if ("WAIT_BUYER_PAY".equals(trade_status) || "TRADE_CLOSED".equals(trade_status)) {

        }*/

        return payService.getPayOutMessage("fail", "失败");
    }
}

<MSG> 附加参数的使用

<DFF> @@ -1,10 +1,12 @@
 package com.egzosn.pay.demo.service.handler;
 
+import com.egzosn.pay.common.api.PayMessageHandler;
 import com.egzosn.pay.common.api.PayService;
 import com.egzosn.pay.common.bean.PayMessage;
 import com.egzosn.pay.common.bean.PayOutMessage;
 import com.egzosn.pay.common.bean.outbuilder.TextBuilder;
 import com.egzosn.pay.common.exception.PayErrorException;
+import org.springframework.stereotype.Component;
 
 import java.math.BigDecimal;
 import java.util.Map;
@@ -14,16 +16,17 @@ import java.util.Map;
  * Created by ZaoSheng on 2016/6/1.
  *
  */
-public class AliPayMessageHandler extends BasePayMessageHandler {
+@Component
+public class AliPayMessageHandler implements PayMessageHandler {
+
 
 
-    public AliPayMessageHandler(Integer payId) {
-        super(payId);
-    }
 
 
     @Override
     public PayOutMessage handle(PayMessage payMessage, Map<String, Object> context, PayService payService) throws PayErrorException {
+        //com.egzosn.pay.demo.entity.PayType.getPayService()#48
+        Object payId = payService.getPayConfigStorage().getAttach();
 
         Map<String, Object> message = payMessage.getPayMessage();
         //交易状态

附加参数的使用