Authored by mali

Merge branch 'test6.9.13' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.13

... ... @@ -110,8 +110,7 @@ public class CouponService {
// 渠道匹配
toMatchUserCouponBos = toMatchUserCouponBos.stream()
.filter(userCouponsBo -> StringUtils.isBlank(userCouponsBo.getBusinessClient())
|| (StringUtils.isNotBlank(chargeContext.getChargeParam().getBusinessClient()) &&
Arrays.asList(userCouponsBo.getBusinessClient().split(",")).contains(chargeContext.getChargeParam().getBusinessClient())))
|| Arrays.asList(userCouponsBo.getBusinessClient().split(",")).contains(chargeContext.getChargeParam().getBusinessClient()))
.collect(Collectors.toList());
//规则匹配
... ...
... ... @@ -481,7 +481,7 @@ public class PromotionService {
promotionBoList = promotionBoList.stream().filter(
promotion ->
StringUtils.isBlank(promotion.getBusinessClient())
|| (StringUtils.isNotBlank(businessClient) && Arrays.asList(promotion.getBusinessClient().split(",")).contains(businessClient))).collect(Collectors.toList());
|| Arrays.asList(promotion.getBusinessClient().split(",")).contains(businessClient)).collect(Collectors.toList());
Predicate<PromotionActivityRspBo> predicate = resp->Objects.nonNull(resp.getPromotionTypeEnum());
... ...
... ... @@ -47,13 +47,12 @@ public abstract class AbsOrderAutoCancelDelayMsgConsumer implements YhConsumer {
return;
}
mqConsumerLog.warn("handle {} message fail, message is {} ",topic, message, serviceEx);
//TODO find where is ORDER_CANCEL_FAILED_NOT_FIT_TIME used
if(serviceEx.getServiceError() == ServiceError.ORDER_CANCEL_FAILED_NOT_FIT_TIME) {
autoCancelOrderRetry(orderCancelEvent);
}
} catch ( Exception e ) {
mqConsumerLog.warn("handle {} message fail, message is {} ",topic, message, e);
autoCancelOrderRetry(orderCancelEvent);
}
}
... ...
... ... @@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.Payment;
import com.yohoufo.order.service.pay.AbstractPayService;
import com.yohoufo.order.service.pay.alipay.AlipayCrossBorderService;
import com.yohoufo.order.service.pay.alipay.AlipayOuyinService;
import com.yohoufo.order.service.pay.alipay.AlipayOuyinWapService;
import com.yohoufo.order.service.pay.unionpay.JsUnionpayService;
import com.yohoufo.order.service.pay.wallet.WalletPayService;
import com.yohoufo.order.service.pay.weixin.WeixinMiniappPayService;
... ... @@ -36,6 +37,8 @@ public class PayServiceFactory {
@Autowired
JsUnionpayService jsUnionpayService;
@Autowired
private AlipayOuyinWapService alipayOuyinWapService;
/**
* 获取支付的主场service
... ... @@ -65,6 +68,8 @@ public class PayServiceFactory {
payService = jsUnionpayService;
} else if (payment == Payment.CROSS_BORDER_ALIPAY){
payService = alipayCrossBorderService;
}else if (payment == Payment.ALIPAY_WAP){
payService = alipayOuyinWapService;
}
return payService;
... ...
... ... @@ -56,7 +56,7 @@ public abstract class AbstractAlipayService extends AbstractPayService {
return factory.newAlipaySignatureHelper(getAlipaySignatureSetting());
}
private final String getAppId() {
protected final String getAppId() {
return getAlipaySignatureSetting().getAppId();
}
... ... @@ -134,9 +134,8 @@ public abstract class AbstractAlipayService extends AbstractPayService {
public JSONObject prepayRequest(OrderInfo orderInfo) {
logger.info("prepayRequest orderInfo is {}", orderInfo);
String outTradeNo = orderInfo.getOutTradeNo();
Map<String, String> queryParams = buildOpenApiPayParams(orderInfo.getOrderCode(), outTradeNo, orderInfo.getAmount(),
orderInfo.getPayExpireTime(), orderInfo.getPayment(), orderInfo.getHbfqNums(), orderInfo.getUid());
Map<String, String> queryParams = buildOpenApiPayParams(orderInfo);
StringBuilder res = new StringBuilder();
for (String key : queryParams.keySet()){
res.append(key);
... ... @@ -597,13 +596,18 @@ public abstract class AbstractAlipayService extends AbstractPayService {
/**
* app支付结果
* @param tradeNo
* @param amount
* @param payExpireTime
* @param orderInfo
* @return
*/
private Map<String, String> buildOpenApiPayParams(long orderCode, String tradeNo, BigDecimal amount, int payExpireTime,
int payment, int hbfqNums, int uid) {
protected Map<String, String> buildOpenApiPayParams(OrderInfo orderInfo) {
long orderCode= orderInfo.getOrderCode();
String tradeNo = orderInfo.getOutTradeNo();
BigDecimal amount = orderInfo.getAmount();
int payExpireTime = orderInfo.getPayExpireTime();
int payment = orderInfo.getPayment();
int hbfqNums = orderInfo.getHbfqNums();
int uid = orderInfo.getUid();
//build
Map<String, String> params = new HashMap<String, String>();
params.put("app_id", getAppId());
params.put("method", "alipay.trade.app.pay");
... ...
package com.yohoufo.order.service.pay.alipay;
import com.alibaba.fastjson.JSONObject;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.order.config.AlipayConfig;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
@Service
public class AlipayOuyinWapService extends AbstractAlipayService {
@Override
protected AlipaySignatureSetting getAlipaySignatureSetting() {
return new AlipaySignatureSetting(
AlipayConfig.OUYIN_APPID,
AlipayConfig.OUYIN_PARTNER,
false,
"RSA"
);
}
@Override
protected String getAccountUserName() {
return AlipayConfig.OUYIN_USER_NAME;
}
@Override
protected String getAccountEmail() {
return AlipayConfig.OUYIN_EMAIL;
}
@Override
protected Map<String, String> buildOpenApiPayParams(OrderInfo orderInfo) {
long orderCode= orderInfo.getOrderCode();
String tradeNo = orderInfo.getOutTradeNo();
BigDecimal amount = orderInfo.getAmount();
int payExpireTime = orderInfo.getPayExpireTime();
//build
Map<String, String> params = new HashMap<String, String>();
params.put("app_id", getAppId());
params.put("method", "alipay.trade.wap.pay");
params.put("charset", AlipayConfig.input_charset);
params.put("sign_type", "RSA");
params.put("timestamp", DateUtil.getCurrentTime());
params.put("version", "1.0");
params.put("notify_url", getNotifyURL());
if (paymentSupportService.isForbidVirtualPayChannel(orderCode)){
params.put("disable_pay_channels", "credit_group"); // 禁用信用卡
}
JSONObject bizJson = new JSONObject(true);
bizJson.put("timeout_express", payExpireTime+"m"); //该订单允许的最晚付款时间
bizJson.put("seller_id", "");
bizJson.put("product_code", "QUICK_MSECURITY_PAY");
bizJson.put("total_amount", amount.toPlainString());
String subject = "ufoOrder-" + tradeNo;
bizJson.put("subject", subject);
bizJson.put("body", subject);
bizJson.put("out_trade_no", tradeNo);
params.put("biz_content", bizJson.toJSONString());
String preSignStr = getOpenApiSignString(params, false);
String sign = helper().signWithRsa(preSignStr,AlipayConfig.input_charset);
params.put("sign", URLEncoder.encode(sign));
// 对biz_content进行encode
String encodeUrl = URLEncoder.encode(bizJson.toJSONString());
params.put("biz_content", encodeUrl);
return params;
}
}
... ...