...
|
...
|
@@ -12,6 +12,7 @@ import com.yohoufo.common.alarm.EventBusPublisher; |
|
|
import com.yohoufo.common.alarm.SmsAlarmEvent;
|
|
|
import com.yohoufo.common.exception.GatewayException;
|
|
|
import com.yohoufo.common.utils.AddressUtil;
|
|
|
import com.yohoufo.common.utils.BigDecimalHelper;
|
|
|
import com.yohoufo.common.utils.DateUtil;
|
|
|
import com.yohoufo.dal.order.*;
|
|
|
import com.yohoufo.dal.order.model.*;
|
...
|
...
|
@@ -23,6 +24,8 @@ import com.yohoufo.order.event.OrderCancelEvent; |
|
|
import com.yohoufo.order.model.AddressInfo;
|
|
|
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
|
|
|
import com.yohoufo.order.model.SellerOrderContext;
|
|
|
import com.yohoufo.order.model.dto.EarnestMoney;
|
|
|
import com.yohoufo.order.model.dto.PlatformFeeDto;
|
|
|
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
|
|
|
import com.yohoufo.order.model.request.OrderListRequest;
|
|
|
import com.yohoufo.order.model.request.OrderRequest;
|
...
|
...
|
@@ -110,13 +113,22 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
|
|
|
public SoldPrdComputeBo computePublishPrd(SellerOrderComputeReq req) throws GatewayException {
|
|
|
log.info("in computePublishPrd, req {}", req);
|
|
|
|
|
|
int uid = req.getUid();
|
|
|
if(uid <= 0){
|
|
|
log.warn("in computePublishPrd uid illegal , req {}", req);
|
|
|
throw new GatewayException(400, "用户ID错误");
|
|
|
}
|
|
|
//
|
|
|
Integer storageId = req.getStorageId();
|
|
|
if (storageId <=0 ){
|
|
|
log.warn("in computePublishPrd storageId illegal , req {}", req);
|
|
|
throw new GatewayException(400, "storageId 错误");
|
|
|
}
|
|
|
int num;
|
|
|
if ((num = req.getNum())<=0){
|
|
|
log.warn("in computePublishPrd num illegal , req {}", req);
|
|
|
throw new GatewayException(400, "非法数量值");
|
|
|
}
|
|
|
|
|
|
/*商品鉴定费 ¥10.00
|
|
|
商品包装费 ¥10.00
|
...
|
...
|
@@ -133,19 +145,15 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
throw new GatewayException(400, "价格须为以9结尾的正整数");
|
|
|
}
|
|
|
|
|
|
|
|
|
BigDecimal prdPrice = null;
|
|
|
try{
|
|
|
prdPrice = new BigDecimal(price);
|
|
|
}catch (Exception e){
|
|
|
log.warn("in computePublishPrd price convert BigDecimal fail, {}", req);
|
|
|
return null;
|
|
|
throw new GatewayException(400, "非法数字");
|
|
|
}
|
|
|
|
|
|
checkPrice(storageId, prdPrice, false);
|
|
|
|
|
|
|
|
|
return buildSoldPrdComputeBo(prdPrice);
|
|
|
return buildSoldPrdComputeBo(uid, num, prdPrice);
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -481,9 +489,28 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
|
|
|
|
|
|
|
|
|
private boolean isEnough(int uid, BigDecimal mEarestMoney){
|
|
|
|
|
|
public SoldPrdComputeBo buildSoldPrdComputeBo(BigDecimal prdPrice){
|
|
|
//todo 取出入驻商家的钱包余额,判断保证金总额是否足够扣减
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
private SoldPrdComputeBo buildSoldPrdComputeBo(int uid, int num, BigDecimal prdPrice){
|
|
|
SellerOrderComputeResult computeResult = computeHandler.compute(prdPrice);
|
|
|
/**
|
|
|
* 验证是否是入驻商家
|
|
|
*/
|
|
|
boolean isEntryShop = userProxyService.isEntryShop(uid);
|
|
|
if(isEntryShop){
|
|
|
BigDecimal singleEarestMoney = computeResult.getEarnestMoney().getEarnestMoney();
|
|
|
BigDecimal mEarestMoney = BigDecimalHelper.halfUp(new BigDecimal(num).multiply(singleEarestMoney));
|
|
|
|
|
|
boolean isEnough = isEnough(uid, mEarestMoney);
|
|
|
if (!isEnough){
|
|
|
|
|
|
throw new ServiceException(ServiceError.WALLET_EARNESTMONEY_IS_NOT_ENOUGH);
|
|
|
}
|
|
|
}
|
|
|
SoldPrdComputeBo computeBo = SellerOrderConvertor.computeResult2SoldPrdComputeBo(computeResult);
|
|
|
return computeBo;
|
|
|
}
|
...
|
...
|
|