Browse Source

订单详情返回实时余额

eganwu 1 year ago
parent
commit
7fbabe7044
1 changed files with 15 additions and 4 deletions
  1. 15 4
      src/custom/restcontroller/webmanage/sale/order/Order.java

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

@@ -259,12 +259,12 @@ public class Order extends Controller {
         ArrayList<Long> itemidids = new ArrayList();
         ArrayList<Long> sa_shoppingcartids = new ArrayList();
 
-        OrderItemsHelper orderItemsHelper=new OrderItemsHelper(this);
+        OrderItemsHelper orderItemsHelper = new OrderItemsHelper(this);
         //判断是否是同一个品牌的商品
         for (Object obj : items) {
             JSONObject item = (JSONObject) obj;
-            orderItemsHelper.checkOffOrderItems("plm_item",item.getLongValue("itemid"));
-            orderItemsHelper.checkOffOrderItems("sa_promotion_items",item.getLongValue("itemid"));
+            orderItemsHelper.checkOffOrderItems("plm_item", item.getLongValue("itemid"));
+            orderItemsHelper.checkOffOrderItems("sa_promotion_items", item.getLongValue("itemid"));
 
             Long temp_sa_brandid = item.getLongValue("sa_brandid");
             itemidids.add(item.getLongValue("itemid"));
@@ -599,9 +599,20 @@ public class Order extends Controller {
 
         //查询业务员是否可编辑价格
         Rows saleRows = dbConnect.runSqlQuery("SELECT * from sa_salearea_hr WHERE hrid = " + hrid + " and siteid='" + siteid + "'");
-        row.put("saler", saleRows);
 
 
+        JSONArray jsonArray = row.getJSONArray("sa_accountclassinfos");
+        row.remove("sa_accountclassinfos");
+        for (Object object : jsonArray) {
+            JSONObject jsonObject = (JSONObject) object;
+            Long id = jsonObject.getLong("sa_accountclassid");
+            Rows accountbalanceRows = dbConnect.runSqlQuery("SELECT balance from sa_accountbalance WHERE sa_accountclassid=" + id + " and sys_enterpriseid="+row.getLong("sys_enterpriseid"));
+            if(accountbalanceRows.isNotEmpty()){
+                jsonObject.put("realbalance",accountbalanceRows.get(0).getBigDecimal("balance"));
+            }
+        }
+//        System.err.println(jsonArray);
+        row.put("sa_accountclassinfos",jsonArray);
         return getSucReturnObject().setData(row).toString();
     }