Browse Source

个人产品库 初步搭建8 -打通个人产品库上传下载失败产品以及展示界面

wangdy 8 years ago
parent
commit
8f72b03873

+ 5 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/constant/UploadConstant.java

@@ -30,6 +30,11 @@ public final class UploadConstant {
      */
     public static final int BREAK_UP = 2;
 
+    /**
+     * 规则数据(个人)
+     */
+    public static final int SPECIFICATION = 2;
+
     /**
      * 库存数量
      */

+ 8 - 4
src/main/java/com/uas/platform/b2c/prod/commodity/controller/ReleaseProductByBatchController.java

@@ -249,7 +249,7 @@ public class ReleaseProductByBatchController {
      * @return model and view
      */
     @RequestMapping(value = "/release/failure/xls", method = RequestMethod.GET)
-    public ModelAndView exportOrderses(String batch, HttpServletRequest request, @RequestParam(defaultValue = "false") Boolean isAjax, String currency) {
+    public ModelAndView exportOrderses(String batch, HttpServletRequest request, @RequestParam(defaultValue = "false") Boolean isAjax, String currency, Integer isPerson) {
         ModelAndView modelAndView = new ModelAndView();
         HttpSession session = request.getSession();
         Object loading = session.getAttribute("load-error-ing");
@@ -270,10 +270,14 @@ public class ReleaseProductByBatchController {
         }
         modelAndView.addObject("data", releaseProductByBatchService.findFailureReleaseProductByBatch(batch));
         String url ="";
-        if (Currency.USD.equals(currency)) {
-            url = "classpath:jxls-tpl/trade/releaseByBatchError-usd";
+        if (null != isPerson && isPerson.intValue() == IntegerConstant.YES_SHORT.intValue()) {
+            url = "classpath:jxls-tpl/trade/releaseByBatchError-person";
         } else {
-            url = "classpath:jxls-tpl/trade/releaseByBatchError-rmb";
+            if (Currency.USD.equals(currency)) {
+                url = "classpath:jxls-tpl/trade/releaseByBatchError-usd";
+            } else {
+                url = "classpath:jxls-tpl/trade/releaseByBatchError-rmb";
+            }
         }
         modelAndView.setView(new JxlsExcelView(url, "导入失败产品-优软商城"));
         logger.log("批量上架模块", "以Excel形式导出批量上架商品匹配不合格的数据");

+ 11 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -116,6 +116,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		boolean isAPerson = false;
 		if (null != isPerson && isPerson.intValue() == IntegerConstant.YES_SHORT.intValue()) {
 			isAPerson = true;
+			selfSale = false;
 		}
 		ModelMap modelMap = new ModelMap();
 		Set<ReleaseProductByBatch> releaseProductByBatchs = new HashSet<>();
@@ -240,6 +241,12 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			if (!"产品型号".equals(StringUtilB2C.getStr(codeCellObj))) {
 				throw new IllegalOperatorException("您上传的信息列信息不正确,请与模板的列做比较");
 			}
+
+			Object specCellObj = readWorkBookCell(headerRow.getCell(UploadConstant.SPECIFICATION), Cell.CELL_TYPE_STRING,
+					0, UploadConstant.SPECIFICATION);
+			if (!"规格".equals(StringUtilB2C.getStr(specCellObj))) {
+				throw new IllegalOperatorException("您上传的信息列信息不正确,请与模板的列做比较");
+			}
 		} else {
 			if (colNum == UploadConstant.MAX_TOTAL_COLUMN) {
 				Cell errorCell = headerRow.getCell(UploadConstant.MAX_TOTAL_COLUMN - 1);
@@ -523,8 +530,11 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			if (aProduct.getCode() != null && aProduct.getBrandNameEn() != null && aProduct.getTag() != null) {
 				resetTag(aProduct);
 			}
+		} else {
+			Object packageMethodValue = readWorkBookCell(row.getCell(UploadConstant.SPECIFICATION), Cell.CELL_TYPE_STRING,
+					rowNum, UploadConstant.SPECIFICATION);
+			aProduct.setPackagingByExcel(packageMethodValue);
 		}
-
 		return result;
 	}
 

BIN
src/main/resources/jxls-tpl/trade/releaseByBatch-person.xls


BIN
src/main/resources/jxls-tpl/trade/releaseByBatchError-person.xls


+ 7 - 2
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_upload_ctrl.js

@@ -338,7 +338,7 @@ define([ 'app/app' ], function(app) {
                     $scope.relTableParams.page(1);
                     $scope.relTableParams.reload();
                     $scope.result.success = 0;//设置成0,让前端用户不能点击
-                    $scope.hadImport = true; //上架后隐藏提示语
+                    /*$scope.hadImport = true; //上架后隐藏提示语*/ // 个人上传不隐藏
                 }, function(res) {
                     toaster.pop("error", "发布失败", res.data);
 			});
@@ -346,6 +346,11 @@ define([ 'app/app' ], function(app) {
 
 		//下载未匹配成功的数据
 		$scope.downloadExcel = function(){
+			if ($rootScope.$$productOn.tab === 'bathOnPerson') {
+                var datatem = {isAjax : true, batch : $scope.result.batch, isPerson : 1};
+			} else {
+                var datatem = {isAjax : true, batch : $scope.result.batch};
+			}
 			if($scope.result && $scope.result.batch && $scope.result.filter) {
 				var form = document.getElementById('load-error');
 				form.action= 'release/product/release/failure/xls';
@@ -356,7 +361,7 @@ define([ 'app/app' ], function(app) {
 					$.ajax({
 						type: 'GET',
 						url: 'release/product/release/failure/xls',
-						data : {isAjax : true, batch : $scope.result.batch},
+						data : datatem,
 						dataType : 'json',
 						success: function (data) {
 							if(!data.load) {

+ 3 - 3
src/main/webapp/resources/view/vendor/forstore/vendor_material_person.html

@@ -1545,7 +1545,7 @@
 						<th width="180">产品名称(类目)</th>
 						<th width="200">产品型号</th>
 						<th width="150">品牌</th>
-						<th width="100">单位</th>
+						<!--<th width="100">单位</th>-->
 						<th width="80">封装</th>
 						<th width="180">操作</th>
 					</tr>
@@ -1583,9 +1583,9 @@
 							<div class="ellipsis-div" ng-if="material.pbranden" ng-bind="material.pbranden" title="{{material.pbranden}}"></div>
 							<div class="ellipsis-div" ng-if="!material.pbranden" ng-bind="material.pbrand" title="{{material.pbrand}}"></div>
 						</td>
-						<td ng-bind="material.unit || 'PCS'" title="{{material.unit  || 'PCS'}}"></td>
+						<!--<td ng-bind="material.unit || 'PCS'" title="{{material.unit  || 'PCS'}}"></td>-->
 						<td>
-							<span ng-bind="material.encapsulation || '-'" title="{{material.encapsulation || '-'}}"></span>
+							<span ng-bind="material.packaging || '-'" title="{{material.packaging || '-'}}"></span>
 						</td>
 						<td class="edit">
 							<span name="delete-material" ng-show="!isBatch && !material.exPandOper && !material.addGoodsOper" ng-click="deleteMaterial(material)"><span>删除</span></span>

+ 1 - 0
src/main/webapp/resources/view/vendor/forstore/vendor_upload.html

@@ -498,6 +498,7 @@
                             <!--<a href="javascript:void(0)" style="width: 206px;" ng-disabled="!result.failure" ng-click="downloadExcel()" class="blue-bg">下载匹配不成功产品信息</a>-->
                 <form id="load-error" style="display: none;" method="get">
                     <input type="hidden" name="batch" ng-value="result.batch">
+                    <input type="hidden" name="isPerson" ng-value="1" ng-if="$$productOn.tab === 'bathOnPerson'">
                     <input type="hidden" name="currency" ng-value="batch.currency">
                 </form>
                         <!--</div>-->