Authored by peuei

门店商品支持多门店

... ... @@ -72,9 +72,9 @@ public class StorageController {
* @return
*/
@RequestMapping(value = "/storeExportExcel")
public ApiResponse storeExportExcel(HttpServletResponse response) {
LOGGER.info("StorageController.storeExportExcel run ...");
return storageService.storeExportExcel(response);
public ApiResponse storeExportExcel(ProductRequestBo bo, HttpServletResponse response) {
LOGGER.info("StorageController.storeExportExcel run ... with param bo {}", bo.toString());
return storageService.storeExportExcel(bo, response);
}
@RequestMapping(value = "/getSecondDetailBySkup")
... ... @@ -86,7 +86,6 @@ public class StorageController {
/**
* 供订单model内部调用
*
*/
@RequestMapping(params = "method=ufo.product.secondDetail")
@ResponseBody
... ... @@ -106,7 +105,6 @@ public class StorageController {
/**
* 供订单model内部调用
*
*/
@RequestMapping(params = "method=ufo.product.storageDetial")
@ResponseBody
... ...
... ... @@ -189,10 +189,10 @@ public class StorageService {
public PageResponseBO<ProductResponceBo> storageListLineShops(ProductRequestBo request) {
LOGGER.info("StorageService storageListLineShops param = {}", request);
/**
* seller_uid 取配置的uid 即seller_uid过滤是无效,由后台配置决定
* 如果未传 seller_uid,则取后台配置,2019.07.19
*/
request.setSellerUid(null);
PageResponseBO<ProductResponceBo> productPageRsp = storageListPlus(request, sellerStoreMapUtil.getAllSellerUid());
final List<Integer> sellerUidList = getSellerUid(request);
PageResponseBO<ProductResponceBo> productPageRsp = storageListPlus(request, sellerUidList);
/**
* 设置图片
*/
... ... @@ -202,7 +202,7 @@ public class StorageService {
return productPageRsp;
List<Goods> goodsList = goodsMapper.selectByProductId(productIdList);
Map<Integer, Goods> goodsMap = CollectionUtil.extractMap(goodsList, Goods::getProductId);
List<StoragePrice> storagePricesList = storagePriceMapper.selectByProductIdsAndSellerUid(productIdList, sellerStoreMapUtil.getAllSellerUid(), DEFAULT_SKUP_STATUS);
List<StoragePrice> storagePricesList = storagePriceMapper.selectByProductIdsAndSellerUid(productIdList, sellerUidList, DEFAULT_SKUP_STATUS);
List<ProductResponceBo> filterList = new ArrayList<>();
productList.forEach(respBo -> {
Goods goods = goodsMap.get(respBo.getId());
... ... @@ -237,11 +237,11 @@ public class StorageService {
public PageResponseBO<ProductResponceBo> storagePriceListLineShops(ProductRequestBo bo) {
LOGGER.info("StorageService storagePriceListLineShops param = {}", bo);
/**
* seller_uid 取配置的uid 即seller_uid过滤是无效,由后台配置决定
* 如果未传 seller_uid,则取后台配置,2019.07.19
*/
bo.setSellerUid(null);
final List<Integer> sellerUidList = getSellerUid(bo);
bo.setStatus(DEFAULT_SKUP_STATUS);
PageResponseBO<ProductResponceBo> result = storagePriceListPlus(bo, sellerStoreMapUtil.getAllSellerUid());
PageResponseBO<ProductResponceBo> result = storagePriceListPlus(bo, sellerUidList);
/**
* 排序 : 尺码小 价格低 创建时间前 的排序越靠前
*/
... ... @@ -277,30 +277,19 @@ public class StorageService {
*
* @return
*/
public ApiResponse storeExportExcel(HttpServletResponse response) {
/*
Integer userId = new UserHelper().getUserId();
Integer count = storagePriceMapper.selectExportInfoCount(sellerStoreMapUtil.getAllSellerUid(), ON_SALE_STATUS);
if (count <= 0) {
LOGGER.info("export excel exception, no data to export");
return new ApiResponse(201, "no data to export");
}
count = count >= MAX_ROWS ? MAX_ROWS : count;
*/
public ApiResponse storeExportExcel(ProductRequestBo bo, HttpServletResponse response) {
/**
* 查询 商品基本信息
* 查询 商品基本信息,如果未传 seller_uid,则取后台配置,2019.07.19
*/
// TODO: 这里通过配置获得 seller_uid, 如何直接获得 seller_uid ?
final List<Integer> sellerUidList = getSellerUid(bo);
// 数据量比较大,选用 LinkedList
LinkedList<ExportStoragePrice> baseInfoList = storagePriceMapper.selectExportInfoList(sellerStoreMapUtil.getAllSellerUid(), ON_SALE_STATUS, MAX_ROWS);
LinkedList<ExportStoragePrice> baseInfoList = storagePriceMapper.selectExportInfoList(sellerUidList, ON_SALE_STATUS, MAX_ROWS);
if (baseInfoList.isEmpty()) {
LOGGER.info("export excel exception, no data to export");
return new ApiResponse(201, "no data to export");
}
// 查询该买家下的所有 SKU / storage_id
final ArrayList<Integer> skuList = storagePriceMapper.selectAllSkuBySeller(sellerStoreMapUtil.getAllSellerUid(), ON_SALE_STATUS);
final ArrayList<Integer> skuList = storagePriceMapper.selectAllSkuBySeller(sellerUidList, ON_SALE_STATUS);
/**
* 查询 SKU 全网最低价和库存
*/
... ... @@ -344,6 +333,17 @@ public class StorageService {
return new ApiResponse("export excel success");
}
private List<Integer> getSellerUid(ProductRequestBo bo) {
List<Integer> sellerUidList;
if (bo.getSellerUid() != null) {
sellerUidList = new ArrayList<>();
sellerUidList.add(bo.getSellerUid());
} else {
sellerUidList = sellerStoreMapUtil.getAllSellerUid();
}
return sellerUidList;
}
public SecondDetailResp getSecondDetailBySkup(Integer skup) {
List<SecondhandImages> imageList = secondhandImagesService.selectBySkup(skup);
... ...
... ... @@ -24,7 +24,7 @@
<div style="margin-left: 30px;" class="div_search">
<input id="status" type="text"/><!-- 状态 -->
<input id="SKUP" type="text"><!-- SKU-P -->
<input id="sellerUid" type="text"><!-- 卖家UID -->
<!--<input id="sellerUid" type="text">-->
<input id="storageId" type="text"><!-- SKU -->
<input id="sizeId" type="text"><!-- 尺码 -->
<a id="searchLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">筛选</a>
... ... @@ -45,6 +45,8 @@
// 解析出需要 ID
var productId = parseURL(window.location.href).productId;
var midSortId = parseURL(window.location.href).midSortId;
var paramSellerUid = parseURL(window.location.href).sellerUid;
paramSellerUid = paramSellerUid == undefined ? "" : paramSellerUid;
// 状态枚举
var ENUM = {
... ... @@ -70,7 +72,8 @@
url: contextPath + "/storage/storagePriceListLineShops",
method: 'POST',
queryParams: {
id: productId
id: productId,
sellerUid: paramSellerUid
},
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
... ...
... ... @@ -26,7 +26,7 @@
<input id="maxSortId" type="text"><!-- 一级分类 -->
<input id="middleSortId" type="text"><!-- 二级分类 -->
<input id="brandName" type="text"><!-- 品牌名称 -->
<input id="sellerUid" type="text"><!-- 卖家UID -->
<!--<input id="sellerUid" type="text">-->
<input id="storageNum" type="text"><!-- 商品库存 -->
<input id="storageId" type="text"><!-- SKU -->
<input id="skup" type="text"><!-- SKU-P -->
... ... @@ -43,9 +43,26 @@
<script type="text/javascript">
// 解析URL
function parseURL(url) {
var url = url.split("?")[1];
var para = url.split("&");
var len = para.length;
var res = {};
var arr = [];
for (var i = 0; i < len; i++) {
arr = para[i].split("=");
res[arr[0]] = arr[1];
}
return res;
}
(function () {
// 解析出需要 ID
var paramSellerUid = parseURL(window.location.href).sellerUid;
paramSellerUid = paramSellerUid == undefined ? "" : paramSellerUid;
// 加载列表
$("#productTable").myDatagrid({
fit: true,
... ... @@ -53,6 +70,7 @@
nowrap: false,
url: contextPath + "/storage/storageListLineShops",
method: 'POST',
queryParams: {sellerUid: paramSellerUid},
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
... ... @@ -243,6 +261,9 @@
onClick: function () {
var action = contextPath + "/storage/storeExportExcel";
var form = $("<form></form>");
var inputType = $("<input type='text' name='sellerUid'/>");
inputType.attr("value", paramSellerUid);
form.append(inputType);
form.attr('action', action);
form.attr('method', 'post');
form.appendTo("body");
... ... @@ -310,9 +331,12 @@
// 跳转编辑页
function detailStorage(id, midSortId) {
this.location.href = contextPath + "/html/goods/storageLineShops/storageLineShopsDetail.html?productId=" + id + "&midSortId=" + midSortId + "&time_version=" + new Date().getTime();
this.location.href = contextPath
+ "/html/goods/storageLineShops/storageLineShopsDetail.html?productId=" + id
+ "&midSortId=" + midSortId
+ "&time_version=" + new Date().getTime()
+ "&sellerUid=" + paramSellerUid;
}
}())
</script>
... ...