parent
334be111f5
commit
e76dc3245a
24 changed files with 206 additions and 132 deletions
File diff suppressed because one or more lines are too long
@ -1,64 +1,71 @@ |
|||||||
package com.ynxbd.wx.wxfactory.utils; |
package com.ynxbd.wx.wxfactory.utils; |
||||||
|
|
||||||
import com.ynxbd.common.result.ResultEnum; |
import com.ynxbd.common.bean.enums.MerchantEnum; |
||||||
import com.ynxbd.common.result.ServiceException; |
import com.ynxbd.common.result.ResultEnum; |
||||||
import lombok.extern.slf4j.Slf4j; |
import com.ynxbd.common.result.ServiceException; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
import java.util.HashMap; |
|
||||||
import java.util.Map; |
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
@Slf4j |
|
||||||
public class WxRespHelper { |
@Slf4j |
||||||
|
public class WxNotifyResp { |
||||||
/** |
public WxNotifyResp(MerchantEnum merchantEnum) { |
||||||
* 成功相应 |
this.merchantEnum = merchantEnum; |
||||||
*/ |
} |
||||||
public static String resp(ServiceException e) { |
|
||||||
if (ResultEnum.PAY_NOTIFY_REPEAT.equals(e.getResultEnum())) { |
public final MerchantEnum merchantEnum; |
||||||
return respOk(); |
|
||||||
} |
|
||||||
return respFail(e.getMessage()); |
/** |
||||||
} |
* 成功相应 |
||||||
|
*/ |
||||||
/** |
public String resp(ServiceException e) { |
||||||
* 成功响应 |
if (ResultEnum.PAY_NOTIFY_REPEAT.equals(e.getResultEnum())) { |
||||||
*/ |
return respOk(); |
||||||
public static String respOk() { |
} |
||||||
log.info("【微信回调】通知成功"); |
return respFail(e.getMessage()); |
||||||
try { |
} |
||||||
Map<String, Object> map = new HashMap<>(); |
|
||||||
map.put("return_code", "SUCCESS"); |
/** |
||||||
map.put("return_msg", "OK"); |
* 成功响应 |
||||||
return XmlHelper.mapToXml(map); |
*/ |
||||||
} catch (Exception e) { |
public String respOk() { |
||||||
e.printStackTrace(); |
log.info("【{}】通知成功", this.merchantEnum.NAME); |
||||||
} |
try { |
||||||
return null; |
Map<String, Object> map = new HashMap<>(); |
||||||
} |
map.put("return_code", "SUCCESS"); |
||||||
|
map.put("return_msg", "OK"); |
||||||
|
return XmlHelper.mapToXml(map); |
||||||
/** |
} catch (Exception e) { |
||||||
* 失败响应 |
log.error("", e); |
||||||
*/ |
} |
||||||
private static String respFail(String message) { |
return null; |
||||||
log.info("回调通知: {}", message); |
} |
||||||
if (message == null) { |
|
||||||
message = "FAIL"; |
|
||||||
} |
/** |
||||||
try { |
* 失败响应 |
||||||
Map<String, Object> map = new HashMap<>(); |
*/ |
||||||
map.put("return_code", "FAIL"); |
private String respFail(String message) { |
||||||
map.put("return_msg", message); |
log.info("【{}】回调通知: {}", this.merchantEnum.NAME, message); |
||||||
return XmlHelper.mapToXml(map); |
if (message == null) { |
||||||
} catch (Exception e) { |
message = "FAIL"; |
||||||
e.printStackTrace(); |
} |
||||||
} |
try { |
||||||
return null; |
Map<String, Object> map = new HashMap<>(); |
||||||
} |
map.put("return_code", "FAIL"); |
||||||
|
map.put("return_msg", message); |
||||||
// public static void main(String[] args) throws DocumentException {
|
return XmlHelper.mapToXml(map); |
||||||
//
|
} catch (Exception e) { |
||||||
// TestPay testPay = XmlHelper.xmlToBean(xml, TestPay.class);
|
log.error("", e); |
||||||
// System.out.println(testPay);
|
} |
||||||
// }
|
return null; |
||||||
} |
} |
||||||
|
|
||||||
|
// public static void main(String[] args) throws DocumentException {
|
||||||
|
//
|
||||||
|
// TestPay testPay = XmlHelper.xmlToBean(xml, TestPay.class);
|
||||||
|
// System.out.println(testPay);
|
||||||
|
// }
|
||||||
|
} |
||||||
Loading…
Reference in new issue