...
|
...
|
@@ -50,6 +50,7 @@ import com.yohoufo.order.service.concurrent.ThreadPoolFactory; |
|
|
import com.yohoufo.order.service.handler.SellerOrderComputeHandler;
|
|
|
import com.yohoufo.order.service.handler.SellerOrderSubmitHandler;
|
|
|
import com.yohoufo.order.service.impl.processor.ChangePricePrepareProcessor;
|
|
|
import com.yohoufo.order.service.impl.processor.PriceComputePrepareProcessor;
|
|
|
import com.yohoufo.order.service.impl.processor.SellerBatchCancelPrepareProcessor;
|
|
|
import com.yohoufo.order.service.impl.processor.SellerOrderPrepareProcessor;
|
|
|
import com.yohoufo.order.service.impl.visitor.OffShelveCancelCase;
|
...
|
...
|
@@ -128,58 +129,56 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
@Autowired
|
|
|
private MerchantOrderPaymentService merchantOrderPaymentService;
|
|
|
|
|
|
@Autowired
|
|
|
private PriceComputePrepareProcessor priceComputePrepareProcessor;
|
|
|
|
|
|
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, "非法数量值");
|
|
|
PriceComputePrepareProcessor.PriceComputeNode pcn = priceComputePrepareProcessor.checkBasePrice(req);
|
|
|
int uid = pcn.getUid();
|
|
|
Integer storageId = pcn.getStorageId();
|
|
|
int num = pcn.getNum();
|
|
|
BigDecimal prdPrice = pcn.getPrdPrice();
|
|
|
String tips = null;
|
|
|
try {
|
|
|
sellerOrderPrepareProcessor.checkPrice(storageId, prdPrice, false);
|
|
|
}catch (Exception ex){
|
|
|
if (ex instanceof UfoServiceException && ((UfoServiceException) ex).getCode() == SellerOrderPrepareProcessor.TIPS_ERROR_CODE){
|
|
|
tips = ((UfoServiceException) ex).getMessage();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*商品鉴定费 ¥10.00
|
|
|
商品包装费 ¥10.00
|
|
|
平台服务费(5%,优惠期间0%) ¥0.00
|
|
|
*/
|
|
|
String price = req.getPrice();
|
|
|
if (StringUtils.isBlank(price)){
|
|
|
log.warn("in computePublishPrd price illegal , req {}", req);
|
|
|
throw new GatewayException(400, "没有价格");
|
|
|
}
|
|
|
/*
|
|
|
if(!price.endsWith("9")){
|
|
|
log.warn("in computePublishPrd price illegal , req {}", req);
|
|
|
throw new GatewayException(400, "价格须为以9结尾的正整数");
|
|
|
}*/
|
|
|
SoldPrdComputeBo spc = buildSoldPrdComputeBo(uid, num, prdPrice);
|
|
|
spc.setTips(tips);
|
|
|
return spc;
|
|
|
}
|
|
|
|
|
|
BigDecimal prdPrice = null;
|
|
|
try{
|
|
|
prdPrice = new BigDecimal(price);
|
|
|
}catch (Exception e){
|
|
|
log.warn("in computePublishPrd price convert BigDecimal fail, {}", req);
|
|
|
throw new GatewayException(400, "非法数字");
|
|
|
public SoldPrdComputeBo computeChangePrice(SellerOrderComputeReq req) throws GatewayException {
|
|
|
log.info("in computeChangePrice, req {}", req);
|
|
|
PriceComputePrepareProcessor.PriceComputeNode pcn = priceComputePrepareProcessor.checkBasePrice(req);
|
|
|
int uid = pcn.getUid();
|
|
|
Integer storageId = pcn.getStorageId();
|
|
|
int num = pcn.getNum();
|
|
|
BigDecimal prdPrice = pcn.getPrdPrice();
|
|
|
|
|
|
SellerOrderComputeResult computeResult = computeHandler.compute(prdPrice);
|
|
|
/**
|
|
|
* 验证是否是入驻商家
|
|
|
*/
|
|
|
if(sellerOrderPrepareProcessor.checkIsEntry(uid)){
|
|
|
sellerOrderPrepareProcessor.checkNGetMergeEarnestMoney(uid, computeResult.getEarnestMoney().getEarnestMoney(), num, prdPrice);
|
|
|
}
|
|
|
|
|
|
SoldPrdComputeBo spc = SellerOrderConvertor.computeResult2SoldPrdComputeBo(computeResult);
|
|
|
|
|
|
String tips = null;
|
|
|
try {
|
|
|
sellerOrderPrepareProcessor.checkPrice(storageId, prdPrice, false);
|
|
|
sellerOrderPrepareProcessor.checkPrice(storageId, prdPrice, true);
|
|
|
}catch (Exception ex){
|
|
|
if (ex instanceof UfoServiceException && ((UfoServiceException) ex).getCode() == SellerOrderPrepareProcessor.TIPS_ERROR_CODE){
|
|
|
tips = ((UfoServiceException) ex).getMessage();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
SoldPrdComputeBo spc = buildSoldPrdComputeBo(uid, num, prdPrice);
|
|
|
spc.setTips(tips);
|
|
|
return spc;
|
|
|
}
|
...
|
...
|
@@ -553,7 +552,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
@Autowired
|
|
|
private SellerFeeService sellerFeeService;
|
|
|
/**
|
|
|
* todo
|
|
|
* 批量调价
|
|
|
* @param req
|
|
|
* @return
|
|
|
*/
|
...
|
...
|
@@ -615,7 +614,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
failCnt = skupMap.size();
|
|
|
}
|
|
|
BatchChangePriceResp resp = BatchChangePriceResp.builder().successCnt(successCnt).failCnt(failCnt)
|
|
|
.tips("变价成功").build();
|
|
|
.tips(cppDto.getTips()).build();
|
|
|
return resp;
|
|
|
}
|
|
|
|
...
|
...
|
|