Browse Source

个人 物料bug修复8

wangdy 8 years ago
parent
commit
e0fe8691b5

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

@@ -232,16 +232,16 @@ public class ProductController {
 	 * 批量删除所有的非标的产品
 	 */
 	@RequestMapping(value = "/unstandard", method = RequestMethod.DELETE)
-	private ResultMap deleteUnstandardByBatch() {
-		 return productService.deleteBatch(ProductConstant.NSTANDARD);
+	private ResultMap deleteUnstandardByBatch(Integer isPerson) {
+		 return productService.deleteBatch(ProductConstant.NSTANDARD, isPerson);
 	}
 
 	/**
 	 * 批量删除所有的标准的产品
 	 */
 	@RequestMapping(value = "/standard", method = RequestMethod.DELETE)
-	private ResultMap deleteStandardByBatch() {
-		return productService.deleteBatch(ProductConstant.STANDARD);
+	private ResultMap deleteStandardByBatch(Integer isPerson) {
+		return productService.deleteBatch(ProductConstant.STANDARD, isPerson);
 	}
 
 	/**

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/ProductService.java

@@ -57,7 +57,7 @@ public interface ProductService {
      *
      * @param type 批量删除的类型
      */
-    ResultMap deleteBatch(String type);
+    ResultMap deleteBatch(String type, Integer isPerson);
 
     /**
      * 单个匹配

+ 13 - 2
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java

@@ -433,7 +433,7 @@ public class ProductServiceImpl implements ProductService {
      * @param type 批量删除的类型
      */
     @Override
-    public ResultMap deleteBatch(String type) {
+    public ResultMap deleteBatch(String type, Integer isPerson) {
         Integer standard = null;
         List<ProductPerson> personList = new ArrayList<>();
         Integer fail = 0;
@@ -447,6 +447,14 @@ public class ProductServiceImpl implements ProductService {
         List<Product> products = productDao.findProductByEnuuAndStandard(uu, standard);
         Set<String> uuids = new HashSet<>();
         for (Product product : products) {
+            if (null != isPerson && isPerson.intValue() == IntegerConstant.YES_SHORT.intValue()) {
+                List<ProductPerson> productPersonList = productPersonDao.findByProductIdAndUserUU(product.getId(),SystemSession.getUser().getUserUU());
+                if (!CollectionUtils.isEmpty(productPersonList)) {
+                    Long ppid = productPersonList.get(0).getId();
+                    productPersonDao.delete(ppid);
+                }
+                continue;
+            }
             try {
                 personList = productPersonDao.findByProductId(product.getId());
                 if (CollectionUtils.isNotEmpty(personList)) {
@@ -480,7 +488,10 @@ public class ProductServiceImpl implements ProductService {
                     Set<ProductMatchResult> productMatchResultSet =  product.getMatchresults();
                     productMatchResultDao.delete(productMatchResultSet);
                     goodsService.deleteGoods(goodses);
-                    productDao.delete(product.getId());
+                    //productDao.delete(product.getId());
+                    ProductPrivate productPrivate = productPrivateDao.findByPrId(product.getId());
+                    productPrivate.setB2cEnabled(IntegerConstant.NO_SHORT);
+                    productPrivateDao.save(productPrivate);
                     if (!StringUtils.isEmpty(product.getCmpUuId())) {
                         uuids.add(product.getCmpUuId());
                     }

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


+ 4 - 4
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialPersonCtrl.js

@@ -400,7 +400,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 			var modalInstance = $modal.open({
 				animation: true,
 				templateUrl: 'static/view/common/modal/delete_modal.html',
-				controller: 'vendor_delete_ctrl',
+				controller: 'vendor_delete_person_ctrl',
 				resolve: {
 					ids: function() {
 						return $scope.choosedIds;
@@ -2561,7 +2561,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 
 
 	//批量删除信息
-	app.register.controller('vendor_delete_ctrl', ['$scope', 'ids', 'Goods', 'Material', 'toaster', 'deleteMaterial', 'deleteGoods', 'selectAll', 'ProductServiceQuery', 'standard_tab', '$modalInstance', 'message', function ($scope, ids, Goods, Material, toaster, deleteMaterial, deleteGoods, selectAll, ProductServiceQuery, standard_tab, $modalInstance, message) {
+	app.register.controller('vendor_delete_person_ctrl', ['$scope', 'ids', 'Goods', 'Material', 'toaster', 'deleteMaterial', 'deleteGoods', 'selectAll', 'ProductServiceQuery', 'standard_tab', '$modalInstance', 'message', function ($scope, ids, Goods, Material, toaster, deleteMaterial, deleteGoods, selectAll, ProductServiceQuery, standard_tab, $modalInstance, message) {
 		$scope.deleteModal = true;
         $scope.message = message;
 
@@ -2572,7 +2572,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
             if(deleteMaterial) {
                 if(selectAll) {
                     if(standard_tab == 'standard') {
-                        Material.deleteStandardAll(null, null, function (data) {
+                        Material.deleteStandardAll({isPerson: 1}, function (data) {
                             if(data.code != 1) {
                                 toaster.pop('error','错误' ,data.message);
                             }else {
@@ -2584,7 +2584,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
                             toaster.pop('error', '错误', response.data);
                         });
                     }else {
-                        Material.deleteUnstandardAll(null, null, function (data) {
+                        Material.deleteUnstandardAll({isPerson: 1}, function (data) {
                             if(data.code != 1) {
                                 toaster.pop('error', '错误', data.message);
                             }else {