...
|
...
|
@@ -3,6 +3,7 @@ package com.yohoufo.order.service.impl; |
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderAttributes;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderCodeType;
|
|
|
import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq;
|
|
|
import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq;
|
...
|
...
|
@@ -28,6 +29,10 @@ import org.slf4j.Logger; |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
@Service
|
|
|
public class AppraiseOrderService {
|
|
|
private final Logger logger = LoggerUtils.getBuyerOrderLogger();
|
...
|
...
|
@@ -59,11 +64,40 @@ public class AppraiseOrderService { |
|
|
if (productId <= 0){
|
|
|
throw new UfoServiceException(400, "商品ID错误");
|
|
|
}
|
|
|
int orderType = req.getOrderType();
|
|
|
OrderAttributes orderAttributes = checkOrderType(orderType);
|
|
|
double fee = 0D;
|
|
|
switch (orderAttributes){
|
|
|
case DEPOSITE:{
|
|
|
fee = 15D;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
case APPRAISE:{
|
|
|
fee = 31D;
|
|
|
break;
|
|
|
}
|
|
|
default:{
|
|
|
throw new UfoServiceException(400, "orderType错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
double fee = 15D;
|
|
|
return AppraiseOrderComputeResp.builder().fee(String.valueOf(fee)).build();
|
|
|
}
|
|
|
|
|
|
private static final List<OrderAttributes> legalOrderTypes = new ArrayList<OrderAttributes>(2){
|
|
|
{
|
|
|
add(OrderAttributes.DEPOSITE);
|
|
|
add(OrderAttributes.APPRAISE);
|
|
|
}
|
|
|
};
|
|
|
private OrderAttributes checkOrderType(int orderType){
|
|
|
OrderAttributes oa = OrderAttributes.getOrderAttributes(orderType);
|
|
|
if (Objects.isNull(oa) || !legalOrderTypes.contains(oa)){
|
|
|
throw new UfoServiceException(400, "orderType错误");
|
|
|
}
|
|
|
return oa;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
...
|
...
|
@@ -106,6 +140,7 @@ public class AppraiseOrderService { |
|
|
int productId;
|
|
|
AddressInfo hiddenBackAddress;
|
|
|
AddressInfo noHiddenBackAddress;
|
|
|
OrderAttributes orderAttributes;
|
|
|
}
|
|
|
|
|
|
private PreparedNode checkAndAcquire(AppraiseOrderSubmitReq req){
|
...
|
...
|
@@ -117,6 +152,7 @@ public class AppraiseOrderService { |
|
|
if (productId <= 0){
|
|
|
throw new UfoServiceException(400, "商品ID错误");
|
|
|
}
|
|
|
OrderAttributes orderAttributes = OrderAttributes.APPRAISE;
|
|
|
|
|
|
int addressId = AddressUtil.getDecryptStr(req.getAddressId());
|
|
|
if (addressId < 0){
|
...
|
...
|
@@ -139,6 +175,7 @@ public class AppraiseOrderService { |
|
|
.productId(productId)
|
|
|
.hiddenBackAddress(hiddenBackAddress)
|
|
|
.noHiddenBackAddress(noHiddenBackAddress)
|
|
|
.orderAttributes(orderAttributes)
|
|
|
.build();
|
|
|
}
|
|
|
|
...
|
...
|
|