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

修改代码

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