Authored by peuei

门店商品支持多门店

@@ -72,9 +72,9 @@ public class StorageController { @@ -72,9 +72,9 @@ public class StorageController {
72 * @return 72 * @return
73 */ 73 */
74 @RequestMapping(value = "/storeExportExcel") 74 @RequestMapping(value = "/storeExportExcel")
75 - public ApiResponse storeExportExcel(HttpServletResponse response) {  
76 - LOGGER.info("StorageController.storeExportExcel run ...");  
77 - return storageService.storeExportExcel(response); 75 + public ApiResponse storeExportExcel(ProductRequestBo bo, HttpServletResponse response) {
  76 + LOGGER.info("StorageController.storeExportExcel run ... with param bo {}", bo.toString());
  77 + return storageService.storeExportExcel(bo, response);
78 } 78 }
79 79
80 @RequestMapping(value = "/getSecondDetailBySkup") 80 @RequestMapping(value = "/getSecondDetailBySkup")
@@ -86,7 +86,6 @@ public class StorageController { @@ -86,7 +86,6 @@ public class StorageController {
86 86
87 /** 87 /**
88 * 供订单model内部调用 88 * 供订单model内部调用
89 - *  
90 */ 89 */
91 @RequestMapping(params = "method=ufo.product.secondDetail") 90 @RequestMapping(params = "method=ufo.product.secondDetail")
92 @ResponseBody 91 @ResponseBody
@@ -106,7 +105,6 @@ public class StorageController { @@ -106,7 +105,6 @@ public class StorageController {
106 105
107 /** 106 /**
108 * 供订单model内部调用 107 * 供订单model内部调用
109 - *  
110 */ 108 */
111 @RequestMapping(params = "method=ufo.product.storageDetial") 109 @RequestMapping(params = "method=ufo.product.storageDetial")
112 @ResponseBody 110 @ResponseBody
@@ -189,10 +189,10 @@ public class StorageService { @@ -189,10 +189,10 @@ public class StorageService {
189 public PageResponseBO<ProductResponceBo> storageListLineShops(ProductRequestBo request) { 189 public PageResponseBO<ProductResponceBo> storageListLineShops(ProductRequestBo request) {
190 LOGGER.info("StorageService storageListLineShops param = {}", request); 190 LOGGER.info("StorageService storageListLineShops param = {}", request);
191 /** 191 /**
192 - * seller_uid 取配置的uid 即seller_uid过滤是无效,由后台配置决定 192 + * 如果未传 seller_uid,则取后台配置,2019.07.19
193 */ 193 */
194 - request.setSellerUid(null);  
195 - PageResponseBO<ProductResponceBo> productPageRsp = storageListPlus(request, sellerStoreMapUtil.getAllSellerUid()); 194 + final List<Integer> sellerUidList = getSellerUid(request);
  195 + PageResponseBO<ProductResponceBo> productPageRsp = storageListPlus(request, sellerUidList);
196 /** 196 /**
197 * 设置图片 197 * 设置图片
198 */ 198 */
@@ -202,7 +202,7 @@ public class StorageService { @@ -202,7 +202,7 @@ public class StorageService {
202 return productPageRsp; 202 return productPageRsp;
203 List<Goods> goodsList = goodsMapper.selectByProductId(productIdList); 203 List<Goods> goodsList = goodsMapper.selectByProductId(productIdList);
204 Map<Integer, Goods> goodsMap = CollectionUtil.extractMap(goodsList, Goods::getProductId); 204 Map<Integer, Goods> goodsMap = CollectionUtil.extractMap(goodsList, Goods::getProductId);
205 - List<StoragePrice> storagePricesList = storagePriceMapper.selectByProductIdsAndSellerUid(productIdList, sellerStoreMapUtil.getAllSellerUid(), DEFAULT_SKUP_STATUS); 205 + List<StoragePrice> storagePricesList = storagePriceMapper.selectByProductIdsAndSellerUid(productIdList, sellerUidList, DEFAULT_SKUP_STATUS);
206 List<ProductResponceBo> filterList = new ArrayList<>(); 206 List<ProductResponceBo> filterList = new ArrayList<>();
207 productList.forEach(respBo -> { 207 productList.forEach(respBo -> {
208 Goods goods = goodsMap.get(respBo.getId()); 208 Goods goods = goodsMap.get(respBo.getId());
@@ -237,11 +237,11 @@ public class StorageService { @@ -237,11 +237,11 @@ public class StorageService {
237 public PageResponseBO<ProductResponceBo> storagePriceListLineShops(ProductRequestBo bo) { 237 public PageResponseBO<ProductResponceBo> storagePriceListLineShops(ProductRequestBo bo) {
238 LOGGER.info("StorageService storagePriceListLineShops param = {}", bo); 238 LOGGER.info("StorageService storagePriceListLineShops param = {}", bo);
239 /** 239 /**
240 - * seller_uid 取配置的uid 即seller_uid过滤是无效,由后台配置决定 240 + * 如果未传 seller_uid,则取后台配置,2019.07.19
241 */ 241 */
242 - bo.setSellerUid(null); 242 + final List<Integer> sellerUidList = getSellerUid(bo);
243 bo.setStatus(DEFAULT_SKUP_STATUS); 243 bo.setStatus(DEFAULT_SKUP_STATUS);
244 - PageResponseBO<ProductResponceBo> result = storagePriceListPlus(bo, sellerStoreMapUtil.getAllSellerUid()); 244 + PageResponseBO<ProductResponceBo> result = storagePriceListPlus(bo, sellerUidList);
245 /** 245 /**
246 * 排序 : 尺码小 价格低 创建时间前 的排序越靠前 246 * 排序 : 尺码小 价格低 创建时间前 的排序越靠前
247 */ 247 */
@@ -277,30 +277,19 @@ public class StorageService { @@ -277,30 +277,19 @@ public class StorageService {
277 * 277 *
278 * @return 278 * @return
279 */ 279 */
280 - public ApiResponse storeExportExcel(HttpServletResponse response) {  
281 -  
282 - /*  
283 - Integer userId = new UserHelper().getUserId();  
284 - Integer count = storagePriceMapper.selectExportInfoCount(sellerStoreMapUtil.getAllSellerUid(), ON_SALE_STATUS);  
285 - if (count <= 0) {  
286 - LOGGER.info("export excel exception, no data to export");  
287 - return new ApiResponse(201, "no data to export");  
288 - }  
289 - count = count >= MAX_ROWS ? MAX_ROWS : count;  
290 - */  
291 - 280 + public ApiResponse storeExportExcel(ProductRequestBo bo, HttpServletResponse response) {
292 /** 281 /**
293 - * 查询 商品基本信息 282 + * 查询 商品基本信息,如果未传 seller_uid,则取后台配置,2019.07.19
294 */ 283 */
295 - // TODO: 这里通过配置获得 seller_uid, 如何直接获得 seller_uid ? 284 + final List<Integer> sellerUidList = getSellerUid(bo);
296 // 数据量比较大,选用 LinkedList 285 // 数据量比较大,选用 LinkedList
297 - LinkedList<ExportStoragePrice> baseInfoList = storagePriceMapper.selectExportInfoList(sellerStoreMapUtil.getAllSellerUid(), ON_SALE_STATUS, MAX_ROWS); 286 + LinkedList<ExportStoragePrice> baseInfoList = storagePriceMapper.selectExportInfoList(sellerUidList, ON_SALE_STATUS, MAX_ROWS);
298 if (baseInfoList.isEmpty()) { 287 if (baseInfoList.isEmpty()) {
299 LOGGER.info("export excel exception, no data to export"); 288 LOGGER.info("export excel exception, no data to export");
300 return new ApiResponse(201, "no data to export"); 289 return new ApiResponse(201, "no data to export");
301 } 290 }
302 // 查询该买家下的所有 SKU / storage_id 291 // 查询该买家下的所有 SKU / storage_id
303 - final ArrayList<Integer> skuList = storagePriceMapper.selectAllSkuBySeller(sellerStoreMapUtil.getAllSellerUid(), ON_SALE_STATUS); 292 + final ArrayList<Integer> skuList = storagePriceMapper.selectAllSkuBySeller(sellerUidList, ON_SALE_STATUS);
304 /** 293 /**
305 * 查询 SKU 全网最低价和库存 294 * 查询 SKU 全网最低价和库存
306 */ 295 */
@@ -344,6 +333,17 @@ public class StorageService { @@ -344,6 +333,17 @@ public class StorageService {
344 return new ApiResponse("export excel success"); 333 return new ApiResponse("export excel success");
345 } 334 }
346 335
  336 + private List<Integer> getSellerUid(ProductRequestBo bo) {
  337 + List<Integer> sellerUidList;
  338 + if (bo.getSellerUid() != null) {
  339 + sellerUidList = new ArrayList<>();
  340 + sellerUidList.add(bo.getSellerUid());
  341 + } else {
  342 + sellerUidList = sellerStoreMapUtil.getAllSellerUid();
  343 + }
  344 + return sellerUidList;
  345 + }
  346 +
347 public SecondDetailResp getSecondDetailBySkup(Integer skup) { 347 public SecondDetailResp getSecondDetailBySkup(Integer skup) {
348 348
349 List<SecondhandImages> imageList = secondhandImagesService.selectBySkup(skup); 349 List<SecondhandImages> imageList = secondhandImagesService.selectBySkup(skup);
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 <div style="margin-left: 30px;" class="div_search"> 24 <div style="margin-left: 30px;" class="div_search">
25 <input id="status" type="text"/><!-- 状态 --> 25 <input id="status" type="text"/><!-- 状态 -->
26 <input id="SKUP" type="text"><!-- SKU-P --> 26 <input id="SKUP" type="text"><!-- SKU-P -->
27 - <input id="sellerUid" type="text"><!-- 卖家UID --> 27 + <!--<input id="sellerUid" type="text">-->
28 <input id="storageId" type="text"><!-- SKU --> 28 <input id="storageId" type="text"><!-- SKU -->
29 <input id="sizeId" type="text"><!-- 尺码 --> 29 <input id="sizeId" type="text"><!-- 尺码 -->
30 <a id="searchLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">筛选</a> 30 <a id="searchLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">筛选</a>
@@ -45,6 +45,8 @@ @@ -45,6 +45,8 @@
45 // 解析出需要 ID 45 // 解析出需要 ID
46 var productId = parseURL(window.location.href).productId; 46 var productId = parseURL(window.location.href).productId;
47 var midSortId = parseURL(window.location.href).midSortId; 47 var midSortId = parseURL(window.location.href).midSortId;
  48 + var paramSellerUid = parseURL(window.location.href).sellerUid;
  49 + paramSellerUid = paramSellerUid == undefined ? "" : paramSellerUid;
48 50
49 // 状态枚举 51 // 状态枚举
50 var ENUM = { 52 var ENUM = {
@@ -70,7 +72,8 @@ @@ -70,7 +72,8 @@
70 url: contextPath + "/storage/storagePriceListLineShops", 72 url: contextPath + "/storage/storagePriceListLineShops",
71 method: 'POST', 73 method: 'POST',
72 queryParams: { 74 queryParams: {
73 - id: productId 75 + id: productId,
  76 + sellerUid: paramSellerUid
74 }, 77 },
75 loadFilter: function (data) { 78 loadFilter: function (data) {
76 var temp = defaultLoadFilter(data); 79 var temp = defaultLoadFilter(data);
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 <input id="maxSortId" type="text"><!-- 一级分类 --> 26 <input id="maxSortId" type="text"><!-- 一级分类 -->
27 <input id="middleSortId" type="text"><!-- 二级分类 --> 27 <input id="middleSortId" type="text"><!-- 二级分类 -->
28 <input id="brandName" type="text"><!-- 品牌名称 --> 28 <input id="brandName" type="text"><!-- 品牌名称 -->
29 - <input id="sellerUid" type="text"><!-- 卖家UID --> 29 + <!--<input id="sellerUid" type="text">-->
30 <input id="storageNum" type="text"><!-- 商品库存 --> 30 <input id="storageNum" type="text"><!-- 商品库存 -->
31 <input id="storageId" type="text"><!-- SKU --> 31 <input id="storageId" type="text"><!-- SKU -->
32 <input id="skup" type="text"><!-- SKU-P --> 32 <input id="skup" type="text"><!-- SKU-P -->
@@ -43,9 +43,26 @@ @@ -43,9 +43,26 @@
43 43
44 <script type="text/javascript"> 44 <script type="text/javascript">
45 45
  46 + // 解析URL
  47 + function parseURL(url) {
  48 + var url = url.split("?")[1];
  49 + var para = url.split("&");
  50 + var len = para.length;
  51 + var res = {};
  52 + var arr = [];
  53 + for (var i = 0; i < len; i++) {
  54 + arr = para[i].split("=");
  55 + res[arr[0]] = arr[1];
  56 + }
  57 + return res;
  58 + }
46 59
47 (function () { 60 (function () {
48 61
  62 + // 解析出需要 ID
  63 + var paramSellerUid = parseURL(window.location.href).sellerUid;
  64 + paramSellerUid = paramSellerUid == undefined ? "" : paramSellerUid;
  65 +
49 // 加载列表 66 // 加载列表
50 $("#productTable").myDatagrid({ 67 $("#productTable").myDatagrid({
51 fit: true, 68 fit: true,
@@ -53,6 +70,7 @@ @@ -53,6 +70,7 @@
53 nowrap: false, 70 nowrap: false,
54 url: contextPath + "/storage/storageListLineShops", 71 url: contextPath + "/storage/storageListLineShops",
55 method: 'POST', 72 method: 'POST',
  73 + queryParams: {sellerUid: paramSellerUid},
56 loadFilter: function (data) { 74 loadFilter: function (data) {
57 var temp = defaultLoadFilter(data); 75 var temp = defaultLoadFilter(data);
58 temp.rows = temp.list; 76 temp.rows = temp.list;
@@ -243,6 +261,9 @@ @@ -243,6 +261,9 @@
243 onClick: function () { 261 onClick: function () {
244 var action = contextPath + "/storage/storeExportExcel"; 262 var action = contextPath + "/storage/storeExportExcel";
245 var form = $("<form></form>"); 263 var form = $("<form></form>");
  264 + var inputType = $("<input type='text' name='sellerUid'/>");
  265 + inputType.attr("value", paramSellerUid);
  266 + form.append(inputType);
246 form.attr('action', action); 267 form.attr('action', action);
247 form.attr('method', 'post'); 268 form.attr('method', 'post');
248 form.appendTo("body"); 269 form.appendTo("body");
@@ -310,9 +331,12 @@ @@ -310,9 +331,12 @@
310 331
311 // 跳转编辑页 332 // 跳转编辑页
312 function detailStorage(id, midSortId) { 333 function detailStorage(id, midSortId) {
313 - this.location.href = contextPath + "/html/goods/storageLineShops/storageLineShopsDetail.html?productId=" + id + "&midSortId=" + midSortId + "&time_version=" + new Date().getTime(); 334 + this.location.href = contextPath
  335 + + "/html/goods/storageLineShops/storageLineShopsDetail.html?productId=" + id
  336 + + "&midSortId=" + midSortId
  337 + + "&time_version=" + new Date().getTime()
  338 + + "&sellerUid=" + paramSellerUid;
314 } 339 }
315 -  
316 }()) 340 }())
317 341
318 </script> 342 </script>