Forráskód Böngészése

促销商品上下架功能更新

hu 2 éve
szülő
commit
4c9b08a4ce

+ 4 - 0
src/custom/restcontroller/R.java

@@ -4812,6 +4812,10 @@ public class R {
         public static class v1 {
         }
     }
+    public static class ID20230927135803 {
+        public static class v1 {
+        }
+    }
 
 }
 

+ 1 - 1
src/custom/restcontroller/sale/promotion/SQL/促销方案商品查询.sql

@@ -25,4 +25,4 @@ FROM
 	left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid
 	left join plm_unit t3 on t2.unitid=t3.unitid and t2.siteid=t3.siteid
 	 LEFT JOIN sa_promotion_itemprice t5 ON t5.sa_promotion_itemsid = t1.sa_promotion_itemsid and t5.siteid = t1.siteid and  t1.sa_promotionid=t5.sa_promotionid
-	where  t1.siteid=$siteid$ and t1.sa_promotionid=$sa_promotionid$  and $where$  and t5.pricegrade = (SELECT grade FROM sys_enterprise WHERE sys_enterpriseid = $sys_enterpriseid$ and siteid = $siteid$ )
+	where  t1.siteid=$siteid$ and t1.sa_promotionid=$sa_promotionid$ and t1.isonsale=1 and $where$  and t5.pricegrade = (SELECT grade FROM sys_enterprise WHERE sys_enterpriseid = $sys_enterpriseid$ and siteid = $siteid$ )

+ 1 - 0
src/custom/restcontroller/webmanage/sale/promotion/SQL/促销方案商品上架.sql

@@ -0,0 +1 @@
+update sa_promotion_items set isonsale=1 where sa_promotion_itemsid in $sa_promotion_itemsids$ and siteid=$siteid$

+ 1 - 0
src/custom/restcontroller/webmanage/sale/promotion/SQL/促销方案商品下架.sql

@@ -0,0 +1 @@
+update sa_promotion_items set isonsale=0 where sa_promotion_itemsid in $sa_promotion_itemsids$ and siteid=$siteid$

+ 31 - 0
src/custom/restcontroller/webmanage/sale/promotion/promotionItems.java

@@ -20,6 +20,7 @@ import restcontroller.R;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 
 public class promotionItems extends Controller {
 
@@ -195,6 +196,36 @@ public class promotionItems extends Controller {
         return queryPromotionItemsList();
     }
 
+    /**
+     * 促销方案商品上下架
+     *
+     * @return
+     */
+    @API(title = "促销方案商品上下架", apiversion = R.ID20230927135803.v1.class)
+    @CACHEING_CLEAN(apiClass = {promotionItems.class, promotion.class,restcontroller.sale.promotion.promotion.class})
+    public String release() throws YosException {
+        JSONArray sa_promotion_itemsids = content.getJSONArray("sa_promotion_itemsids");
+        boolean isonsale = content.getBooleanValue("isonsale");
+        List<Long> list = sa_promotion_itemsids.toJavaList(Long.class);
+        list.add(0l);
+        Long[] stringArray = list.toArray(new Long[0]);
+
+        SQLFactory sqlFactoryupdate = new SQLFactory(this, "商品组上架");
+        if(isonsale){
+            sqlFactoryupdate = new SQLFactory(this, "促销方案商品上架");
+        }else{
+            sqlFactoryupdate = new SQLFactory(this, "促销方案商品下架");
+        }
+        sqlFactoryupdate.addParameter("siteid", siteid);
+        sqlFactoryupdate.addParameter_in("sa_promotion_itemsids", stringArray);
+        dbConnect.runSqlUpdate(sqlFactoryupdate);
+//        //发送消息
+//        for (String id : stringArray) {
+//            sendMsg(Long.parseLong(id));
+//        }
+        return getSucReturnObject().toString();
+    }
+
     @API(title = "促销方案商品列表", apiversion = R.ID20230102142503.v1.class)
     @CACHEING
     public String queryPromotionItemsList() throws YosException {