parent
e3522163c1
commit
3d36e15159
11 changed files with 270 additions and 104 deletions
@ -0,0 +1,100 @@ |
||||
package com.ynxbd.jy.helper; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.ynxbd.common.bean.enums.MerchantEnum; |
||||
import com.ynxbd.common.helper.common.ErrorHelper; |
||||
import com.ynxbd.common.helper.common.JsonHelper; |
||||
import com.ynxbd.wx.config.WeChatConfig; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang3.ObjectUtils; |
||||
import weixin.popular.api.PayMchAPI; |
||||
import weixin.popular.bean.paymch.Unifiedorder; |
||||
import weixin.popular.bean.paymch.UnifiedorderResult; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.UUID; |
||||
|
||||
// 京颐支付
|
||||
@Slf4j |
||||
public class JYPayHelper { |
||||
|
||||
/** |
||||
* 商户创建订单 |
||||
* |
||||
* @param merchantEnum 枚举 |
||||
* @param title 商品标题 |
||||
* @param totalFee 订单金额 |
||||
* @param outTradeNo 订单号 |
||||
* @param notifyType 回调类型 |
||||
* @param ip ip地址 |
||||
* @param payOpenId 用于下单的openId |
||||
* @param msgOpenId 用于推送的openId |
||||
* @return 成功返回 json, 否则返回null |
||||
*/ |
||||
public static JSONObject createOrder(MerchantEnum merchantEnum, String title, String totalFee, String outTradeNo, String notifyType, String ip, String payOpenId, String msgOpenId) { |
||||
// try {
|
||||
// if (ObjectUtils.isEmpty(payOpenId) || ObjectUtils.isEmpty(outTradeNo)
|
||||
// || merchantEnum == null || totalFee == null || notifyType == null) {
|
||||
// log.info("【京硕】下单参数缺失");
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// String cents;
|
||||
// try {
|
||||
// cents = new BigDecimal(totalFee).movePointRight(2).toString(); // 金额转换=>单位分
|
||||
// } catch (Exception e) {
|
||||
// ErrorHelper.println(e);
|
||||
// log.info("【京硕】统一下单金额转换异常");
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// String appId = merchantEnum.APP_ID;
|
||||
// String mchId = WeChatConfig.MCH_ID;
|
||||
// String mchKey = WeChatConfig.MCH_KEY;
|
||||
// String nonce = UUID.randomUUID().toString().replace("-", "");
|
||||
//
|
||||
// Unifiedorder unifiedorder = new Unifiedorder();
|
||||
// unifiedorder.setAppid(appId);
|
||||
// unifiedorder.setMch_id(mchId);
|
||||
// unifiedorder.setNonce_str(nonce);
|
||||
// unifiedorder.setOpenid(payOpenId);
|
||||
// unifiedorder.setOut_trade_no(outTradeNo);
|
||||
// unifiedorder.setBody(title);
|
||||
//
|
||||
// unifiedorder.setTotal_fee(cents); // 金额分
|
||||
// unifiedorder.setSpbill_create_ip(ip);
|
||||
// unifiedorder.setNotify_url(WeChatConfig.getBaseURL() + merchantEnum.NOTIFY_URL);
|
||||
// unifiedorder.setTrade_type("JSAPI");
|
||||
// // 额外参数
|
||||
// unifiedorder.setAttach(notifyType);
|
||||
//
|
||||
// log.info("【京硕】统一下单 {},{},{},{},{},{},{},{}", appId, mchId, nonce, title, outTradeNo, totalFee, ip, merchantEnum.NOTIFY_URL);
|
||||
//
|
||||
// // 微信统一下单
|
||||
// UnifiedorderResult unifiedorderResult = PayMchAPI.payUnifiedorder(unifiedorder, mchKey);
|
||||
// log.info("【京硕】统一下单返回:{}", JsonHelper.toJsonString(unifiedorderResult));
|
||||
// if (unifiedorderResult == null) {
|
||||
// log.info("【京硕】统一下单失败");
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// String result_code = unifiedorderResult.getResult_code();
|
||||
// // 下单是否成功
|
||||
// Boolean sign_status = unifiedorderResult.getSign_status();
|
||||
// if (!SUCCESS.equals(result_code) || sign_status == null || !sign_status) {
|
||||
// log.info("【京硕】统一下单返回异常信息:sign_status={}, err_code=[ {} ], err_code_des=[ {} ]", sign_status, unifiedorderResult.getErr_code(), unifiedorderResult.getErr_code_des());
|
||||
// return null;
|
||||
// }
|
||||
// String json = weixin.popular.util.PayUtil.generateMchPayJsRequestJson(unifiedorderResult.getPrepay_id(), appId, mchKey);
|
||||
// if (json != null) {
|
||||
// return JsonHelper.parseObject(json);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("【京硕】统一下单异常信息:{}", e.getMessage());
|
||||
// ErrorHelper.println(e);
|
||||
// }
|
||||
// return null;
|
||||
return null; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,4 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<config> |
||||
|
||||
</config> |
||||
@ -1,21 +0,0 @@ |
||||
# 消息推送 |
||||
# 挂号-导航推送 |
||||
msg.host.url = http://127.0.0.1:8123/MessagePlatform/ |
||||
msg.reg.navigate.is_enable=false |
||||
msg.reg.navigate.url=http://127.0.0.1:8123/MessagePlatform/daoyixun |
||||
# 挂号-文字提示推送 |
||||
msg.reg.is_enable=false |
||||
msg.reg.url=http://127.0.0.1:8123/MessagePlatform/appointmentsuccess |
||||
# 挂号-取消预约推送 |
||||
msg.reg.cancel.is_enable=false |
||||
msg.reg.cancel.url=http://127.0.0.1:8123/MessagePlatform/appointmentcancel |
||||
# 缴费 |
||||
msg.recipe.is_enable=false |
||||
msg.recipe.url=http://127.0.0.1:8123/MessagePlatform/paymentsuccess |
||||
|
||||
# 产科建档 |
||||
msg.obs.document = http://127.0.0.1:8123/MessagePlatform/business/universal |
||||
|
||||
|
||||
msg.ai.is_enable = false |
||||
msg.ai.url = http://127.0.0.1:8123/MessagePlatform/business/universal |
||||
@ -0,0 +1,34 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<config> |
||||
<host_url name="链接">http://127.0.0.1:8123/MessagePlatform/</host_url> |
||||
|
||||
<reg_navigate name="[挂号]导航推送"> |
||||
<is_enable>false</is_enable> |
||||
<api>daoyixun</api> |
||||
</reg_navigate> |
||||
|
||||
<reg_paid name="[挂号]缴费通知"> |
||||
<is_enable>false</is_enable> |
||||
<api>appointmentsuccess</api> |
||||
</reg_paid> |
||||
|
||||
<reg_cancel name="[挂号]取消预约"> |
||||
<is_enable>false</is_enable> |
||||
<api>appointmentcancel</api> |
||||
</reg_cancel> |
||||
|
||||
<reg_ai name="[挂号]AI"> |
||||
<is_enable>false</is_enable> |
||||
<api>business/universal</api> |
||||
</reg_ai> |
||||
|
||||
<rx_paid name="[处方]缴费通知"> |
||||
<is_enable>false</is_enable> |
||||
<api>paymentsuccess</api> |
||||
</rx_paid> |
||||
|
||||
<obs_document name="产科建档"> |
||||
<is_enable>false</is_enable> |
||||
<api>business/universal</api> |
||||
</obs_document> |
||||
</config> |
||||
Loading…
Reference in new issue