Authored by tanling

急速发货

... ... @@ -2,6 +2,7 @@ package com.yohoufo.order.controller;
import com.google.common.base.Throwables;
import com.yohobuy.ufo.model.order.req.*;
import com.yohobuy.ufo.model.order.resp.FastDeliveryBatchOnShelfResp;
import com.yohobuy.ufo.model.order.resp.FastDeliveryGetShelfDetailResp;
import com.yohobuy.ufo.model.response.StorageInfoResp;
import com.yohoufo.common.ApiResponse;
... ... @@ -44,8 +45,8 @@ public class ErpFastDeliveryController {
String msg = "成功";
try{
List<Integer> skupIds = erpFastDeliveryService.batchOnShelf(req);
return new ApiResponse.ApiResponseBuilder().data(skupIds).code(code).message(msg).build();
List<FastDeliveryBatchOnShelfResp> resps = erpFastDeliveryService.batchOnShelf(req);
return new ApiResponse.ApiResponseBuilder().data(resps).code(code).message(msg).build();
}catch (Exception ex){
code = 500;
if(ex instanceof UfoServiceException){
... ...
package com.yohoufo.order.service;
import com.yohobuy.ufo.model.order.req.*;
import com.yohobuy.ufo.model.order.resp.FastDeliveryBatchOnShelfResp;
import com.yohobuy.ufo.model.order.resp.FastDeliveryGetShelfDetailResp;
import com.yohobuy.ufo.model.response.StorageInfoResp;
... ... @@ -19,7 +20,7 @@ public interface IErpFastDeliveryService {
* 批量上架
* @param req
*/
List<Integer> batchOnShelf(FastDeliveryBatchOnShelfReq req);
List<FastDeliveryBatchOnShelfResp> batchOnShelf(FastDeliveryBatchOnShelfReq req);
/**
* 单个下架
... ...
... ... @@ -10,10 +10,7 @@ import com.yohobuy.ufo.model.order.common.SellerFuncEnum;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.req.*;
import com.yohobuy.ufo.model.order.resp.FastDeliveryGetShelfDetailResp;
import com.yohobuy.ufo.model.order.resp.FastDeliveryGetShelfResp;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohobuy.ufo.model.order.resp.*;
import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo;
import com.yohobuy.ufo.model.request.product.ProductRequestBo;
import com.yohobuy.ufo.model.response.ProductDetailResp;
... ... @@ -360,7 +357,7 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
}
@Override
public List<Integer> batchOnShelf(FastDeliveryBatchOnShelfReq req) {
public List<FastDeliveryBatchOnShelfResp> batchOnShelf(FastDeliveryBatchOnShelfReq req) {
// 1.检查入口参数
checkBatchOnShelf(req);
... ... @@ -381,6 +378,7 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
List<Integer> skupIds = Lists.newArrayList();
// 上架的代码(和之前同)
List<FastDeliveryBatchOnShelfResp> shelfResps = Lists.newArrayList();
for(FastDeliveryBatchOnShelfReq.ProductInfo productInfo : req.getProductInfos()){
StorageCheckResp storage = storageMap.get(getProductCodeSizeNameKey(productInfo.getProductCode(), productInfo.getSizeName()));
... ... @@ -391,6 +389,13 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
productInfo.setStorageId(storage.getStorageId());
FastDeliveryBatchOnShelfResp resp = new FastDeliveryBatchOnShelfResp();
resp.setProductCode(productInfo.getProductCode());
resp.setSizeName(productInfo.getSizeName());
FastDeliveryBatchOnShelfResp.ShelfResult shelfResult = new FastDeliveryBatchOnShelfResp.ShelfResult();
resp.setShelfResult(shelfResult);
shelfResps.add(resp);
ImPrdNode node = ImPrdNode.builder().uid(req.getUid())
.sellerWrapper(sellerWrapper)
.storageId(productInfo.getStorageId())
... ... @@ -403,19 +408,20 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
try{
SellerOrderSubmitHandler.ForkJoinResult fjr = importPublishExcutor.publishOne(node);
skupIds.addAll(fjr.getSkupIds());
shelfResult.setSkups(fjr.getSkupIds());
responseList.add(buildShelfResp(req, productInfo, fjr));
}catch(Exception ex){
logger.warn("in batchOnShelf.publishOne fail, uid {} productCode {} sizeName {} storageId {} salePrice {} storageNum {}",
req.getUid(), productInfo.getProductCode(), productInfo.getSizeName(), productInfo.getStorageId(),
productInfo.getConvertedPrice(), productInfo.getNum());
logger.warn("in batchOnShelf.publishOne fail, productCode {} sizeName {} storageId {} salePrice {} storageNum {}, {}",
productInfo.getProductCode(), productInfo.getSizeName(), productInfo.getStorageId(),
productInfo.getConvertedPrice(), productInfo.getNum(), ex);
shelfResult.setErrorMessage(ex.getMessage());
}
}
if (CollectionUtils.isNotEmpty(responseList)){
productProxyService.batchAdd(responseList);
return skupIds;
return shelfResps;
}else{
logger.warn("responseList empty");
throw new UfoServiceException(502, "上架失败!");
... ...