Przeglądaj źródła

价格调整,去掉下单时需要合同的限制

eganwu 3 lat temu
rodzic
commit
ae5277d6c1

+ 57 - 57
src/custom/beans/itemprice/ItemPrice.java

@@ -117,36 +117,36 @@ public class ItemPrice extends BaseClass {
             /*
              * 第一步:查询框架合同并试图获取价格:优先级 商品价格、商品折扣==》类别折扣==》合同折扣
              */
-            {
-
-                SQLFactory contractQuery = new SQLFactory(this, "商户框架合同查询");
-                contractQuery.addParameter("siteid", controller.siteid);
-                contractQuery.addParameter("sys_enterpriseid", sys_enterpriseid);
-                Rows contractRows = dbConnect.runSqlQuery(contractQuery.getSQL());
-
-                if (contractRows.size() > 1) {
-                    throw new YosException("存在一个以上的价格协议信息:" + itemid);
-                } else if (contractRows.size() == 1) {
-                    long sa_contractid = contractRows.get(0).getLong("sa_contractid");//合同id
-                    /*
-                     * 第二步:尝试从合同商品价格协议中获取价格
-                     */
-                    stepTwo(sa_contractid);
-                    /*
-                     *第三步:如果商品价格还是小于0,则尝试从合同类别折扣协议中去获取价格
-                     */
-                    stepThree(sa_contractid, getGraderateprice());
-                    /*
-                     * 第四步:如果商品价格还是小于0,则从合同折扣协议中去获取价格
-                     */
-                    BigDecimal discountrate = contractRows.get(0).getBigDecimal("discountrate");//折扣率
-                    if (contractprice.compareTo(BigDecimal.ZERO) <= 0 && discountrate.compareTo(BigDecimal.ZERO) > 0) {
-                        contractprice = getScalePrice(getGraderateprice().multiply(discountrate));
-
-
-                    }
-                }
-            }
+//            {
+//
+//                SQLFactory contractQuery = new SQLFactory(this, "商户框架合同查询");
+//                contractQuery.addParameter("siteid", controller.siteid);
+//                contractQuery.addParameter("sys_enterpriseid", sys_enterpriseid);
+//                Rows contractRows = dbConnect.runSqlQuery(contractQuery.getSQL());
+//
+//                if (contractRows.size() > 1) {
+//                    throw new YosException("存在一个以上的价格协议信息:" + itemid);
+//                } else if (contractRows.size() == 1) {
+//                    long sa_contractid = contractRows.get(0).getLong("sa_contractid");//合同id
+//                    /*
+//                     * 第二步:尝试从合同商品价格协议中获取价格
+//                     */
+//                    stepTwo(sa_contractid);
+//                    /*
+//                     *第三步:如果商品价格还是小于0,则尝试从合同类别折扣协议中去获取价格
+//                     */
+//                    stepThree(sa_contractid, getGraderateprice());
+//                    /*
+//                     * 第四步:如果商品价格还是小于0,则从合同折扣协议中去获取价格
+//                     */
+//                    BigDecimal discountrate = contractRows.get(0).getBigDecimal("discountrate");//折扣率
+//                    if (contractprice.compareTo(BigDecimal.ZERO) <= 0 && discountrate.compareTo(BigDecimal.ZERO) > 0) {
+//                        contractprice = getScalePrice(getGraderateprice().multiply(discountrate));
+//
+//
+//                    }
+//                }
+//            }
             /*
              * 如果框架合同中没有获取到有效的价格,则返回商户等级价格信息
              */
@@ -178,42 +178,42 @@ public class ItemPrice extends BaseClass {
             /*
              * 第一步:查询框架合同并试图获取价格:优先级 商品价格、商品折扣==》类别折扣==》合同折扣
              */
-            {
-                /*
-                 * 第二步:尝试从合同商品价格协议中获取价格
-                 */
-                stepTwo_Contract(sa_contractid);
-                /*
-                 *第三步:如果商品价格还是小于0,则尝试从合同类别折扣协议中去获取价格
-                 */
-                stepThree(sa_contractid, getMarketprice());
-                /*
-                 * 第四步:如果商品价格还是小于0,则从合同折扣协议中去获取价格
-                 */
-                Rows rows = dbConnect.runSqlQuery("SELECT discountrate from sa_contract WHERE sa_contractid=" + sa_contractid + " and siteid = '" + controller.siteid + "'");
-                BigDecimal discountrate = BigDecimal.valueOf(1);//折扣率
-                if (rows.isNotEmpty()) {
-                    discountrate = rows.get(0).getBigDecimal("discountrate");//折扣率
-                }
-
-                if (contractprice.compareTo(BigDecimal.ZERO) <= 0 && discountrate.compareTo(BigDecimal.ZERO) > 0) {
-                    contractprice = getScalePrice(getMarketprice().multiply(discountrate));
-                }
-
-            }
+//            {
+//                /*
+//                 * 第二步:尝试从合同商品价格协议中获取价格
+//                 */
+//                stepTwo_Contract(sa_contractid);
+//                /*
+//                 *第三步:如果商品价格还是小于0,则尝试从合同类别折扣协议中去获取价格
+//                 */
+//                stepThree(sa_contractid, getMarketprice());
+//                /*
+//                 * 第四步:如果商品价格还是小于0,则从合同折扣协议中去获取价格
+//                 */
+//                Rows rows = dbConnect.runSqlQuery("SELECT discountrate from sa_contract WHERE sa_contractid=" + sa_contractid + " and siteid = '" + controller.siteid + "'");
+//                BigDecimal discountrate = BigDecimal.valueOf(1);//折扣率
+//                if (rows.isNotEmpty()) {
+//                    discountrate = rows.get(0).getBigDecimal("discountrate");//折扣率
+//                }
+//
+//                if (contractprice.compareTo(BigDecimal.ZERO) <= 0 && discountrate.compareTo(BigDecimal.ZERO) > 0) {
+//                    contractprice = getScalePrice(getMarketprice().multiply(discountrate));
+//                }
+//
+//            }
             /*
              * 如果框架合同中没有获取到有效的价格,则返回商户等级价格信息
              */
             if (contractprice.compareTo(BigDecimal.ZERO) <= 0) {
-//                contractprice = getGraderateprice();
-                contractprice = getMarketprice();
+                contractprice = getGraderateprice();
+//                contractprice = getMarketprice();
             }
             /*
              * 如果没有获取到有效的价格,则返回原价格信息
              */
             if (contractprice.compareTo(BigDecimal.ZERO) <= 0) {
-//                contractprice = getPrice();
-                contractprice = getMarketprice();
+                contractprice = getPrice();
+//                contractprice = getMarketprice();
             }
         }
 

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

@@ -62,18 +62,18 @@ public class Order extends Controller {
         Long sa_projectid = content.getLongValue("sa_projectid");
         String type = content.getString("type");
         //类型为标准订单时查询默认框架合同信息
-        if (type.equals("标准订单") || type.equals("特殊订单")) {
-            if (sa_orderid <= 0) {
-                String sql = "SELECT * from sa_contract WHERE status = '审核' and siteid = '" + siteid + "' and type = '框架' AND sys_enterpriseid = " + sys_enterpriseid + " and CURRENT_TIME >= begdate and CURRENT_TIME <= enddate";
-                Rows contractRows = dbConnect.runSqlQuery(sql);
-                if (contractRows.isNotEmpty()) {
-                    sa_contractid = contractRows.get(0).getLong("sa_contractid");
-                    sa_projectid = contractRows.get(0).getLong("sa_projectid");
-                } else {
-                    return getErrReturnObject().setErrMsg("当前经销商下没有有效期内审核通过的经销商合作协议").toString();
-                }
-            }
-        }
+//        if (type.equals("标准订单") || type.equals("特殊订单")) {
+//            if (sa_orderid <= 0) {
+//                String sql = "SELECT * from sa_contract WHERE status = '审核' and siteid = '" + siteid + "' and type = '框架' AND sys_enterpriseid = " + sys_enterpriseid + " and CURRENT_TIME >= begdate and CURRENT_TIME <= enddate";
+//                Rows contractRows = dbConnect.runSqlQuery(sql);
+//                if (contractRows.isNotEmpty()) {
+//                    sa_contractid = contractRows.get(0).getLong("sa_contractid");
+//                    sa_projectid = contractRows.get(0).getLong("sa_projectid");
+//                } else {
+//                    return getErrReturnObject().setErrMsg("当前经销商下没有有效期内审核通过的经销商合作协议").toString();
+//                }
+//            }
+//        }
 
         boolean isAdd;
         SQLFactory sqlFactory = new SQLFactory(this, "订单_新增");
@@ -207,17 +207,17 @@ public class Order extends Controller {
         JSONArray items = content.getJSONArray("items");
         ArrayList<Long> itemidids = new ArrayList();
         //判断是否是同一个品牌的商品
-        for (Object obj : items) {
-            JSONObject item = (JSONObject) obj;
-            Long temp_sa_brandid = item.getLongValue("sa_brandid");
-            itemidids.add(item.getLongValue("itemid"));
-            if (sa_brandid == 0) {
-                sa_brandid = temp_sa_brandid;
-            }
-            if (!sa_brandid.equals(temp_sa_brandid)) {
-                return getErrReturnObject().setErrMsg("请添加同一品牌的商品").toString();
-            }
-        }
+//        for (Object obj : items) {
+//            JSONObject item = (JSONObject) obj;
+//            Long temp_sa_brandid = item.getLongValue("sa_brandid");
+//            itemidids.add(item.getLongValue("itemid"));
+//            if (sa_brandid == 0) {
+//                sa_brandid = temp_sa_brandid;
+//            }
+//            if (!sa_brandid.equals(temp_sa_brandid)) {
+//                return getErrReturnObject().setErrMsg("请添加同一品牌的商品").toString();
+//            }
+//        }
 
         //判断领域
         String sql = "SELECT count(0) count from plm_item_tradefield WHERE tradefield='" + tradefield + "' and itemid in " + itemidids;
@@ -233,16 +233,16 @@ public class Order extends Controller {
         //类型为标准订单时查询默认框架合同信息
         Long sa_contractid = 0L;
         Long sa_projectid = 0L;
-        if (istool == 0) {
-            sql = "SELECT sa_contractid,sa_projectid from sa_contract WHERE status = '审核' and siteid = '" + siteid + "' and type = '框架' AND sys_enterpriseid = " + sys_enterpriseid + " and CURRENT_TIME >= begdate and CURRENT_TIME <= enddate";
-            Rows contractRows = dbConnect.runSqlQuery(sql);
-            if (contractRows.isNotEmpty()) {
-                sa_contractid = contractRows.get(0).getLong("sa_contractid");
-                sa_projectid = contractRows.get(0).getLong("sa_projectid");
-            } else {
-                return getErrReturnObject().setErrMsg("未找到有效的经销商合作协议信息").toString();
-            }
-        }
+//        if (istool == 0) {
+//            sql = "SELECT sa_contractid,sa_projectid from sa_contract WHERE status = '审核' and siteid = '" + siteid + "' and type = '框架' AND sys_enterpriseid = " + sys_enterpriseid + " and CURRENT_TIME >= begdate and CURRENT_TIME <= enddate";
+//            Rows contractRows = dbConnect.runSqlQuery(sql);
+//            if (contractRows.isNotEmpty()) {
+//                sa_contractid = contractRows.get(0).getLong("sa_contractid");
+//                sa_projectid = contractRows.get(0).getLong("sa_projectid");
+//            } else {
+//                return getErrReturnObject().setErrMsg("未找到有效的经销商合作协议信息").toString();
+//            }
+//        }
 
         Long sa_orderid = createTableID(tableName);
         SQLFactory sqlFactory = new SQLFactory(this, "订单_新增");