Sfoglia il codice sorgente

增加购物车转订单逻辑判断,检测定制商品的长和宽

eganwu 1 anno fa
parent
commit
c8699e4c8a
1 ha cambiato i file con 24 aggiunte e 14 eliminazioni
  1. 24 14
      src/custom/restcontroller/webmanage/sale/order/Order.java

+ 24 - 14
src/custom/restcontroller/webmanage/sale/order/Order.java

@@ -254,7 +254,6 @@ public class Order extends Controller {
         dbConnect.runSqlUpdate(sqlList);
 
 
-
         content.put("sa_orderid", sa_orderid);
         return selectDetail();
     }
@@ -276,14 +275,15 @@ public class Order extends Controller {
         //判断是否是同一个品牌的商品
         for (Object obj : items) {
             JSONObject item = (JSONObject) obj;
+            long itemid = item.getLongValue("itemid");
             if (type.equals("促销订单")) {
-                orderItemsHelper.checkOffOrderItems("sa_promotion_items", item.getLongValue("itemid"), sa_promotionid);
+                orderItemsHelper.checkOffOrderItems("sa_promotion_items", itemid, sa_promotionid);
             } else {
-                orderItemsHelper.checkOffOrderItems("plm_item", item.getLongValue("itemid"), sa_promotionid);
+                orderItemsHelper.checkOffOrderItems("plm_item", itemid, sa_promotionid);
             }
 
             Long temp_sa_brandid = item.getLongValue("sa_brandid");
-            itemidids.add(item.getLongValue("itemid"));
+            itemidids.add(itemid);
             sa_shoppingcartids.add(item.getLongValue("sa_shoppingcartid"));
 
             if (sa_brandid == 0) {
@@ -294,6 +294,16 @@ public class Order extends Controller {
                     return getErrReturnObject().setErrMsg("请添加同一品牌的商品").toString();
                 }
             }
+            Row itemRow = dbConnect.runSqlQuery(0, "SELECT * from plm_item WHERE itemid=" + itemid);
+            if (itemRow.getString("iscustomsize").equals("1")) {
+                Long length = item.getLongValue("length", 0L);
+                Long width = item.getLongValue("width", 0L);
+                if (length == 0 || width == 0) {
+                    return getErrReturnObject().setErrMsg("检测到长宽尺寸存在0,无法下单").toString();
+                }
+            }
+
+
         }
 
         //判断领域
@@ -2207,10 +2217,10 @@ public class Order extends Controller {
             dbConnect.runSqlUpdate(updateAccountclassinfos(sa_orderid, sa_accountclassid, sys_enterpriseid));
             rows = getOrderRows(this, sa_orderid);
             row = rows.get(0);
-        }else{
-            if(isJSONArray(row.getString("sa_accountclassinfos"))){
+        } else {
+            if (isJSONArray(row.getString("sa_accountclassinfos"))) {
                 JSONArray jsonArrayResult = JSONArray.parseArray(row.getString("sa_accountclassinfos"));
-                if(jsonArrayResult.isEmpty()){
+                if (jsonArrayResult.isEmpty()) {
                     dbConnect.runSqlUpdate(updateAccountclassinfos(sa_orderid, sa_accountclassid, sys_enterpriseid));
                     rows = getOrderRows(this, sa_orderid);
                     row = rows.get(0);
@@ -2322,10 +2332,10 @@ public class Order extends Controller {
             dbConnect.runSqlUpdate(updateAccountclassinfos(sa_orderid, sa_accountclassid, sys_enterpriseid));
             rows = getOrderRows(this, sa_orderid);
             row = rows.get(0);
-        }else{
-            if(isJSONArray(row.getString("sa_accountclassinfos"))){
+        } else {
+            if (isJSONArray(row.getString("sa_accountclassinfos"))) {
                 JSONArray jsonArrayResult = JSONArray.parseArray(row.getString("sa_accountclassinfos"));
-                if(jsonArrayResult.isEmpty()){
+                if (jsonArrayResult.isEmpty()) {
                     dbConnect.runSqlUpdate(updateAccountclassinfos(sa_orderid, sa_accountclassid, sys_enterpriseid));
                     rows = getOrderRows(this, sa_orderid);
                     row = rows.get(0);
@@ -3077,7 +3087,7 @@ public class Order extends Controller {
         }
 
         //查询商品费用方案方法
-       new OrderItemsHelper(this).executeDataFunction(sa_orderid_copy);
+        new OrderItemsHelper(this).executeDataFunction(sa_orderid_copy);
         //生成摘要
         sqlFactory = new SQLFactory(this, "查询定制费用统计");
         sqlFactory.addParameter("sa_orderid", sa_orderid_copy);
@@ -3452,10 +3462,10 @@ public class Order extends Controller {
         if (StringUtils.isBlank(orderRow.get(0).getString("sa_accountclassinfos"))) {
             dbConnect.runSqlUpdate(updateAccountclassinfos(sa_orderid, sa_accountclassid, sys_enterpriseid));
             orderRow = getOrderRows(this, sa_orderid);
-        }else{
-            if(isJSONArray(orderRow.get(0).getString("sa_accountclassinfos"))){
+        } else {
+            if (isJSONArray(orderRow.get(0).getString("sa_accountclassinfos"))) {
                 JSONArray jsonArrayResult = JSONArray.parseArray(orderRow.get(0).getString("sa_accountclassinfos"));
-                if(jsonArrayResult.isEmpty()){
+                if (jsonArrayResult.isEmpty()) {
                     dbConnect.runSqlUpdate(updateAccountclassinfos(sa_orderid, sa_accountclassid, sys_enterpriseid));
                     orderRow = getOrderRows(this, sa_orderid);
                 }