فهرست منبع

促销管理活动商品上下架管控机制修改

hu 2 هفته پیش
والد
کامیت
d6aba581aa

+ 2 - 2
src/custom/restcontroller/webmanage/sale/promotion/SQL/促销方案新增.sql

@@ -1,8 +1,8 @@
 insert into sa_promotion (siteid, sa_promotionid, createuserid, createby, createdate, promnum, changeuserid, changeby,
                           changedate, promname, remarks, type, sa_accountclassid,
                           sa_brandid, tradefield, status, orderminqty, orderaddqty, orderminamount, begdate, enddate,
-                          sa_openpromotionid, openamount, isrelevancepromotion, authmethod,associationaccountclassid,associationamount,rebateratio,packagetype,eachneedadd,eachlimitqty)
+                          sa_openpromotionid, openamount, isrelevancepromotion, authmethod,associationaccountclassid,associationamount,rebateratio,packagetype,eachneedadd,eachlimitqty,issyncitemonsale)
 values ($siteid$, $sa_promotionid$, $userid$, $username$, CURRENT_TIME, $promnum$, $userid$, $username$, CURRENT_TIME,
         $promname$, $remarks$, $type$, $sa_accountclassid$,
         $sa_brandid$, $tradefield$, '新建', $orderminqty$, $orderaddqty$, $orderminamount$, $begdate$, $enddate$,
-        $sa_openpromotionid$, $openamount$, $isrelevancepromotion$, $authmethod$,$associationaccountclassid$,$associationamount$,$rebateratio$,$packagetype$,$eachneedadd$,$eachlimitqty$);
+        $sa_openpromotionid$, $openamount$, $isrelevancepromotion$, $authmethod$,$associationaccountclassid$,$associationamount$,$rebateratio$,$packagetype$,$eachneedadd$,$eachlimitqty$,$issyncitemonsale$);

+ 2 - 1
src/custom/restcontroller/webmanage/sale/promotion/SQL/促销方案更新.sql

@@ -23,6 +23,7 @@ SET changeuserid=$userid$,
     isauth=$isauth$,
     packagetype=$packagetype$,
     eachneedadd=$eachneedadd$,
-    eachlimitqty=$eachlimitqty$
+    eachlimitqty=$eachlimitqty$,
+    issyncitemonsale=$issyncitemonsale$
 WHERE sa_promotionid = $sa_promotionid$
   and siteid = $siteid$

+ 2 - 1
src/custom/restcontroller/webmanage/sale/promotion/SQL/促销方案详情查询.sql

@@ -40,7 +40,8 @@ SELECT t1.promnum,
        t2.brandname,
        t3.accountno,
        t3.accountname,
-       ifnull(t1.authmethod, 0) authmethod
+       ifnull(t1.authmethod, 0) authmethod,
+       t1.issyncitemonsale
 FROM sa_promotion t1
          LEFT JOIN sa_brand t2 ON t1.sa_brandid = t2.sa_brandid
     AND t1.siteid = t2.siteid

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

@@ -61,6 +61,8 @@ public class promotion extends Controller {
         String packagetype = content.getStringValue("packagetype");
         boolean eachneedadd=content.getBooleanValue("eachneedadd");
         Long eachlimitqty = content.getLongValue("eachlimitqty");
+        boolean issyncitemonsale = content.getBooleanValue("issyncitemonsale");
+
         SQLFactory sqlFactory = new SQLFactory(this, "促销方案新增");
 
         if (sa_promotionid <= 0 || dbConnect
@@ -121,6 +123,8 @@ public class promotion extends Controller {
         sqlFactory.addParameter("rebateratio", rebateratio);
         sqlFactory.addParameter("eachneedadd", eachneedadd);
         sqlFactory.addParameter("eachlimitqty", eachlimitqty);
+        sqlFactory.addParameter("issyncitemonsale", issyncitemonsale);
+
 
         // 备注说明
         sqlFactory.addParameter("remarks", remarks);
@@ -316,6 +320,7 @@ public class promotion extends Controller {
         sqlFactory.addParameter("packagetype", row.getString("packagetype"));
         sqlFactory.addParameter("eachneedadd", row.getLong("eachneedadd"));
         sqlFactory.addParameter("eachlimitqty", row.getLong("eachlimitqty"));
+        sqlFactory.addParameter("issyncitemonsale", row.getLong("issyncitemonsale"));
         // 备注说明
         sqlFactory.addParameter("remarks", row.getString("remarks"));
         sqlList.add(sqlFactory.getSQL());

+ 6 - 1
src/custom/restcontroller/webmanage/sale/promotion/promotionItems.java

@@ -221,6 +221,7 @@ public class promotionItems extends Controller {
     @CACHEING_CLEAN(apiClass = {promotionItems.class, promotion.class,restcontroller.sale.promotion.promotion.class})
     public String release() throws YosException {
         ArrayList<String> sqlList = new ArrayList<>();
+
         JSONArray sa_promotion_itemsids = content.getJSONArray("sa_promotion_itemsids");
         boolean isonsale = content.getBooleanValue("isonsale");
         List<Long> list = sa_promotion_itemsids.toJavaList(Long.class);
@@ -232,6 +233,7 @@ public class promotionItems extends Controller {
              sqlFactoryupdate = new SQLFactory(this, "促销方案商品上架");
         }else{
              sqlFactoryupdate = new SQLFactory(this, "促销方案商品下架");
+
         }
         sqlFactoryupdate.addParameter("siteid", siteid);
         sqlFactoryupdate.addParameter_in("sa_promotion_itemsids", stringArray);
@@ -240,13 +242,16 @@ public class promotionItems extends Controller {
 //        for (String id : stringArray) {
 //            sendMsg(Long.parseLong(id));
 //        }
-        String sql = "select t1.itemid,t1.orderminqty,t1.orderaddqty,t1.itemname,t2.sa_promotionid from plm_item t1 inner join sa_promotion_items t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and t2.sa_promotion_itemsid in " + sa_promotion_itemsids;
+        String sql = "select t1.itemid,t1.orderminqty,t1.orderaddqty,t1.itemname,t2.sa_promotionid,t3.issyncitemonsale from plm_item t1 inner join sa_promotion_items t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid inner join sa_promotion t3 on t2.sa_promotionid=t3.sa_promotionid and t2.siteid=t3.siteid  where t1.siteid='" + siteid + "' and t2.sa_promotion_itemsid in " + sa_promotion_itemsids;
         sql = sql.replace("[", "(").replace("]", ")");
         Rows itemrows = dbConnect.runSqlQuery(sql);
         for (Row row :itemrows){
             if(isonsale){
                 sqlList.add(DataContrlLog.createLog(this, "sa_promotion", row.getLong("sa_promotionid"), "促销方案商品【"+row.getString("itemname")+"】由"+username+"上架", "促销方案商品上下架").getSQL());
             }else{
+                if(row.getBoolean("issyncitemonsale")){
+                    sqlList.add("update plm_item set isonsale=0 where itemid="+row.getLong("itemid"));
+                }
                 sqlList.add(DataContrlLog.createLog(this, "sa_promotion", row.getLong("sa_promotionid"), "促销方案商品【"+row.getString("itemname")+"】由"+username+"下架" , "促销方案商品上下架").getSQL());
             }
         }