Authored by mali

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

... ... @@ -57,6 +57,9 @@ public class AlipayConfig {
//openapi
public static final String OPENAPI_URL = "https://openapi.alipay.com/gateway.do";
// 跨境openapi
public static final String CROSS_BORDER_OPENAPI_URL = "https://intlmapi.alipay.com/gateway.do";
public static final String OPENAPI_BIZ_SUCCESS = "10000";
public static final String OPENAPI_BIZ_PAYFAILED = "40004"; //支付失败
... ... @@ -112,7 +115,28 @@ public class AlipayConfig {
"U6Aakk+AZ0umxp0hJDY/gw8TeDcz9jeAMqbRC6aNTqUw2ygExgIcvQJAbUCgtAfB" +
"6ZG7dCe1+qAG1S/tVd24ZwKqPP0KVRa8Do4qFbIQjv5Cou4DOf35ifLfGzRUWF4D" +
"juPP619T5yGTHA==";
public static final String CROSS_BORDER_RSA_PRIVATE = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALmkG51+GXXK5eDM\n" +
"V42xi/MRXt/LCKkv+1Xzoo2gno+gE91DScdMz1odmXiNW5RMJ+AvaFTOJ3fIHk3w\n" +
"75Ebje7w0UZQ8/JPYManMKV1TdDisp8hzPDK0/kBTGQQQvlgpMLp1aFbfp1TqRID\n" +
"v40cZMcA4imUiOeD22VlBW9j35WhAgMBAAECgYBxgAGWUBO27h+QSr85FZVwPm2Y\n" +
"PGWGM5ziVzxKhSqMu52JiWthW/fmq/Q6PYsBZ3J14eZS+1wsIwFMPAPs30DuDFTX\n" +
"6wMNpl44K4MVUgpT6CcEv2DAhZ+5NgjiKztbiAcZxqakt/VawSx5Li6E0AtqOOTH\n" +
"G/7GIiOJo3T4tJSEcQJBAN5So7tl1m0fULSVHwiRfSJpa6QT4bjReD8X9Rzj9YeK\n" +
"07Q+ufmkkRJVFBHJEVHmC5cZwf3zrb1Gu04bkHscTC0CQQDVwwCAzCktNKW7ig8G\n" +
"1w8ZNU52fMRHT7vnJtR4huI+9pD3k0qtB8gyR9TcHu6mAZH90mWg1OJ4ipwNjmLL\n" +
"HDPFAkEAyEonG9L5RMHrkWSu2qdH1tKmmOEYf8qmzCCnQGnWb1AQvdes8EzkLWHc\n" +
"fNFp+yCG3I/mBwWbRmQMpqeKmH672QJBAKJfq+QqMSULltDsQBncBrYJTf6nK5lX\n" +
"sc4WKtMa8oUNWnUVR2ZEQQgglEpYnMMw8iqyRUx0KUuTTpLlk5nhZFkCQGuZtT34\n" +
"CrknMjYrpibDYPaT8NljffTrnJspAeste6CDLHyH0mgVDzADyXrzuoWNF4UMqWE8\n" +
"toAXZXd//cA4ZOw=";
public static final String CROSS_BORDER_RSA_PUBLIC = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRA\n" +
"FljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQE\n" +
"B/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5Ksi\n" +
"NG9zpgmLCUYuLkxpLQIDAQAB";
public static final String OUYIN_ALI_MAPI_RSA_PUBLIC = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB";
... ...
... ... @@ -19,6 +19,13 @@ public class PlatformFeeDto {
* 有货包装费(暂定5元)
*/
BigDecimal packageFee;// = new BigDecimal(5);
/**
* 货款抽成
*/
BigDecimal serviceFee;
/**
* 货款抽成上下限制
* from version 6.9.8
*/
PriceRange goodsServiceFeeRange;
}
... ...
package com.yohoufo.order.model.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class PriceRange {
private double min;
private double max;
}
... ...
... ... @@ -42,6 +42,7 @@ import com.yohoufo.order.service.SellerOrderPaymentService;
import com.yohoufo.order.service.handler.BuyerOrderPayDiffTimeHandler;
import com.yohoufo.order.service.handler.transfer.AlipayTransferChancelSelector;
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.unionpay.JsUnionpayService;
import com.yohoufo.order.service.pay.unionpay.UnionpayServiceAbstract;
... ... @@ -115,6 +116,9 @@ public class PaymentServiceImpl implements IPaymentService {
AlipayOuyinService alipayService;
@Autowired
AlipayCrossBorderService alipayCrossBorderService;
@Autowired
OrdersPayMapper ordersPayMapper;
@Autowired
... ... @@ -226,6 +230,8 @@ public class PaymentServiceImpl implements IPaymentService {
payService = walletPayService;
} else if(payment == Payment.UNION_PAY){
payService = jsUnionpayService;
} else if (payment == Payment.CROSS_BORDER_ALIPAY){
payService = alipayCrossBorderService;
}
return payService;
... ...
package com.yohoufo.order.service.pay.alipay;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.common.utils.RSAUtils;
import com.yohoufo.order.config.AlipayConfig;
import com.yohoufo.order.model.PayQueryBo;
import com.yohoufo.order.model.PayRefundBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
@Service
public class AlipayCrossBorderService extends AlipayServiceAbstract {
private static final Logger logger = LoggerFactory.getLogger("alipayLogger");
@Override
protected String getMd5Key() {
return "";
}
@Override
protected String getRsaAlipubKey() {
return AlipayConfig.CROSS_BORDER_RSA_PUBLIC;
}
@Override
protected String getRsaPrivateKey() {
return AlipayConfig.CROSS_BORDER_RSA_PRIVATE;
}
@Override
protected String getAppId() {
return "";
}
@Override
protected String getPartnerId() {
return "2088121119526910";
}
private String getSellerId(){
return "zfbgj@yoho.cn";
}
/**
* OpenApi退款
* @param refundBo
* @return
*/
public PayRefundBo refundOpenApi(PayRefundBo refundBo) {
logger.info("enter AliPayRefunder to refund tradeNo {}, amount {}", refundBo.getRefundOrderCode(), refundBo.getAmount());
Map<String, String> refundParams = buildOpenApiRefundParams(refundBo.getPayOrderCode(), refundBo.getRefundOrderCode(), refundBo.getAmount());
String respTxt = sendOpenApiRequest(String.valueOf(refundBo.getPayOrderCode()), refundParams, AlipayConfig.OPENAPI_URL);
PayRefundBo bo = refundOpenApiConvert(respTxt, refundBo);
logger.info("exit AliPayRefunder refund, refundStatus: {}, refundMsg", bo.getRefundStatus(), bo.getRefundMsg());
return bo;
}
/**
* openapi退款参数
* @param tradeNo
* @param refundNo
* @param amount
* @return
*/
private Map<String, String> buildOpenApiRefundParams(String tradeNo, String refundNo, double amount) {
Map<String, String> params = new HashMap<String, String>();
params.put("service", "forex_refund");
params.put("partner", getPartnerId());
params.put("_input_charset", AlipayConfig.input_charset);
params.put("sign_type", "RSA");
params.put("out_return_no",refundNo);
params.put("out_trade_no", tradeNo);
params.put("return_rmb_amount", String.valueOf(amount));
params.put("currency", "HKD");
params.put("app_id", getAppId());
params.put("method", "alipay.trade.refund");
params.put("charset", AlipayConfig.input_charset);
params.put("sign_type", "RSA");
params.put("timestamp", DateUtil.getCurrentTime());
params.put("version", "1.0");
JSONObject bizJson = new JSONObject();
bizJson.put("out_trade_no", tradeNo);
bizJson.put("refund_amount", amount);
bizJson.put("out_request_no", refundNo);
params.put("biz_content", bizJson.toJSONString());
String preSignStr = getOpenApiSignString(params);
params.put("sign", RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset));
return params;
}
/**
* 查询支付结果
* @param tradeNo
* @param orderCreateTime
* @return
*/
public PayQueryBo payQuery(String tradeNo, int orderCreateTime) {
Map<String, String> queryParams = buildOpenApiQueryParams(tradeNo);
String respTxt = sendOpenApiRequest(tradeNo, queryParams, AlipayConfig.CROSS_BORDER_OPENAPI_URL);
QueryBo queryBo = JSON.parseObject(JSONObject.toJSONString(JSON.parseObject(respTxt).getJSONObject("alipay_trade_query_response")), QueryBo.class);
// 查询结果转换成 共通的对象
PayQueryBo payQueryBo = new PayQueryBo();
if ("10000".equals(queryBo.getCode())){
// 订单支付时的商户号
payQueryBo.setPayOrderCode(queryBo.getOut_trade_no());
payQueryBo.setTradeNo(queryBo.getTrade_no());
if ("TRADE_SUCCESS".equals(queryBo.getTrade_status())) {
payQueryBo.setPayStatus(true);
}else if("TRADE_CLOSED".equals(queryBo.getTrade_status())){
payQueryBo.setRefundStatus(true);
}
payQueryBo.setAmount(Double.parseDouble(queryBo.getTotal_amount()));
payQueryBo.setBuyerId(queryBo.getBuyer_user_id());
}
return payQueryBo;
}
/**
* openapi支付查询
* @param orderCode
* @return
*/
private Map<String, String> buildOpenApiQueryParams(String orderCode) {
Map<String, String> params = new HashMap<String, String>();
params.put("service", "single_trade_query");
params.put("partner", getPartnerId());
params.put("_input_charset", AlipayConfig.input_charset);
params.put("sign_type", "RSA");
params.put("out_trade_no", orderCode);
String preSignStr = getOpenApiSignString(params);
params.put("sign", RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset));
return params;
}
/**
* 预支付接口
* @param orderInfo
* @return
*/
public JSONObject prepayRequest(OrderInfo orderInfo) {
logger.info("cross border orderInfo is {}", orderInfo);
String orderCode = String.valueOf(orderInfo.getOrderCode());
Map<String, String> queryParams = buildOpenApiPayParams(orderCode, orderInfo.getAmount(),orderInfo.getPayExpireTime());
StringBuilder res = new StringBuilder();
for (String key : queryParams.keySet()){
res.append(key);
res.append("=");
res.append(queryParams.get(key));
res.append("&");
}
JSONObject rr = new JSONObject();
rr.put("payParams", res.toString().substring(0, res.toString().length()-1));
return rr;
}
/**
* app支付结果
* @param tradeNo
* @param amount
* @param payExpireTime
* @return
*/
private Map<String, String> buildOpenApiPayParams(String tradeNo, BigDecimal amount, int payExpireTime) {
Map<String, String> params = new HashMap<String, String>();
params.put("service", "mobile.securitypay.pay");
params.put("partner", getPartnerId());
params.put("_input_charset", AlipayConfig.input_charset);
params.put("sign_type", "RSA");
params.put("notify_url", getNotifyURL());
params.put("out_trade_no", tradeNo);
String subject = "ufoOrder-" + tradeNo;
params.put("subject", subject);
params.put("payment_type", "1");
params.put("seller_id", getSellerId());
params.put("rmb_fee", amount.toPlainString());
params.put("currency", "HKD"); // Hong Kong Dollar
params.put("forex_biz", "FP");
params.put("it_b_pay", payExpireTime+"m");
params.put("refer_url", getNotifyURL()); // 下载商家应用的信息
params.put("product_code", "NEW_WAP_OVERSEAS_SELLER");
JSONObject trade_information = new JSONObject();
params.put("trade_information", trade_information.toJSONString());
trade_information.put("business_type", 4);
trade_information.put("goods_info", "xxdd^1");
trade_information.put("total_quantity",1);
String preSignStr = getOpenApiSignString(params);
String sign = RSAUtils.sign(preSignStr, getRsaPrivateKey(), AlipayConfig.input_charset);
params.put("sign", URLEncoder.encode(sign));
return params;
}
}
... ...
... ... @@ -81,6 +81,10 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
private String transferNotifyURL;
public String getNotifyURL(){
return notifyURL;
}
// public JSONObject prepayRequest(OrderInfo orderInfo){
//
// String tradeNo = String.valueOf(orderInfo.getOrderCode());
... ... @@ -96,8 +100,8 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
// .addParam("payment_type", "1") //固定位1,表示商品购买
// .addParam("seller_id", this.getPartnerId())
// .addParam("total_fee", orderInfo.getAmount().toPlainString())
// .addParam("body", subject)
// .addParam("it_b_pay", orderInfo.getPayExpireTimeStr(Payment.ALIPAY));
// .addParam("body", subject);
//// .addParam("it_b_pay", orderInfo.getPayExpireTimeStr(Payment.ALIPAY));
//
// builder.addParam("out_trade_no", tradeNo);
//
... ... @@ -110,7 +114,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
public PayQueryBo payQuery(String tradeNo, int orderCreateTime) {
Map<String, String> queryParams = buildOpenApiQueryParams(tradeNo);
String respTxt = sendOpenApiRequest(tradeNo, queryParams);
String respTxt = sendOpenApiRequest(tradeNo, queryParams, AlipayConfig.OPENAPI_URL);
QueryBo queryBo = JSON.parseObject(JSONObject.toJSONString(JSON.parseObject(respTxt).getJSONObject("alipay_trade_query_response")), QueryBo.class);
// 查询结果转换成 共通的对象
... ... @@ -404,7 +408,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
public PayQueryBo transferQuery(String buyerOrderCode) {
String tradeNo = buyerOrderCode;
Map<String, String> queryParams = buildAlipayTransferQueryParams(tradeNo);
String respTxt = sendOpenApiRequest(tradeNo, queryParams);
String respTxt = sendOpenApiRequest(tradeNo, queryParams, AlipayConfig.OPENAPI_URL);
JSONObject result = JSON.parseObject(respTxt).getJSONObject("alipay_fund_trans_order_query_response");
logger.info("查询转账{}结果为:{}", tradeNo, result);
// 查询结果转换成 共通的对象
... ... @@ -425,11 +429,11 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
* @param paramMap
* @return
*/
private String sendOpenApiRequest(String orderCode, Map<String, String> paramMap) {
public String sendOpenApiRequest(String orderCode, Map<String, String> paramMap, String url) {
logger.info("[{}] send openapi request: {}", orderCode, paramMap);
String response = "";
try {
response = httpClient.postFormData(AlipayConfig.OPENAPI_URL, paramMap);
response = httpClient.postFormData(url, paramMap);
} catch (Exception e) {
logger.error("[{}] trade openapi send failed: {}", orderCode, e.getMessage());
return response;
... ... @@ -681,7 +685,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
* @param paramsMap
* @return
*/
private static String getOpenApiSignString(Map<String, String> paramsMap) {
public static String getOpenApiSignString(Map<String, String> paramsMap) {
if(null == paramsMap) {
return "";
}
... ... @@ -785,7 +789,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
public PayRefundBo refundOpenApi(PayRefundBo refundBo) {
logger.info("enter AliPayRefunder to refund tradeNo {}, amount {}", refundBo.getRefundOrderCode(), refundBo.getAmount());
Map<String, String> refundParams = buildOpenApiRefundParams(refundBo.getPayOrderCode(), refundBo.getRefundOrderCode(), refundBo.getAmount());
String respTxt = sendOpenApiRequest(String.valueOf(refundBo.getPayOrderCode()), refundParams);
String respTxt = sendOpenApiRequest(String.valueOf(refundBo.getPayOrderCode()), refundParams, AlipayConfig.OPENAPI_URL);
//logger.info("refund response for alipay: {}", responseText);
PayRefundBo bo = refundOpenApiConvert(respTxt, refundBo);
logger.info("exit AliPayRefunder refund, refundStatus: {}, refundMsg", bo.getRefundStatus(), bo.getRefundMsg());
... ... @@ -799,7 +803,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
* @param xml
* @return
*/
private PayRefundBo refundOpenApiConvert(String respText, PayRefundBo bo) {
public PayRefundBo refundOpenApiConvert(String respText, PayRefundBo bo) {
if(StringUtils.isEmpty(respText)) {
bo.setRefundStatus(RefundContant.PAYMENT_REFUND_RESULTCODE_REQERR);
bo.setRefundMsg("退款申请请求失败");
... ...
package com.yohoufo.order.service.proxy;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ser.std.ObjectArraySerializer;
import com.yoho.message.sdk.common.model.SendMessageRspBo;
import com.yoho.message.sdk.service.ufo.IUFOSendService;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
... ... @@ -11,6 +13,7 @@ import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.dal.product.model.Product;
import com.yohoufo.inboxclient.model.InBoxResponse;
import com.yohoufo.inboxclient.model.InboxReqVO;
import com.yohoufo.order.utils.BuyerOrderUtils;
import com.yohoufo.order.utils.SellerGoodsHelper;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
... ... @@ -21,6 +24,7 @@ import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
... ... @@ -430,7 +434,16 @@ public class BuyerNoticeFacade extends BaseNoticeFacade {
}
private String buildGoodsTypeTagForBuyer(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods) {
return SellerGoodsHelper.buildBuyerOrderGoodsTypeTag(buyerOrder.getAttributes(), SkupType.getSkupType(sellerOrderGoods.getAttributes()));
SkupType skupType = SkupType.getSkupType(sellerOrderGoods.getAttributes());
boolean isDepositOrder = BuyerOrderUtils.isDeposit(buyerOrder);
boolean isQuickDeliverGoods = SkupType.QUICK_DELIVER.equals(skupType);
if (isQuickDeliverGoods && isDepositOrder) {
return SkupType.QUICK_DELIVER.attrName() + SkupType.DEPOSIT.attrName();
} else if (isDepositOrder) {
return SkupType.DEPOSIT.attrName();
} else {
return skupType.attrName();
}
}
}
... ...
... ... @@ -14,7 +14,6 @@ import java.math.BigDecimal;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Supplier;
/**
... ... @@ -71,14 +70,20 @@ public abstract class AbsSellerOrderComputeHandler implements OrderComputeHandle
return result;
}
protected BigDecimal calCrossWithThreshold(BigDecimal min, BigDecimal max, BigDecimal calByRate){
if(calByRate.compareTo(min) < 0){
calByRate = min;
protected BigDecimal calCrossWithThreshold(BigDecimal min, BigDecimal max, BigDecimal fee){
boolean minIsLegal = isPositive(min);
if(minIsLegal && fee.compareTo(min) < 0){
fee = min;
}
if (calByRate.compareTo(max) > 0){
calByRate = max;
boolean maxIsLegal = isPositive(max);
if (maxIsLegal && fee.compareTo(max) > 0){
fee = max;
}
return calByRate;
return fee;
}
private boolean isPositive(BigDecimal val){
return Objects.nonNull(val) && BigDecimal.ZERO.compareTo(val) < 0;
}
protected BigDecimal halfUp(BigDecimal fee){
... ... @@ -119,17 +124,21 @@ public abstract class AbsSellerOrderComputeHandler implements OrderComputeHandle
Supplier<PlatformFeeDto> plaformFeeConfigSupplier = ()->getPlatformFeeDtoConfig();
BigDecimal appraiseFee;
BigDecimal packageFee;
//公共配置
PlatformFeeDto pfc = plaformFeeConfigSupplier.get();
//个性化配置为空,使用公共配置
if (ppf == null){
PlatformFeeDto pfc = plaformFeeConfigSupplier.get();
appraiseFee = pfc.getAppraiseFee();
packageFee = pfc.getPackageFee();
}else{
appraiseFee = ppf.getAppraiseFee() != null ? ppf.getAppraiseFee() : plaformFeeConfigSupplier.get().getAppraiseFee();
packageFee = ppf.getPackageFee() != null ? ppf.getPackageFee() : plaformFeeConfigSupplier.get().getPackageFee();
appraiseFee = ppf.getAppraiseFee() != null ? ppf.getAppraiseFee() : pfc.getAppraiseFee();
packageFee = ppf.getPackageFee() != null ? ppf.getPackageFee() : pfc.getPackageFee();
}
BigDecimal serviceFee = price.multiply(goodsServiceRate);
//目前而言,商品抽成的阈值只有公共配置
PriceRange goodsServiceFeeRange = pfc.getGoodsServiceFeeRange();
BigDecimal serviceFee = calGoodsServiceFee(goodsServiceFeeRange, price, goodsServiceRate);
platformFee.setAppraiseFee(halfUp(appraiseFee));
platformFee.setPackageFee(halfUp(packageFee));
BigDecimal total = appraiseFee.add(packageFee).add(serviceFee);
... ... @@ -139,6 +148,24 @@ public abstract class AbsSellerOrderComputeHandler implements OrderComputeHandle
return platformFee;
}
BigDecimal calGoodsServiceFee(PriceRange goodsServiceFeeRange, BigDecimal price, BigDecimal goodsServiceRate){
BigDecimal serviceFee = price.multiply(goodsServiceRate);
//没有配置上下限
if (Objects.isNull(goodsServiceFeeRange)){
logger.info("calGoodsServiceFee no config goodsServiceFeeRange, price {} goodsServiceRate {}",
price, goodsServiceRate);
}else{
BigDecimal min = new BigDecimal(goodsServiceFeeRange.getMin());
BigDecimal max = new BigDecimal(goodsServiceFeeRange.getMax());
serviceFee = calCrossWithThreshold(min, max, serviceFee);
}
return serviceFee;
}
protected abstract PlatformFeeDto buildDefaultPlatformFeeDto();
... ...
... ... @@ -1438,7 +1438,8 @@ public class ProductServiceImpl implements ProductService {
innerList.addAll(skuContent.values());
// 排下序是稳妥的
Collections.sort(innerList, (o1, o2) -> {
double sub = Double.parseDouble(o1.getSkuSize()) - Double.parseDouble(o2.getSkuSize());
int sub = (o1.getSkuSize() == null || o2.getSkuSize() == null) ? 0 : (o1.getSkuSize().compareTo(o2.getSkuSize()));
// double sub = Double.parseDouble(o1.getSkuSize()) - Double.parseDouble(o2.getSkuSize());
if (sub < 0)
return -1;
else if (sub > 0)
... ...