You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.8 KiB
72 lines
2.8 KiB
|
2 months ago
|
package com.ynxbd.common.action.pay;
|
||
|
|
|
||
|
|
import com.ynxbd.bcm.config.BCMHelper;
|
||
|
|
import com.ynxbd.common.action.base.BaseAction;
|
||
|
|
import com.ynxbd.common.bean.pay.PayResult;
|
||
|
|
import com.ynxbd.common.helper.common.DateHelper;
|
||
|
|
import com.ynxbd.common.result.Result;
|
||
|
|
import lombok.extern.slf4j.Slf4j;
|
||
|
|
import org.apache.struts2.convention.annotation.Action;
|
||
|
|
import org.apache.struts2.convention.annotation.Namespace;
|
||
|
|
|
||
|
|
import java.math.BigDecimal;
|
||
|
|
|
||
|
|
@Slf4j
|
||
|
|
@Namespace("/jy_pay")
|
||
|
|
public class JYPayAction extends BaseAction {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 【交行】处方支付通知
|
||
|
|
*
|
||
|
|
* @return 是否成功
|
||
|
|
*/
|
||
|
|
@Action("notify")
|
||
|
|
public Result notify(String notifyType) {
|
||
|
|
// if (ObjectUtils.isEmpty(notifyType)) {
|
||
|
|
// Result.respJson(BCMHelper.respError(String.format("【京颐】获取回调参数失败,结束请求 notifyType={%s}", notifyType)));
|
||
|
|
// return null;
|
||
|
|
// }
|
||
|
|
|
||
|
|
try {
|
||
|
|
PayResult notifyInfo = BCMHelper.payNotify(request);
|
||
|
|
Result.respJson(BCMHelper.respOk()); // 成功
|
||
|
|
|
||
|
|
String openid = notifyInfo.getOpenid();
|
||
|
|
String bankTransNo = notifyInfo.getTransId();
|
||
|
|
String outTradeNo = notifyInfo.getOutTradeNo();
|
||
|
|
BigDecimal totalFee = notifyInfo.getTotalFee();
|
||
|
|
|
||
|
|
String payInfo = notifyInfo.getInfo();
|
||
|
|
String payDate = DateHelper.getCurDate();
|
||
|
|
String payTime = DateHelper.getCurTime();
|
||
|
|
String bankMerchantNo = notifyInfo.getBankMerchantNo();
|
||
|
|
log.info("【京颐】[{}] 收到通知 outTradeNo={}, bankTransNo={}, bankMerchantNo={}", notifyType, outTradeNo, bankTransNo, bankMerchantNo);
|
||
|
|
|
||
|
|
switch (PEnum.toEnum(notifyType)) {
|
||
|
|
case RECIPE:
|
||
|
|
// openid = new RecipeService().queryOpenIdByOutTradeNo(outTradeNo);
|
||
|
|
// new RecipeService().recipeListPay(MerchantEnum.JY, totalFee.toString(), openid, outTradeNo, bankTransNo, bankMerchantNo, payDate, payTime, payInfo);
|
||
|
|
//
|
||
|
|
break;
|
||
|
|
|
||
|
|
case REG: // 挂号
|
||
|
|
// try {
|
||
|
|
// openid = new RegService().queryOpenIdByOutTradeNo(outTradeNo);
|
||
|
|
// new RegService().regPaidNotify(MerchantEnum.JY, totalFee, openid, bankTransNo, outTradeNo, bankMerchantNo, payDate, payTime, payInfo, new Date());
|
||
|
|
// } catch (ServiceException e) {
|
||
|
|
// log.info("【京颐]挂号通知错误 outTradeNo={}, bankTransNo={}, message={}", outTradeNo, bankTransNo, e.getMessage());
|
||
|
|
// }
|
||
|
|
break;
|
||
|
|
|
||
|
|
default:
|
||
|
|
log.info("【京颐】通知类型错误,结束请求");
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
} catch (Exception e) {
|
||
|
|
log.error(e.getMessage());
|
||
|
|
}
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
}
|