Browse Source

调整未上架的在售产品为已上架的在售产品

yuj 7 years ago
parent
commit
2bf7c1a506

+ 11 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/V_ProductPrivateDao.java

@@ -83,4 +83,15 @@ public interface V_ProductPrivateDao extends JpaRepository<V_ProductPrivate, Lon
      */
     @Query(value = "select p.id from V_ProductPrivate p where p.standard = :standard and p.enUU = :enUU and coalesce(p.b2cEnabled, 1) = 1 and coalesce(p.pcmpcode, '') <> '' and coalesce(p.pbranden, '') <> '' ")
     List<Long> findPridsByEnUUAndStandard(@Param("standard") Integer standard, @Param("enUU") Long enUU);
+
+
+
+    /**
+     * 根据enuu查询所有的prids
+     *
+     * @param enUU     企业的enuu
+     * @return list
+     */
+    @Query(value = "select p.id from V_ProductPrivate p where p.enUU = :enUU and coalesce(p.b2cEnabled, 1) = 1 and coalesce(p.pcmpcode, '') <> '' and coalesce(p.pbranden, '') <> '' ")
+    List<Long> findPridsByEnUU(@Param("enUU") Long enUU);
 }

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

@@ -2221,7 +2221,7 @@ public class GoodsServiceImpl implements GoodsService {
             return null;
         }
         // pageInfo.expression(PredicateUtils.or(new SimpleExpression[]{PredicateUtils.eq("status", 601, true), PredicateUtils.eq("status", 602, true)}));
-        pageInfo.expression(PredicateUtils.eq("status", 601, true));
+        pageInfo.expression(PredicateUtils.in("status", new Integer[]{601, 602, 613}, true));
         pageInfo.sorting(Sort.Direction.DESC, "updateDate");
         pageInfo.expression(PredicateUtils.eq("storeid", storeid, false));
         if (StringUtils.hasText(kindUuid)) {
@@ -2466,7 +2466,7 @@ public class GoodsServiceImpl implements GoodsService {
         if (goods == null) {
             return new ResultMap(CodeType.NOT_EXiST.code(), "对应的批次号" + batchCode + "不存在,请刷新界面再操作");
         }
-        if (Status.AVAILABLE.value() != goods.getStatus() && Status.UNAVAILABLE.value() != goods.getStatus()) {
+        if (Status.AVAILABLE.value() != goods.getStatus() && Status.UNAVAILABLE.value() != goods.getStatus() && Status.NO_SHELVE.value() != goods.getStatus()) {
             return new ResultMap(CodeType.NOT_EXiST.code(), "对应的批次号" + batchCode + "未上架,不要下架");
         }
 //        if (!goods.getEnUU().equals(enUU)) {
@@ -3757,6 +3757,7 @@ public class GoodsServiceImpl implements GoodsService {
                 if (Status.AVAILABLE.value() == goodsFilter.getSaleStatus()) {
                     statusSet.add(Status.AVAILABLE.value());
                     statusSet.add(Status.UNAVAILABLE.value());
+                    statusSet.add(Status.NO_SHELVE.value());
                 } else {
                     statusSet.add(goodsFilter.getSaleStatus());
                 }

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

@@ -112,6 +112,7 @@ import org.apache.commons.beanutils.ConvertUtils;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.map.HashedMap;
 import org.apache.log4j.Logger;
+import org.bson.types.Code;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -481,7 +482,7 @@ public class ProductServiceImpl implements ProductService {
         //查找物料信息
         User user = SystemSession.getUser();
         if (IntegerConstant.YES_SHORT.equals(isAll)) {
-            prIds = productDao.findPridsByEnuuAndStardand(user.getEnterprise().getUu(), isStardand);
+            prIds = v_productPrivateDao.findPridsByEnUU(user.getEnterprise().getUu());
         }
 
         //筛选已经存在个人物料库的信息
@@ -703,13 +704,21 @@ public class ProductServiceImpl implements ProductService {
             ResultMap resultMap = deletePersonalProductByBatch(type);
             return resultMap;
         }
-        Integer standard = ProductConstant.STANDARD.equals(type) ? IntegerConstant.YES_SHORT : IntegerConstant.NO_SHORT;
+        Long uu = SystemSession.getUser().getEnterprise().getUu();
+        List<Long> products = null;
+        if (ProductConstant.ALL.equals(type)) {
+            products = v_productPrivateDao.findPridsByEnUU(uu);
+        } else {
+            Integer standard =  ProductConstant.STANDARD.equals(type)? IntegerConstant.YES_SHORT : IntegerConstant.NO_SHORT;
+            products = v_productPrivateDao.findPridsByEnUUAndStandard(standard, uu);
+        }
+        if (CollectionUtils.isEmpty(products)) {
+            return new ResultMap(CodeType.OK, "沒有需要刪除的数据");
+        }
         List<ProductPerson> personList;
         Integer fail = 0;
         Integer success = 0;
         Integer isHave = 0;
-        Long uu = SystemSession.getUser().getEnterprise().getUu();
-        List<Long> products = v_productPrivateDao.findPridsByEnUUAndStandard(standard, uu);
         for (Long prid : products) {
             try {
                 personList = productPersonDao.findByProductId(prid);