Authored by chenjian

门店skup接口加门店

... ... @@ -710,16 +710,23 @@ public class ProductController {
return productService.queryProductLeastFlashSalePrice(productId);
}
/**
* 门店UFO小程序扫码购买时调用
* @param skup
* @param storeId
* @return
*/
@IgnoreSession
@RequestMapping(params = "method=ufo.product.skup.detail")
public ApiResponse querySkupDetailBySkup(@RequestParam(value = "skup") Integer skup) {
public ApiResponse querySkupDetailBySkup(@RequestParam(value = "skup") Integer skup,
@RequestParam(value = "store_id", required = false) Integer storeId) {
if (null == skup) {
LOG.info("in method=ufo.product.skup.detail skup Is Null");
return new ApiResponse(400, "skup Is Null", null);
}
LOG.info("in method=ufo.product.skup.detail skup={}", skup);
LOG.info("in method=ufo.product.skup.detail skup={}, storeId={}", skup, storeId);
SkupInfo skupInfo = productService.querySkupDetailBySkup(skup);
SkupInfo skupInfo = productService.querySkupDetailBySkup(skup, storeId);
return new ApiResponse.ApiResponseBuilder().data(skupInfo).code(200).build();
}
... ...
... ... @@ -83,7 +83,7 @@ public interface ProductService {
JSONObject querySaleCategoryDetailInfo(Integer id);
SkupInfo querySkupDetailBySkup(int skup);
SkupInfo querySkupDetailBySkup(Integer skup, Integer storeId);
/**
* 获取门店显示屏 sku-p 详情
... ...
... ... @@ -16,6 +16,8 @@ import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.yohobuy.ufo.model.response.store.StoreInfoBo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.dal.product.*;
import com.yohoufo.dal.product.model.*;
import org.apache.commons.collections.MapUtils;
... ... @@ -1182,7 +1184,7 @@ public class ProductServiceImpl implements ProductService {
}
@Override
public SkupInfo querySkupDetailBySkup(int skup) {
public SkupInfo querySkupDetailBySkup(Integer skup, Integer storeId) {
StoragePrice skupDo = storagePriceMapper.selectBySkup(skup);
... ... @@ -1207,6 +1209,13 @@ public class ProductServiceImpl implements ProductService {
Pair<Integer, String> skupStatusPair = product.getShelveStatus() == 1 ? getSkupStatus(skupDo.getStatus()) : getSkupStatus(0);
String storeName = "YOHO!STORE艾尚店";
if (storeId != null && storeId > 0) {
StoreInfoBo storeInfoBo = queryStoreInfo(storeId);
if(storeInfoBo != null)
storeName = storeInfoBo.getStoreName();
}
return SkupInfo.builder()
.productId(product.getId())
.productName(product.getProductName())
... ... @@ -1221,11 +1230,22 @@ public class ProductServiceImpl implements ProductService {
.price(skupDo.getPrice())
.status(skupStatusPair.getLeft())
.statusStr(skupStatusPair.getRight())
.storeName("YOHO!STORE艾尚店")
.storeName(storeName)
.build();
}
//查询门店信息
private StoreInfoBo queryStoreInfo(int storeId) {
ApiResponse resp = ufoServiceCaller.call("ufo.store.queryStoreInfoById", ApiResponse.class, storeId);
if (resp != null && resp.getCode()==200) {
if (resp.getData() != null) {
return (StoreInfoBo)resp.getData();
}
}
return null;
}
/**
* skup状态:0:已下架;1:可售;2:已售出
*
... ...