1
zyy
8 days ago 51367edc95873b499d78eff1c2db59de328a27f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.nq;
 
import com.nq.common.ServerResponse;
import com.nq.pay.PayUtil;
import com.nq.utils.timeutil.DateTimeUtil;
import com.nq.utils.http.HttpClientUtil;
import com.nq.utils.SignAPI;
import com.nq.utils.SignUtil;
import org.apache.commons.collections.map.HashedMap;
 
import java.util.Map;
 
import static com.nq.utils.timeutil.DateTimeUtil.STANDARD_FORMAT;
 
public class Text {
    public static void main(String[] args) {
 
    }
 
 
    public ServerResponse rechargMethodTop3(String  ordersn, String  payAmt){
        Map<String,String> map = new HashedMap();
        map.put("version","1.0");
        map.put("mch_id","400019556");
        map.put("notify_url","http://www.jumptalk.net:8091/api/pay/flyNotify.do");
        map.put("mch_order_no",ordersn);
        map.put("pay_type","122");
        map.put("trade_amount",payAmt);
        map.put("order_date", DateTimeUtil.getCurrentDate(STANDARD_FORMAT));
        map.put("goods_name","充值");
        String signStr = SignUtil.sortData(map);
        map.put("sign_type","MD5");
        try {
            map.put("sign", SignAPI.sign(signStr, PayUtil.DOWN_TOKEN_TPO1));
            String reponse = HttpClientUtil.doPost(PayUtil.PAY_DOWN_ORDER_TOP1, map, "utf-8");
            com.alibaba.fastjson.JSONObject  object = com.alibaba.fastjson.JSONObject.parseObject(reponse);
            if(object.getString("respCode").equals("SUCCESS")){
                return ServerResponse.createBySuccess(object.getString("payInfo"));
            }else {
                return ServerResponse.createBySuccessMsg("Contact customer service");
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return ServerResponse.createByError();
    }
}