Authored by sailing-PC\sailing

fix

... ... @@ -16,7 +16,7 @@ public enum SkupStatus {
/**
* 可售(已支付)
*/
CAN_SELL(1, "可售",
CAN_SELL(1, "出售中",
new Node(
Arrays.asList(ButtonShow.NOT_SOLD.getBo(), ButtonShow.SHOW_DETAIL.getBo()),
Arrays.asList(ButtonShow.NOT_SOLD.getBo()),
... ...
... ... @@ -17,6 +17,7 @@ public class AddressInfoConvertor {
}
AddressInfo addressInfo = new AddressInfo();
addressInfo.setAddress_id(Integer.valueOf(resp.getId()));
addressInfo.setAreaCode(resp.getAreaCode());
addressInfo.setAddress(resp.getAddress());
addressInfo.setConsignee(resp.getAddresseeName());
addressInfo.setPhone(resp.getPhone());
... ...
package com.yohoufo.order.model.dto;
import java.math.BigDecimal;
/**
* Created by chenchao on 2018/9/28.
*/
public class ServiceFeeRate {
double goodsPayment = 5D;
double earnestMoney = 20D;
BigDecimal goodsPaymentRate = new BigDecimal(0.05D);
double payChannel = 0.6D;
BigDecimal earnestMoneyRate = new BigDecimal(0.20D);
String rateSymbol = "%";
BigDecimal payChannelRate = new BigDecimal(0.0006D);
public static ServiceFeeRate getServiceFeeRate(){
... ...
... ... @@ -5,6 +5,7 @@ import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.common.utils.PriceFormater;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.common.*;
... ... @@ -24,6 +25,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
/**
... ... @@ -55,84 +58,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
@Autowired
private SellerOrderMetaMapper somMapper;
/**
* 商品信息
* @param sellerOrderGoods
* @return
*/
private GoodsInfo getGoodsInfo(SellerOrderGoods sellerOrderGoods) {
GoodsInfo goodsInfo = new GoodsInfo();
goodsInfo.setProductName(sellerOrderGoods.getProductName());
goodsInfo.setColorName(sellerOrderGoods.getColorName());
goodsInfo.setSizeName(sellerOrderGoods.getSizeName());
goodsInfo.setGoodImg(sellerOrderGoods.getImageUrl());
goodsInfo.setGoodPrice(sellerOrderGoods.getGoodsPrice().toPlainString());
goodsInfo.setProductId(sellerOrderGoods.getProductId());
goodsInfo.setStorageId(sellerOrderGoods.getStorageId());
return goodsInfo;
}
/**
* 获取详情页 状态位明细
* @param order
* @param skupStatus
* @return
*/
private OrderDetailInfo.StatusDetail getStatusDetail(SellerOrder order,
SkupStatus skupStatus) {
OrderDetailInfo.StatusDetail statusDetail = OrderDetailInfo.StatusDetail.builder()
.status(skupStatus.getCode())
.statuStr(skupStatus.getDesc())
.detailDesc(skupStatus.getDetailShowDesc())
.paymentTips(skupStatus.getPaymentTips())
.build();
// 待付款时,剩余时间
if (skupStatus.getCode() == SkupStatus.CAN_NOT_SELL.getCode()){
statusDetail.setLeftTime(DateUtil.getCurrentTimeSecond() - order.getCreateTime());
}
return statusDetail;
}
private OrderDetailInfo buildOrderDetail(SellerOrder order, SkupStatus orderStatus,
SellerOrderGoods sellerOrderGoods, SoldPrdComputeBo computeBo
, AddressInfo addressInfo
) {
OrderDetailInfo orderDetailInfo = new OrderDetailInfo();
orderDetailInfo.setUid(order.getUid());
orderDetailInfo.setOrderCode(order.getOrderCode());
orderDetailInfo.setButtons(orderStatus.getDetailButtons());
orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
orderDetailInfo.setUserAddress(addressInfo);
//卖家
orderDetailInfo.setIncome(order.getIncome().toPlainString());
if(Objects.nonNull(computeBo)){
orderDetailInfo.setEarnestMoneyStr(computeBo.getEarnestMoneyStr());
orderDetailInfo.setEarnestMoney(computeBo.getEarnestMoney());
orderDetailInfo.setBankTransferFee(computeBo.getBankTransferFee());
orderDetailInfo.setPlatformFee(computeBo.getPlatformFee());
}
OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(order, orderStatus);
orderDetailInfo.setStatusDetail(statusDetail);
GoodsInfo goodsInfo = getGoodsInfo(sellerOrderGoods);
orderDetailInfo.setGoodsInfo(goodsInfo);
// 支付状态
if (order.getPayment() != null){
Payment payment = Payment.getPayment(order.getPayment());
if (payment != null){
orderDetailInfo.setPaymentStr(payment.getDesc());
orderDetailInfo.setPayment(order.getPayment());
}
}
orderDetailInfo.setCreateTime(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
return orderDetailInfo;
}
@Override
public OrderDetailInfo getOrderDetail(OrderRequest orderRequest) {
... ... @@ -159,8 +85,8 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
}
Integer skup = sellerOrder.getSkup();
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
Integer skupStatus = sellerOrderGoods.getStatus();
SkupStatus orderStatus = SkupStatus.getSkupStatus(skupStatus);
Integer skupStatusCode = sellerOrderGoods.getStatus();
SkupStatus skupStatus = SkupStatus.getSkupStatus(skupStatusCode);
SellerOrderMeta feeMeta = somMapper.selectByMetaKey(uid, skup, MetaKey.SELLER_FEE);
boolean metaIsPresent = Objects.nonNull(feeMeta);
... ... @@ -174,7 +100,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
return buildOrderDetail(sellerOrder, orderStatus, sellerOrderGoods, computeBo, addressInfo);
return buildOrderDetail(sellerOrder, skupStatus, sellerOrderGoods, computeBo, addressInfo);
}
return super.getOrderDetail(orderRequest);
... ... @@ -226,4 +152,95 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
return sellerOrderGoods;
}
/**
* 商品信息
* @param sellerOrderGoods
* @return
*/
private GoodsInfo getGoodsInfo(SellerOrderGoods sellerOrderGoods) {
GoodsInfo goodsInfo = new GoodsInfo();
goodsInfo.setProductName(sellerOrderGoods.getProductName());
goodsInfo.setColorName(sellerOrderGoods.getColorName());
goodsInfo.setSizeName(sellerOrderGoods.getSizeName());
goodsInfo.setGoodImg(sellerOrderGoods.getImageUrl());
goodsInfo.setGoodPrice(PriceFormater.addCnCurrencySymbol(sellerOrderGoods.getGoodsPrice().toPlainString()));
goodsInfo.setProductId(sellerOrderGoods.getProductId());
goodsInfo.setStorageId(sellerOrderGoods.getStorageId());
return goodsInfo;
}
/**
* 获取详情页 状态位明细
* @param order
* @param skupStatus
* @return
*/
private OrderDetailInfo.StatusDetail getStatusDetail(SellerOrder order,
SkupStatus skupStatus) {
OrderDetailInfo.StatusDetail statusDetail = OrderDetailInfo.StatusDetail.builder()
.status(skupStatus.getCode())
.statuStr(skupStatus.getDesc())
.detailDesc(skupStatus.getDetailShowDesc())
.paymentTips(skupStatus.getPaymentTips())
.build();
// 待付款时,剩余时间
if (skupStatus.getCode() == SkupStatus.CAN_NOT_SELL.getCode()){
statusDetail.setLeftTime(DateUtil.getCurrentTimeSecond() - order.getCreateTime());
}
return statusDetail;
}
private static List<SkupStatus> noNeedShowOrderCode = Arrays.asList(SkupStatus.CAN_NOT_SELL,SkupStatus.CAN_SELL,
SkupStatus.SELF_CANCEL_PAY, SkupStatus.TIMEOUT_CANCEL,
SkupStatus.SELLER_CANCEL_SELL, SkupStatus.YOHO_CANCEL_SELL);
private Long getOrderCode(SkupStatus skupStatus, SellerOrder order){
Long orderCode;
if (noNeedShowOrderCode.contains(skupStatus)){
orderCode = null;
}else{
orderCode = order.getOrderCode();
}
return orderCode;
}
private OrderDetailInfo buildOrderDetail(SellerOrder order, SkupStatus skupStatus,
SellerOrderGoods sellerOrderGoods, SoldPrdComputeBo computeBo
, AddressInfo addressInfo
) {
OrderDetailInfo orderDetailInfo = new OrderDetailInfo();
orderDetailInfo.setUid(order.getUid());
orderDetailInfo.setOrderCode(getOrderCode(skupStatus, order));
orderDetailInfo.setButtons(skupStatus.getDetailButtons());
orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
orderDetailInfo.setUserAddress(addressInfo);
//卖家
orderDetailInfo.setIncome(order.getIncome().toPlainString());
if(Objects.nonNull(computeBo)){
orderDetailInfo.setEarnestMoneyStr(computeBo.getEarnestMoneyStr());
orderDetailInfo.setEarnestMoney(computeBo.getEarnestMoney());
orderDetailInfo.setBankTransferFee(computeBo.getBankTransferFee());
orderDetailInfo.setPlatformFee(computeBo.getPlatformFee());
}
OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(order, skupStatus);
orderDetailInfo.setStatusDetail(statusDetail);
GoodsInfo goodsInfo = getGoodsInfo(sellerOrderGoods);
orderDetailInfo.setGoodsInfo(goodsInfo);
// 支付状态
if (order.getPayment() != null){
Payment payment = Payment.getPayment(order.getPayment());
if (payment != null){
orderDetailInfo.setPaymentStr(payment.getDesc());
orderDetailInfo.setPayment(order.getPayment());
}
}
orderDetailInfo.setCreateTime(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
return orderDetailInfo;
}
}
... ...