Authored by mali

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

... ... @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableList;
import com.yohoufo.common.exception.SignatureNotMatchException;
import com.yohoufo.common.utils.MD5Utils;
import com.yohoufo.common.utils.SignUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -82,7 +83,7 @@ public class BodySignatureCheckInterceptor implements HandlerInterceptor {
throw new SignatureNotMatchException();
}
String cacuSign = this.getSign(bodyParam, privateKey);
String cacuSign = SignUtils.getSign(bodyParam, privateKey);
if(!cacuSign.equalsIgnoreCase(signParam))
{
logger.warn("sign not match. request:{}, caculate:{}", signParam, cacuSign );
... ... @@ -112,46 +113,6 @@ public class BodySignatureCheckInterceptor implements HandlerInterceptor {
return objectMapper.readValue(request.getInputStream(), Map.class);
}
private String getSign(Map<String, Object> bodyParam, String privateKey)throws SignatureNotMatchException
{
//remove some headers
ImmutableList list = ImmutableList.of("sign","business_type");
SortedMap<String,Object> filtedMap = new TreeMap<>();
for(Map.Entry<String,Object> entry : bodyParam.entrySet())
{
String k = entry.getKey();
if(!list.contains(k)){
filtedMap.put(k,entry.getValue());
}
}
//string: k1=v1&k2=v2
List<String> array = new LinkedList<>();
for(Map.Entry<String,Object> entry : filtedMap.entrySet())
{
if (entry.getValue() instanceof ArrayList){
array.add(StringUtils.trim(entry.getKey() + "=" + JSON.toJSONString(entry.getValue())));
}else {
array.add(StringUtils.trim(entry.getKey() + "=" + entry.getValue()));
}
}
String signStr = String.join("&", array);
String sign = "";
try {
sign = MD5Utils.signMd5(signStr + privateKey, "utf-8");
logger.info("signBeforeStr is {}, sign is {}", signStr, sign);
} catch (Exception e) {
logger.error("body param sign failed: {}", e);
throw new SignatureNotMatchException();
}
//sign md5
return sign;
}
public void setIsDebugEnable(boolean isDebugEnable) {
... ...
package com.yohoufo.common.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.yoho.core.common.utils.MD5;
import com.yohoufo.common.exception.SignatureNotMatchException;
import com.yohoufo.common.interceptor.SecurityInterceptor;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
public class SignUtils {
private static final Logger logger = LoggerFactory.getLogger(SignUtils.class);
/**
* 获取签名
... ... @@ -29,4 +36,47 @@ public class SignUtils {
String sign = MD5.md5(param+signKey);
return sign;
}
public static String getSign(Map<String, Object> bodyParam, String privateKey)throws SignatureNotMatchException
{
//remove some headers
ImmutableList list = ImmutableList.of("sign","business_type");
SortedMap<String,Object> filtedMap = new TreeMap<>();
for(Map.Entry<String,Object> entry : bodyParam.entrySet())
{
String k = entry.getKey();
if(!list.contains(k)){
filtedMap.put(k,entry.getValue());
}
}
//string: k1=v1&k2=v2
List<String> array = new LinkedList<>();
for(Map.Entry<String,Object> entry : filtedMap.entrySet())
{
if (entry.getValue() instanceof ArrayList){
array.add(StringUtils.trim(entry.getKey() + "=" + JSON.toJSONString(entry.getValue())));
}else {
array.add(StringUtils.trim(entry.getKey() + "=" + entry.getValue()));
}
}
String signStr = String.join("&", array);
String sign = "";
try {
sign = MD5Utils.signMd5(signStr + privateKey, "utf-8");
logger.info("signBeforeStr is {}, sign is {}", signStr, sign);
} catch (Exception e) {
logger.error("body param sign failed: {}", e);
throw new SignatureNotMatchException();
}
//sign md5
return sign;
}
}
... ...
... ... @@ -54,4 +54,8 @@ public abstract class Account {
public void recordPayDetail(long orderCode, AccountPayResult accountPayResult) {
}
public EntrySellerType getEntrySellerType() {
return this.entrySellerType;
}
}
... ...
... ... @@ -9,6 +9,7 @@ import com.yohobuy.ufo.model.order.constants.RegionEnum;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.order.charge.ChargeContext;
... ... @@ -38,11 +39,13 @@ import com.yohoufo.order.service.listener.OrderChangeListenerContainer;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.seller.SkupService;
import com.yohoufo.order.service.seller.processor.PriceComputePrepareProcessor;
import com.yohoufo.order.service.seller.setting.SellerService;
import com.yohoufo.order.service.support.ShoppingSupport;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
import com.yohoufo.order.utils.DeliveryWayUtils;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.MathUtils;
import com.yohoufo.order.utils.SellerHelper;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
... ... @@ -100,6 +103,8 @@ public class BuyerBidPublishService {
@Autowired
private OrderChangeListenerContainer orderChangeListenerContainer;
@Autowired
private SellerService sellerService;
/**
* 计算
... ... @@ -162,6 +167,12 @@ public class BuyerBidPublishService {
*/
public BidPublishResponse publish(BuyerBidPublishRequest request) {
int uid = request.getUid();
//香港仓卖家不给求购
if (SellerHelper.isLargeSettlement(sellerService.getEntrySellerType(uid))) {
logger.warn("[{}] hk seller,can't publish bid skup", uid);
throw new UfoServiceException(500, "您没有权限进行求购,详情请联系有货在线客服");
}
//预发票
BidPublishResult bidPublishResult = bidPublish(request);
... ...
... ... @@ -9,6 +9,7 @@ import com.yoho.error.exception.ServiceException;
import com.yoho.tools.common.beans.ApiResponse;
import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.bo.OutTradeNoMeta;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.Payment;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
... ... @@ -399,7 +400,9 @@ public class PaymentServiceImpl implements IPaymentService {
private PaymentData convertQueryPaymentData(PayQueryBo payQueryBo, long orderCode) {
PaymentData paymentData = new PaymentData();
OutTradeNoMeta outTradeNoMeta = OutTradeNoMeta.parse(payQueryBo.getPayOrderCode());
paymentData.setOrderCode(String.valueOf(orderCode));
paymentData.setPayLevel(outTradeNoMeta.getPayLevel());
paymentData.setOutTradeNo(payQueryBo.getPayOrderCode());
paymentData.setTotalFee(payQueryBo.getAmount());
paymentData.setBankCode(payQueryBo.getBankCode());
... ...
... ... @@ -6,12 +6,14 @@ import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.BidStoragePriceVo;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohobuy.ufo.model.order.common.CancelType;
import com.yohobuy.ufo.model.order.common.EntrySellerType;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.AddressUtil;
import com.yohoufo.order.convert.SellerOrderConvertor;
import com.yohoufo.order.event.OrderCancelEvent;
... ... @@ -35,6 +37,7 @@ import com.yohoufo.order.service.seller.processor.PriceComputePrepareProcessor;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
import com.yohoufo.order.utils.AddressHelper;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.SellerHelper;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -147,6 +150,12 @@ public class SellerBidPublishService {
//3.检测入驻用户账户保证金
Account account = accountFactory.get(uid);
//香港仓卖家不给变现
if (SellerHelper.isLargeSettlement(account.getEntrySellerType())) {
logger.warn("[{}] hk seller,can't publish bid skup", uid);
throw new UfoServiceException(500, "您没有权限进行变现,详情请联系有货在线客服");
}
account.checkBalanceEnough(computeResult.getEarnestMoney().getEarnestMoney(), SkupType.getSkupType(saleableBidSkup.getAttribute()));
int skup = saleableBidSkup.getSkup();
... ...
... ... @@ -57,9 +57,9 @@ yoho.single.center.domain=${yoho.single.center.domain}
wechat.app.partnerid=1218934901
wechat.app.appid=wx049fdaa3ba9cdd7a
wechat.notifyurl=${wechat.notifyurl}
alipay.notifyurl=${alipay.notifyurl}
alipay.transfer.notifyurl=${alipay.transfer.notifyurl}
wechat.notifyurl=${ufo.wechat.notifyurl}
alipay.notifyurl=${ufo.alipay.notifyurl}
alipay.transfer.notifyurl=${ufo.alipay.transfer.notifyurl}
order.seller.earnestmoney.min=${order.seller.earnestmoney.min}
order.seller.earnestmoney.max=${order.seller.earnestmoney.max}
... ...