Commit a9a5e089 authored by 周健威's avatar 周健威

修改代码

parent 18ebbb50
......@@ -88,8 +88,8 @@ public interface ThirdFeign {
/*************************************支付***************************************/
@PostMapping("/pay/app/unauth/transfer_account")
ObjectRestResponse<String> transferAccount(@RequestBody FundPayVo fundPayVo);
// @PostMapping("/pay/app/unauth/transfer_account")
// ObjectRestResponse<String> transferAccount(@RequestBody FundPayVo fundPayVo);
@GetMapping("/info/app/unauth/getAliPayUserInfo")
public ObjectRestResponse<String> getAliPayUserInfo(@RequestParam(value = "code")String code);
......
......@@ -51,30 +51,30 @@ public class WXSuppToUserPay {
private String spbill_create_ip;//Ip地址
private String key;
public static Map<String,String> WeiXinTiXian(String openid,String partnerTradeNo,String check_name,String amount,String desc,String spbill_create_ip)
{
WXSuppToUserPay prePay = new WXSuppToUserPay();
prePay.setMch_appid(SystemConfig.APP_ID);
prePay.setMchid(SystemConfig.APP_PARTNER);
prePay.setNonce_str( OrderUtil.CreateNoncestr());
prePay.setPartner_trade_no(partnerTradeNo);
prePay.setOpenid(openid);
prePay.setCheck_name(check_name);
prePay.setAmount(amount);
prePay.setDesc(desc);
prePay.setSpbill_create_ip(spbill_create_ip);
String result =postXML(suppTouser,prePay.getXMLTuiKuan());
result = result.replaceAll("<![CDATA[|]]>", "").replaceAll("支付成功", "pay sucess");
Map<String, String> map = null;
try {
map = XMLUtil.doXMLParse(result);
} catch (JDOMException e) {
throw new BaseException("微信转账参数xml解析错误",e);
} catch (IOException e) {
throw new BaseException("微信转账参数xml解析读写IO异常",e);
}
return map;
}
// public static Map<String,String> WeiXinTiXian(String openid,String partnerTradeNo,String check_name,String amount,String desc,String spbill_create_ip)
// {
// WXSuppToUserPay prePay = new WXSuppToUserPay();
// prePay.setMch_appid(SystemConfig.APP_ID);
// prePay.setMchid(SystemConfig.APP_PARTNER);
// prePay.setNonce_str( OrderUtil.CreateNoncestr());
// prePay.setPartner_trade_no(partnerTradeNo);
// prePay.setOpenid(openid);
// prePay.setCheck_name(check_name);
// prePay.setAmount(amount);
// prePay.setDesc(desc);
// prePay.setSpbill_create_ip(spbill_create_ip);
// String result =postXML(suppTouser,prePay.getXMLTuiKuan());
// result = result.replaceAll("<![CDATA[|]]>", "").replaceAll("支付成功", "pay sucess");
// Map<String, String> map = null;
// try {
// map = XMLUtil.doXMLParse(result);
// } catch (JDOMException e) {
// throw new BaseException("微信转账参数xml解析错误",e);
// } catch (IOException e) {
// throw new BaseException("微信转账参数xml解析读写IO异常",e);
// }
// return map;
// }
public static String postXML(String uri, String xml) {
CloseableHttpClient httpclient = null;
try {
......@@ -183,39 +183,39 @@ public class WXSuppToUserPay {
public String getXMLTuiKuan(){
TreeMap<String, String> treeMap = new TreeMap<String, String>();
treeMap.put("mch_appid", this.mch_appid);
treeMap.put("mchid", this.mchid);
treeMap.put("nonce_str", this.nonce_str);
treeMap.put("partner_trade_no", this.partner_trade_no);
treeMap.put("openid", this.openid);
treeMap.put("check_name", this.check_name);
//treeMap.put("re_user_name", this.re_user_name);
treeMap.put("amount", this.amount);
treeMap.put("desc", this.desc);
treeMap.put("spbill_create_ip", this.spbill_create_ip);
//treeMap.put("key", this.key);
//treeMap.put("sign", this.sign);
StringBuilder sb = new StringBuilder();
for (String key : treeMap.keySet()) {
sb.append(key).append("=").append(treeMap.get(key)).append("&");
}
sb.append("key=" + SystemConfig.WINXIN_PARTNER_KEY);
sign = MD5Util.MD5Encode(sb.toString(), "utf-8").toUpperCase();
treeMap.put("sign", sign);
StringBuilder xml = new StringBuilder();
xml.append("<xml>\n");
for (Map.Entry<String, String> entry : treeMap.entrySet()) {
if ("body".equals(entry.getKey()) || "sign".equals(entry.getKey())) {
xml.append("<" + entry.getKey() + "><![CDATA[").append(entry.getValue()).append("]]></" + entry.getKey() + ">\n");
} else {
xml.append("<" + entry.getKey() + ">").append(entry.getValue()).append("</" + entry.getKey() + ">\n");
}
}
xml.append("</xml>");
return xml.toString();
}
// public String getXMLTuiKuan(){
// TreeMap<String, String> treeMap = new TreeMap<String, String>();
// treeMap.put("mch_appid", this.mch_appid);
// treeMap.put("mchid", this.mchid);
// treeMap.put("nonce_str", this.nonce_str);
// treeMap.put("partner_trade_no", this.partner_trade_no);
// treeMap.put("openid", this.openid);
// treeMap.put("check_name", this.check_name);
// //treeMap.put("re_user_name", this.re_user_name);
// treeMap.put("amount", this.amount);
// treeMap.put("desc", this.desc);
// treeMap.put("spbill_create_ip", this.spbill_create_ip);
// //treeMap.put("key", this.key);
// //treeMap.put("sign", this.sign);
// StringBuilder sb = new StringBuilder();
// for (String key : treeMap.keySet()) {
// sb.append(key).append("=").append(treeMap.get(key)).append("&");
// }
// sb.append("key=" + SystemConfig.WINXIN_PARTNER_KEY);
// sign = MD5Util.MD5Encode(sb.toString(), "utf-8").toUpperCase();
// treeMap.put("sign", sign);
// StringBuilder xml = new StringBuilder();
// xml.append("<xml>\n");
// for (Map.Entry<String, String> entry : treeMap.entrySet()) {
// if ("body".equals(entry.getKey()) || "sign".equals(entry.getKey())) {
// xml.append("<" + entry.getKey() + "><![CDATA[").append(entry.getValue()).append("]]></" + entry.getKey() + ">\n");
// } else {
// xml.append("<" + entry.getKey() + ">").append(entry.getValue()).append("</" + entry.getKey() + ">\n");
// }
// }
// xml.append("</xml>");
// return xml.toString();
// }
public String getMch_appid() {
......
......@@ -498,27 +498,27 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
}
}
/**
* 转账功能 微信 | 支付宝
*
* @param fundPayVo
* @return
* @throws Exception
*/
public String fundTrans(FundPayVo fundPayVo) throws BaseException {
String cono = OrderUtil.GetOrderNumber("");
fundPayVo.setOutBizNo(cono);
if (fundPayVo.getType() == PayWay.WX_PAY.getCode()) {
//微信
fundPayVo.setCheckName("NO_CHECK");
return wxpayfundTrans(fundPayVo);
}
if (fundPayVo.getType() == PayWay.ALI_PAY.getCode()) {
//支付宝
return alipayfundTrans(getAlipayClient(), fundPayVo);
}
throw new BaseException("提现方式不对");
}
// /**
// * 转账功能 微信 | 支付宝
// *
// * @param fundPayVo
// * @return
// * @throws Exception
// */
// public String fundTrans(FundPayVo fundPayVo) throws BaseException {
// String cono = OrderUtil.GetOrderNumber("");
// fundPayVo.setOutBizNo(cono);
// if (fundPayVo.getType() == PayWay.WX_PAY.getCode()) {
// //微信
// fundPayVo.setCheckName("NO_CHECK");
// return wxpayfundTrans(fundPayVo);
// }
// if (fundPayVo.getType() == PayWay.ALI_PAY.getCode()) {
// //支付宝
// return alipayfundTrans(getAlipayClient(), fundPayVo);
// }
// throw new BaseException("提现方式不对");
// }
/**
* 支付宝转账功能 单笔最小转账0.1 最大小数点位数前支持13位,实际限额和签约一致
......@@ -549,13 +549,13 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
}
}
public String wxpayfundTrans(FundPayVo fundPayVo) {
Map<String, String> map = WXSuppToUserPay.WeiXinTiXian(fundPayVo.getPayeeAccount(), fundPayVo.getOutBizNo(), fundPayVo.getCheckName(), fundPayVo.getAmount(), fundPayVo.getRemark(), fundPayVo.getCreatIp());
if (SUCCESS.equals(map.get(WxResponseProperties.RETURN_CODE)) && SUCCESS.equals(map.get(WxResponseProperties.RESULT_CODE))) {
return map.get(WxResponseProperties.PARTNER_TRADE_NO);
}
throw new BaseException(map.get(WxResponseProperties.ERR_CODE_DES), map.get(WxResponseProperties.ERROR_CODE));
}
// public String wxpayfundTrans(FundPayVo fundPayVo) {
// Map<String, String> map = WXSuppToUserPay.WeiXinTiXian(fundPayVo.getPayeeAccount(), fundPayVo.getOutBizNo(), fundPayVo.getCheckName(), fundPayVo.getAmount(), fundPayVo.getRemark(), fundPayVo.getCreatIp());
// if (SUCCESS.equals(map.get(WxResponseProperties.RETURN_CODE)) && SUCCESS.equals(map.get(WxResponseProperties.RESULT_CODE))) {
// return map.get(WxResponseProperties.PARTNER_TRADE_NO);
// }
// throw new BaseException(map.get(WxResponseProperties.ERR_CODE_DES), map.get(WxResponseProperties.ERROR_CODE));
// }
/**
......
......@@ -121,17 +121,17 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
return baseBiz.updateStatus(orderPay);
}
@PostMapping("/app/unauth/transfer_account")
@IgnoreUserToken
public ObjectRestResponse<String> transferAccount(@RequestBody FundPayVo fundPayVo){
try {
String pay_no = baseBiz.fundTrans(fundPayVo);
return ObjectRestResponse.succ(pay_no);
}catch (Exception ex){
return ObjectRestResponse.createFailedResult(400,ex.getMessage());
}
}
// @PostMapping("/app/unauth/transfer_account")
// @IgnoreUserToken
// public ObjectRestResponse<String> transferAccount(@RequestBody FundPayVo fundPayVo){
// try {
// String pay_no = baseBiz.fundTrans(fundPayVo);
// return ObjectRestResponse.succ(pay_no);
// }catch (Exception ex){
// return ObjectRestResponse.createFailedResult(400,ex.getMessage());
// }
//
// }
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment