shenjingwei hace 1 semana
padre
commit
0ee5c09bac

+ 22 - 30
src/custom/beans/accountbalance/Accountbalance.java

@@ -8,9 +8,9 @@ import common.Controller;
 import common.UserInfo;
 import common.UserInfo;
 import common.YosException;
 import common.YosException;
 import common.data.Rows;
 import common.data.Rows;
-import common.data.db.SQLList;
 import common.data.SQLFactory;
 import common.data.SQLFactory;
 import common.data.db.DBConnect;
 import common.data.db.DBConnect;
+import common.data.db.SQLList;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import restcontroller.webmanage.executorService.Executor;
 import restcontroller.webmanage.executorService.Executor;
 
 
@@ -115,7 +115,7 @@ public class Accountbalance extends BaseClass {
      * @return
      * @return
      * @throws YosException
      * @throws YosException
      */
      */
-    public static JSONObject createCashbillIncome(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck, boolean isupdatek3flag) throws YosException {
+    public static SQLList createCashbillIncome(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck, boolean isupdatek3flag) throws YosException {
         SQLList sqlList = new SQLList();
         SQLList sqlList = new SQLList();
         long sa_cashbillid = controller.createTableID("sa_cashbill");
         long sa_cashbillid = controller.createTableID("sa_cashbill");
         String billcode = controller.createBillCode("cashbill");
         String billcode = controller.createBillCode("cashbill");
@@ -169,7 +169,7 @@ public class Accountbalance extends BaseClass {
             } else {
             } else {
                 BigDecimal newbalance = cashbillEntity.getAmount().add(rowsaccountbalance.get(0).getBigDecimal("balance"));
                 BigDecimal newbalance = cashbillEntity.getAmount().add(rowsaccountbalance.get(0).getBigDecimal("balance"));
                 BigDecimal newdiscountamount = cashbillEntity.getDiscountamountamount().add(rowsaccountbalance.get(0).getBigDecimal("discountamount"));
                 BigDecimal newdiscountamount = cashbillEntity.getDiscountamountamount().add(rowsaccountbalance.get(0).getBigDecimal("discountamount"));
-                sqlList.add("update sa_accountbalance set balance=balance+'" +  cashbillEntity.getAmount() + "',discountamount=discountamount+'" +  cashbillEntity.getDiscountamountamount() + "',changedate=CURRENT_TIME,changeby ='" + controller.username + "',changeuserid='" + controller.userid + "' where sys_enterpriseid ='" + sys_enterpriseid + "' and  sa_accountclassid='" + sa_accountclassid + "' and siteid='" + controller.siteid + "'");
+                sqlList.add("update sa_accountbalance set balance=balance+'" + cashbillEntity.getAmount() + "',discountamount=discountamount+'" + cashbillEntity.getDiscountamountamount() + "',changedate=CURRENT_TIME,changeby ='" + controller.username + "',changeuserid='" + controller.userid + "' where sys_enterpriseid ='" + sys_enterpriseid + "' and  sa_accountclassid='" + sa_accountclassid + "' and siteid='" + controller.siteid + "'");
                 balance = newbalance;
                 balance = newbalance;
             }
             }
             sqlFactory.addParameter("balance", balance);
             sqlFactory.addParameter("balance", balance);
@@ -188,13 +188,11 @@ public class Accountbalance extends BaseClass {
         }
         }
         sqlList.add(sqlFactory.getSQL());
         sqlList.add(sqlFactory.getSQL());
 
 
-        JSONObject jsonObject = new JSONObject();
-        jsonObject.put("sa_cashbillid", sa_cashbillid);
-        jsonObject.put("sqlList", sqlList);
-        return jsonObject;
+        sqlList.put("sa_cashbillid", sa_cashbillid);
+        return sqlList;
     }
     }
 
 
-    public static JSONObject createCashbillPay(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck) throws YosException {
+    public static SQLList createCashbillPay(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck) throws YosException {
         return createCashbillPay(controller.dbConnect, controller.userInfo, sys_enterpriseid, sa_accountclassid, cashbillEntity, ischeck);
         return createCashbillPay(controller.dbConnect, controller.userInfo, sys_enterpriseid, sa_accountclassid, cashbillEntity, ischeck);
     }
     }
 
 
@@ -209,7 +207,7 @@ public class Accountbalance extends BaseClass {
      * @return
      * @return
      * @throws YosException
      * @throws YosException
      */
      */
-    public static JSONObject createCashbillPay(DBConnect dbConnect, UserInfo userInfo, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck) throws YosException {
+    public static SQLList createCashbillPay(DBConnect dbConnect, UserInfo userInfo, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck) throws YosException {
         SQLList sqlList = new SQLList();
         SQLList sqlList = new SQLList();
         long sa_cashbillid = new BaseClass().createTableID("sa_cashbill");
         long sa_cashbillid = new BaseClass().createTableID("sa_cashbill");
         String billcode = new BaseClass().createBillCode(userInfo.getSiteId(), "cashbill1");
         String billcode = new BaseClass().createBillCode(userInfo.getSiteId(), "cashbill1");
@@ -255,7 +253,7 @@ public class Accountbalance extends BaseClass {
                 throw new YosException(false, "该营销账户不存在,支出凭证无法审核");
                 throw new YosException(false, "该营销账户不存在,支出凭证无法审核");
             } else {
             } else {
                 BigDecimal canuseamount = rowsaccountbalance.get(0).getBigDecimal("creditquota").add(rowsaccountbalance.get(0).getBigDecimal("balance")).add(rowsaccountbalance.get(0).getBigDecimal("discountamount"));
                 BigDecimal canuseamount = rowsaccountbalance.get(0).getBigDecimal("creditquota").add(rowsaccountbalance.get(0).getBigDecimal("balance")).add(rowsaccountbalance.get(0).getBigDecimal("discountamount"));
-                if ((cashbillEntity.getAmount().add(cashbillEntity.getDiscountamountamount())).compareTo(canuseamount) == 1 && (cashbillEntity.getAmount().add(cashbillEntity.getDiscountamountamount())).compareTo(BigDecimal.ZERO)>=0) {
+                if ((cashbillEntity.getAmount().add(cashbillEntity.getDiscountamountamount())).compareTo(canuseamount) == 1 && (cashbillEntity.getAmount().add(cashbillEntity.getDiscountamountamount())).compareTo(BigDecimal.ZERO) >= 0) {
                     //throw new YosException(false, "该营销账户可用余额不足,支出凭证无法审核");
                     //throw new YosException(false, "该营销账户可用余额不足,支出凭证无法审核");
                 }
                 }
                 BigDecimal newbalance = rowsaccountbalance.get(0).getBigDecimal("balance").subtract(cashbillEntity.getAmount());
                 BigDecimal newbalance = rowsaccountbalance.get(0).getBigDecimal("balance").subtract(cashbillEntity.getAmount());
@@ -270,9 +268,9 @@ public class Accountbalance extends BaseClass {
                 new Accountbalance().sendMsg(dbConnect, userInfo, content, cashbillEntity.getOwnerid(), sys_enterpriseid);
                 new Accountbalance().sendMsg(dbConnect, userInfo, content, cashbillEntity.getOwnerid(), sys_enterpriseid);
             }
             }
             JSONObject jsonObject = new JSONObject();
             JSONObject jsonObject = new JSONObject();
-            jsonObject.put("siteid",userInfo.getSiteId());
-            jsonObject.put("username",userInfo.getUserName());
-            jsonObject.put("userid",userInfo.getUserId());
+            jsonObject.put("siteid", userInfo.getSiteId());
+            jsonObject.put("username", userInfo.getUserName());
+            jsonObject.put("userid", userInfo.getUserId());
             sqlList.add(DataContrlLog.createLog(new Controller(jsonObject), "sa_cashbill", sa_cashbillid, "审核", cashbillEntity.getRemarks()).getSQL());
             sqlList.add(DataContrlLog.createLog(new Controller(jsonObject), "sa_cashbill", sa_cashbillid, "审核", cashbillEntity.getRemarks()).getSQL());
         } else {
         } else {
             sqlFactory.addParameter("status", "新建");
             sqlFactory.addParameter("status", "新建");
@@ -283,14 +281,12 @@ public class Accountbalance extends BaseClass {
         }
         }
         sqlList.add(sqlFactory.getSQL());
         sqlList.add(sqlFactory.getSQL());
 
 
-        JSONObject jsonObject = new JSONObject();
-        jsonObject.put("sa_cashbillid", sa_cashbillid);
-        jsonObject.put("sqlList", sqlList);
-        return jsonObject;
+        sqlList.put("sa_cashbillid", sa_cashbillid);
+        return sqlList;
     }
     }
 
 
     //订单手动关闭专用
     //订单手动关闭专用
-    public static JSONObject createCashbillPay2(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck) throws YosException {
+    public static SQLList createCashbillPay2(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck) throws YosException {
         SQLList sqlList = new SQLList();
         SQLList sqlList = new SQLList();
         long sa_cashbillid = controller.createTableID("sa_cashbill");
         long sa_cashbillid = controller.createTableID("sa_cashbill");
         String billcode = controller.createBillCode("cashbill1");
         String billcode = controller.createBillCode("cashbill1");
@@ -359,11 +355,8 @@ public class Accountbalance extends BaseClass {
             sqlFactory.addParameter("updatek3flag", "");
             sqlFactory.addParameter("updatek3flag", "");
         }
         }
         sqlList.add(sqlFactory.getSQL());
         sqlList.add(sqlFactory.getSQL());
-
-        JSONObject jsonObject = new JSONObject();
-        jsonObject.put("sa_cashbillid", sa_cashbillid);
-        jsonObject.put("sqlList", sqlList);
-        return jsonObject;
+        sqlList.put("sa_cashbillid", sa_cashbillid);
+        return sqlList;
     }
     }
 
 
 
 
@@ -443,11 +436,10 @@ public class Accountbalance extends BaseClass {
      * @throws YosException
      * @throws YosException
      */
      */
     public static void createCashbillIncomeWithoutSQL(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck, boolean isupdatek3flag) throws YosException {
     public static void createCashbillIncomeWithoutSQL(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck, boolean isupdatek3flag) throws YosException {
-        JSONObject jsonObject = createCashbillIncome(controller, sys_enterpriseid, sa_accountclassid, cashbillEntity, ischeck, isupdatek3flag);
-        controller.dbConnect.runSqlUpdate(new ArrayList<>(jsonObject.getJSONArray("sqlList").toJavaList(String.class)));
-
+        SQLList sqlList = createCashbillIncome(controller, sys_enterpriseid, sa_accountclassid, cashbillEntity, ischeck, isupdatek3flag);
+        controller.dbConnect.runSqlUpdate(sqlList);
         if (ischeck) {
         if (ischeck) {
-            remindSend(controller, sys_enterpriseid, jsonObject.getLong("sa_cashbillid"));
+            remindSend(controller, sys_enterpriseid, sqlList.getLong("sa_cashbillid"));
         }
         }
 
 
     }
     }
@@ -463,11 +455,11 @@ public class Accountbalance extends BaseClass {
      * @throws YosException
      * @throws YosException
      */
      */
     public static void createCashbillPayWithoutSQL(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck) throws YosException {
     public static void createCashbillPayWithoutSQL(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck) throws YosException {
-        JSONObject jsonObject = createCashbillPay(controller, sys_enterpriseid, sa_accountclassid, cashbillEntity, ischeck);
-        controller.dbConnect.runSqlUpdate(new ArrayList<>(jsonObject.getJSONArray("sqlList").toJavaList(String.class)));
+        SQLList sqlList = createCashbillPay(controller, sys_enterpriseid, sa_accountclassid, cashbillEntity, ischeck);
+        controller.dbConnect.runSqlUpdate(sqlList);
 
 
         if (ischeck) {
         if (ischeck) {
-            remindSend(controller, sys_enterpriseid, jsonObject.getLong("sa_cashbillid"));
+            remindSend(controller, sys_enterpriseid, sqlList.getLong("sa_cashbillid"));
         }
         }
 
 
     }
     }

+ 17 - 16
src/custom/beans/stockbill/bills/XSCK.java

@@ -147,9 +147,10 @@ public class XSCK extends BasicBill {
             if (rb == 1) {
             if (rb == 1) {
                 if (order_paymentnode.equals("3")) {
                 if (order_paymentnode.equals("3")) {
                     CashbillEntity entity = getCashbillEntity(billRow.getString("billdate"), billRow.getBigDecimal("payamount"), billRow.getBigDecimal("paydiscountamount"), st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成", "货款");
                     CashbillEntity entity = getCashbillEntity(billRow.getString("billdate"), billRow.getBigDecimal("payamount"), billRow.getBigDecimal("paydiscountamount"), st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成", "货款");
-                    JSONObject createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
+                    SQLList createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
+
                     if (!(billRow.getBigDecimal("payamount").compareTo(BigDecimal.ZERO) == 0 && billRow.getBigDecimal("paydiscountamount").compareTo(BigDecimal.ZERO) == 0)) {
                     if (!(billRow.getBigDecimal("payamount").compareTo(BigDecimal.ZERO) == 0 && billRow.getBigDecimal("paydiscountamount").compareTo(BigDecimal.ZERO) == 0)) {
-                        sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                        sqlList.addAll(createCashbillPay);
                     }
                     }
                 }
                 }
                 Rows rowsDispatchDetailGroup = dbConnect.runSqlQuery("select sum(t1.qty) qty,t1.sa_orderitemsid,t1.siteid from st_stockbill_items t1  where t1.sa_orderitemsid>0 and t1.st_stockbillid=" + st_stockbillid + " group by t1.sa_orderitemsid,t1.siteid");
                 Rows rowsDispatchDetailGroup = dbConnect.runSqlQuery("select sum(t1.qty) qty,t1.sa_orderitemsid,t1.siteid from st_stockbill_items t1  where t1.sa_orderitemsid>0 and t1.st_stockbillid=" + st_stockbillid + " group by t1.sa_orderitemsid,t1.siteid");
@@ -204,9 +205,9 @@ public class XSCK extends BasicBill {
             } else {
             } else {
                 if (order_paymentnode.equals("3")) {
                 if (order_paymentnode.equals("3")) {
                     CashbillEntity entity = getCashbillEntity(billRow.getString("billdate"), billRow.getBigDecimal("payamount").negate(), billRow.getBigDecimal("paydiscountamount").negate(), st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成", "货款");
                     CashbillEntity entity = getCashbillEntity(billRow.getString("billdate"), billRow.getBigDecimal("payamount").negate(), billRow.getBigDecimal("paydiscountamount").negate(), st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成", "货款");
-                    JSONObject createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
+                    SQLList createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
                     if (!(billRow.getBigDecimal("payamount").compareTo(BigDecimal.ZERO) == 0 && billRow.getBigDecimal("paydiscountamount").compareTo(BigDecimal.ZERO) == 0)) {
                     if (!(billRow.getBigDecimal("payamount").compareTo(BigDecimal.ZERO) == 0 && billRow.getBigDecimal("paydiscountamount").compareTo(BigDecimal.ZERO) == 0)) {
-                        sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                        sqlList.addAll(createCashbillPay);
                     }
                     }
 
 
                 }
                 }
@@ -267,9 +268,9 @@ public class XSCK extends BasicBill {
                 if (order_paymentnode.equals("3")) {
                 if (order_paymentnode.equals("3")) {
                     Rows cashbillRows = dbConnect.runSqlQuery("select amount,discountamount from sa_cashbill where ownerid=" + st_stockbillid + " and ownertable='st_stockbill' and type=0 and class='货款'");
                     Rows cashbillRows = dbConnect.runSqlQuery("select amount,discountamount from sa_cashbill where ownerid=" + st_stockbillid + " and ownertable='st_stockbill' and type=0 and class='货款'");
                     CashbillEntity entity = getCashbillEntity(billRow.getString("billdate"), cashbillRows.sum("amount").negate(), cashbillRows.sum("discountamount").negate(), st_stockbillid, "销售出库单反审核", billno, "由销售出库单" + billno + "反审核时生成", "货款");
                     CashbillEntity entity = getCashbillEntity(billRow.getString("billdate"), cashbillRows.sum("amount").negate(), cashbillRows.sum("discountamount").negate(), st_stockbillid, "销售出库单反审核", billno, "由销售出库单" + billno + "反审核时生成", "货款");
-                    JSONObject createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
+                    SQLList createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
                     if (!(cashbillRows.sum("amount").negate().compareTo(BigDecimal.ZERO) == 0 && cashbillRows.sum("discountamount").negate().compareTo(BigDecimal.ZERO) == 0)) {
                     if (!(cashbillRows.sum("amount").negate().compareTo(BigDecimal.ZERO) == 0 && cashbillRows.sum("discountamount").negate().compareTo(BigDecimal.ZERO) == 0)) {
-                        sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                        sqlList.addAll(createCashbillPay);
                     }
                     }
                 }
                 }
                 Rows rowsDispatchDetailGroup = dbConnect.runSqlQuery("select sum(t1.qty) qty,t1.sa_orderitemsid,t1.siteid from st_stockbill_items t1  where t1.sa_orderitemsid>0 and t1.st_stockbillid=" + st_stockbillid + " group by t1.sa_orderitemsid,t1.siteid");
                 Rows rowsDispatchDetailGroup = dbConnect.runSqlQuery("select sum(t1.qty) qty,t1.sa_orderitemsid,t1.siteid from st_stockbill_items t1  where t1.sa_orderitemsid>0 and t1.st_stockbillid=" + st_stockbillid + " group by t1.sa_orderitemsid,t1.siteid");
@@ -296,9 +297,9 @@ public class XSCK extends BasicBill {
                 if (order_paymentnode.equals("3")) {
                 if (order_paymentnode.equals("3")) {
                     Rows cashbillRows = dbConnect.runSqlQuery("select amount,discountamount from sa_cashbill where ownerid=" + st_stockbillid + " and ownertable='st_stockbill' and type=0 and class='货款'");
                     Rows cashbillRows = dbConnect.runSqlQuery("select amount,discountamount from sa_cashbill where ownerid=" + st_stockbillid + " and ownertable='st_stockbill' and type=0 and class='货款'");
                     CashbillEntity entity = getCashbillEntity(billRow.getString("billdate"), cashbillRows.sum("amount").negate(), cashbillRows.sum("discountamount").negate(), st_stockbillid, "销售出库单反审核", billno, "由销售出库单" + billno + "反审核时生成", "货款");
                     CashbillEntity entity = getCashbillEntity(billRow.getString("billdate"), cashbillRows.sum("amount").negate(), cashbillRows.sum("discountamount").negate(), st_stockbillid, "销售出库单反审核", billno, "由销售出库单" + billno + "反审核时生成", "货款");
-                    JSONObject createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
+                    SQLList createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
                     if (!(cashbillRows.sum("amount").negate().compareTo(BigDecimal.ZERO) == 0 && cashbillRows.sum("discountamount").negate().compareTo(BigDecimal.ZERO) == 0)) {
                     if (!(cashbillRows.sum("amount").negate().compareTo(BigDecimal.ZERO) == 0 && cashbillRows.sum("discountamount").negate().compareTo(BigDecimal.ZERO) == 0)) {
-                        sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                        sqlList.addAll(createCashbillPay);
                     }
                     }
 
 
                 }
                 }
@@ -400,9 +401,9 @@ public class XSCK extends BasicBill {
                     }
                     }
 
 
                     CashbillEntity entity_custamount = getCashbillEntity(billRow.getString("billdate"), custamount, BigDecimal.ZERO, st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成", "客户档案资料费");
                     CashbillEntity entity_custamount = getCashbillEntity(billRow.getString("billdate"), custamount, BigDecimal.ZERO, st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成", "客户档案资料费");
-                    JSONObject createCashbillPay_custamount = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity_custamount, true);
+                    SQLList createCashbillPay_custamount = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity_custamount, true);
                     if (custamount.compareTo(BigDecimal.ZERO) != 0) {
                     if (custamount.compareTo(BigDecimal.ZERO) != 0) {
-                        sqlList.addAll(createCashbillPay_custamount.getJSONArray("sqlList").toJavaList(String.class));
+                        sqlList.addAll(createCashbillPay_custamount);
                     }
                     }
 
 
 
 
@@ -414,9 +415,9 @@ public class XSCK extends BasicBill {
                         custamount = custamount.add(row.getBigDecimal("custamount").multiply(row.getBigDecimal("qty")));
                         custamount = custamount.add(row.getBigDecimal("custamount").multiply(row.getBigDecimal("qty")));
                     }
                     }
                     CashbillEntity entity_custamount = getCashbillEntity(billRow.getString("billdate"), custamount.negate(), BigDecimal.ZERO, st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成", "客户档案资料费");
                     CashbillEntity entity_custamount = getCashbillEntity(billRow.getString("billdate"), custamount.negate(), BigDecimal.ZERO, st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成", "客户档案资料费");
-                    JSONObject createCashbillPay_custamount = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity_custamount, true);
+                    SQLList createCashbillPay_custamount = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity_custamount, true);
                     if (custamount.negate().compareTo(BigDecimal.ZERO) != 0) {
                     if (custamount.negate().compareTo(BigDecimal.ZERO) != 0) {
-                        sqlList.addAll(createCashbillPay_custamount.getJSONArray("sqlList").toJavaList(String.class));
+                        sqlList.addAll(createCashbillPay_custamount);
                     }
                     }
                 }
                 }
             }
             }
@@ -427,18 +428,18 @@ public class XSCK extends BasicBill {
                 if (order_paymentnode.equals("3")) {
                 if (order_paymentnode.equals("3")) {
                     Rows cashbillRows_custamount = dbConnect.runSqlQuery("select amount,discountamount from sa_cashbill where ownerid=" + st_stockbillid + " and ownertable='st_stockbill' and type=0 and class='客户档案资料费'");
                     Rows cashbillRows_custamount = dbConnect.runSqlQuery("select amount,discountamount from sa_cashbill where ownerid=" + st_stockbillid + " and ownertable='st_stockbill' and type=0 and class='客户档案资料费'");
                     CashbillEntity entity_custamount = getCashbillEntity(billRow.getString("billdate"), cashbillRows_custamount.sum("amount").negate(), cashbillRows_custamount.sum("discountamount").negate(), st_stockbillid, "销售出库单反审核", billno, "由销售出库单" + billno + "反审核时生成", "客户档案资料费");
                     CashbillEntity entity_custamount = getCashbillEntity(billRow.getString("billdate"), cashbillRows_custamount.sum("amount").negate(), cashbillRows_custamount.sum("discountamount").negate(), st_stockbillid, "销售出库单反审核", billno, "由销售出库单" + billno + "反审核时生成", "客户档案资料费");
-                    JSONObject createCashbillPay_custamount = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity_custamount, true);
+                    SQLList createCashbillPay_custamount = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity_custamount, true);
                     if (cashbillRows_custamount.sum("amount").negate().compareTo(BigDecimal.ZERO) != 0) {
                     if (cashbillRows_custamount.sum("amount").negate().compareTo(BigDecimal.ZERO) != 0) {
-                        sqlList.addAll(createCashbillPay_custamount.getJSONArray("sqlList").toJavaList(String.class));
+                        sqlList.addAll(createCashbillPay_custamount);
                     }
                     }
                 }
                 }
             } else {
             } else {
                 if (order_paymentnode.equals("3")) {
                 if (order_paymentnode.equals("3")) {
                     Rows cashbillRows_custamount = dbConnect.runSqlQuery("select amount,discountamount from sa_cashbill where ownerid=" + st_stockbillid + " and ownertable='st_stockbill' and type=0 and class='客户档案资料费'");
                     Rows cashbillRows_custamount = dbConnect.runSqlQuery("select amount,discountamount from sa_cashbill where ownerid=" + st_stockbillid + " and ownertable='st_stockbill' and type=0 and class='客户档案资料费'");
                     CashbillEntity entity_custamount = getCashbillEntity(billRow.getString("billdate"), cashbillRows_custamount.sum("amount").negate(), cashbillRows_custamount.sum("discountamount").negate(), st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成", "客户档案资料费");
                     CashbillEntity entity_custamount = getCashbillEntity(billRow.getString("billdate"), cashbillRows_custamount.sum("amount").negate(), cashbillRows_custamount.sum("discountamount").negate(), st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成", "客户档案资料费");
-                    JSONObject createCashbillPay_custamount = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity_custamount, true);
+                    SQLList createCashbillPay_custamount = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity_custamount, true);
                     if (cashbillRows_custamount.sum("amount").negate().compareTo(BigDecimal.ZERO) != 0) {
                     if (cashbillRows_custamount.sum("amount").negate().compareTo(BigDecimal.ZERO) != 0) {
-                        sqlList.addAll(createCashbillPay_custamount.getJSONArray("sqlList").toJavaList(String.class));
+                        sqlList.addAll(createCashbillPay_custamount);
                     }
                     }
                 }
                 }
             }
             }

+ 79 - 46
src/custom/restcontroller/webmanage/sale/aftersalesmag/aftersalesmag.java

@@ -6,7 +6,6 @@ import beans.data.BatchDeleteErr;
 import beans.datacontrllog.DataContrlLog;
 import beans.datacontrllog.DataContrlLog;
 import beans.hr.Hr;
 import beans.hr.Hr;
 import beans.remind.Remind;
 import beans.remind.Remind;
-
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONObject;
 import common.Controller;
 import common.Controller;
@@ -141,7 +140,10 @@ public class aftersalesmag extends Controller {
     }
     }
 
 
     @API(title = "返退单更新退货金额及物流单号", apiversion = R.ID20230105100203.v1.class)
     @API(title = "返退单更新退货金额及物流单号", apiversion = R.ID20230105100203.v1.class)
-    @CACHEING_CLEAN(apiversions = {R.ID20230104160603.v1.class, R.ID20230104160703.v1.class, R.ID20230105161503.v1.class})
+    @CACHEING_CLEAN(apiversions = {
+            R.ID20230104160603.v1.class,
+            R.ID20230104160703.v1.class,
+            R.ID20230105161503.v1.class})
     public String updateaftersalesmag() throws YosException {
     public String updateaftersalesmag() throws YosException {
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         String logisticno = content.getStringValue("logisticno");
         String logisticno = content.getStringValue("logisticno");
@@ -209,12 +211,12 @@ public class aftersalesmag extends Controller {
         querySQL.addJoinTable(JOINTYPE.left, "sa_warrantycard", "t6", "t6.sku=t1.sku and t6.siteid=t1.siteid", "cardno", "begdate", "enddate");
         querySQL.addJoinTable(JOINTYPE.left, "sa_warrantycard", "t6", "t6.sku=t1.sku and t6.siteid=t1.siteid", "cardno", "begdate", "enddate");
 
 
         querySQL.setSiteid(siteid);
         querySQL.setSiteid(siteid);
-        querySQL.setWhere("(t1.sa_agentsid in (select sa_agentsid from sa_agents where  sys_enterpriseid=" + sys_enterpriseid + ") or t1.sys_enterpriseid="+sys_enterpriseid+")");
+        querySQL.setWhere("(t1.sa_agentsid in (select sa_agentsid from sa_agents where  sys_enterpriseid=" + sys_enterpriseid + ") or t1.sys_enterpriseid=" + sys_enterpriseid + ")");
         querySQL.setWhere("t1.sku not in (select distinct machinecode from sa_aftersalesmag_items where siteid='" + siteid + "' and ifnull(machinecode,'')!='')");
         querySQL.setWhere("t1.sku not in (select distinct machinecode from sa_aftersalesmag_items where siteid='" + siteid + "' and ifnull(machinecode,'')!='')");
         querySQL.setWhere(where.toString());
         querySQL.setWhere(where.toString());
-        querySQL.addQueryFields("cardname","t6.name");
-        querySQL.addQueryFields("cardphonenumber","t6.phonenumber");
-        querySQL.addQueryFields("cardaddress","t6.address");
+        querySQL.addQueryFields("cardname", "t6.name");
+        querySQL.addQueryFields("cardphonenumber", "t6.phonenumber");
+        querySQL.addQueryFields("cardaddress", "t6.address");
 
 
         querySQL.addGroupBy("t4.agentnum,t5.contact,t5.phonenumber,t5.address,t6.cardno,t6.begdate" +
         querySQL.addGroupBy("t4.agentnum,t5.contact,t5.phonenumber,t5.address,t6.cardno,t6.begdate" +
                 ",t6.enddate,t1.sku,t2.itemid,t2.itemno,t2.itemname,t2.model,t2.spec,t3.unitname,t6.name,t6.phonenumber,t6.address");
                 ",t6.enddate,t1.sku,t2.itemid,t2.itemno,t2.itemname,t2.model,t2.spec,t3.unitname,t6.name,t6.phonenumber,t6.address");
@@ -223,17 +225,17 @@ public class aftersalesmag extends Controller {
 
 
         QuerySQL skuquerySQL = SQLFactory.createQuerySQL(this, "st_stockbill_items_sku", "sku");
         QuerySQL skuquerySQL = SQLFactory.createQuerySQL(this, "st_stockbill_items_sku", "sku");
         skuquerySQL.setTableAlias("t1");
         skuquerySQL.setTableAlias("t1");
-        skuquerySQL.addJoinTable(JOINTYPE.inner, "st_stockbill", "t2", "t1.st_stockbillid=t2.st_stockbillid and t1.siteid=t2.siteid","checkdate");
+        skuquerySQL.addJoinTable(JOINTYPE.inner, "st_stockbill", "t2", "t1.st_stockbillid=t2.st_stockbillid and t1.siteid=t2.siteid", "checkdate");
         skuquerySQL.setWhere("t2.status='审核'");
         skuquerySQL.setWhere("t2.status='审核'");
-        skuquerySQL.setWhere("t1.sku",rows.toArrayList("sku"));
+        skuquerySQL.setWhere("t1.sku", rows.toArrayList("sku"));
         skuquerySQL.setSiteid(siteid);
         skuquerySQL.setSiteid(siteid);
         Rows skurows = skuquerySQL.query();
         Rows skurows = skuquerySQL.query();
         RowsMap skurowsMap = skurows.toRowsMap("sku");
         RowsMap skurowsMap = skurows.toRowsMap("sku");
-        for(Row row :rows){
-            if(skurowsMap.containsKey(row.getString("sku"))){
-                row.put("stockdate",skurowsMap.get(row.getString("sku")).get(0).getString("checkdate"));
-            }else{
-                row.put("stockdate","");
+        for (Row row : rows) {
+            if (skurowsMap.containsKey(row.getString("sku"))) {
+                row.put("stockdate", skurowsMap.get(row.getString("sku")).get(0).getString("checkdate"));
+            } else {
+                row.put("stockdate", "");
             }
             }
         }
         }
 
 
@@ -266,11 +268,11 @@ public class aftersalesmag extends Controller {
         querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t8", "t8.agentnum=t6.toagentnum and t8.siteid=t6.siteid");
         querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t8", "t8.agentnum=t6.toagentnum and t8.siteid=t6.siteid");
         querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t9", "t9.sys_enterpriseid=t8.sys_enterpriseid and t9.siteid=t8.siteid");
         querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t9", "t9.sys_enterpriseid=t8.sys_enterpriseid and t9.siteid=t8.siteid");
 
 
-        querySQL.addQueryFields("sa_agentsid_service","t8.sa_agentsid");
-        querySQL.addQueryFields("agentnum_service","t8.agentnum");
-        querySQL.addQueryFields("enterprisename_service","t9.enterprisename");
-        querySQL.addQueryFields("abbreviation_service","t9.abbreviation");
-        querySQL.addQueryFields("sys_enterpriseid_service","t9.sys_enterpriseid");
+        querySQL.addQueryFields("sa_agentsid_service", "t8.sa_agentsid");
+        querySQL.addQueryFields("agentnum_service", "t8.agentnum");
+        querySQL.addQueryFields("enterprisename_service", "t9.enterprisename");
+        querySQL.addQueryFields("abbreviation_service", "t9.abbreviation");
+        querySQL.addQueryFields("sys_enterpriseid_service", "t9.sys_enterpriseid");
 
 
         querySQL.setSiteid(siteid);
         querySQL.setSiteid(siteid);
         querySQL.setWhere("t6.sa_customersid", sa_customersid);
         querySQL.setWhere("t6.sa_customersid", sa_customersid);
@@ -317,7 +319,7 @@ public class aftersalesmag extends Controller {
 
 
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_aftersalesmag", "*");
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_aftersalesmag", "*");
         querySQL.setTableAlias("t1");
         querySQL.setTableAlias("t1");
-        querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t2", "t1.sys_enterpriseid = t2.sys_enterpriseid AND t1.siteid = t2.siteid", "enterprisename","abbreviation");
+        querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t2", "t1.sys_enterpriseid = t2.sys_enterpriseid AND t1.siteid = t2.siteid", "enterprisename", "abbreviation");
         querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t3", "t1.sys_enterpriseid = t3.sys_enterpriseid AND t1.siteid = t3.siteid", "agentnum");
         querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t3", "t1.sys_enterpriseid = t3.sys_enterpriseid AND t1.siteid = t3.siteid", "agentnum");
         querySQL.addJoinTable(JOINTYPE.left, "sa_aftersalesmag_items", "t4", "t1.sa_aftersalesmagid = t4.sa_aftersalesmagid AND t1.siteid = t4.siteid", "name", "phonenumber", "address",
         querySQL.addJoinTable(JOINTYPE.left, "sa_aftersalesmag_items", "t4", "t1.sa_aftersalesmagid = t4.sa_aftersalesmagid AND t1.siteid = t4.siteid", "name", "phonenumber", "address",
                 "stockdate", "enddate", "model", "spec", "unitname", "itemname", "itemno", "duty", "demand", "machinecode", "qty", "itemid");
                 "stockdate", "enddate", "model", "spec", "unitname", "itemname", "itemno", "duty", "demand", "machinecode", "qty", "itemid");
@@ -331,15 +333,15 @@ public class aftersalesmag extends Controller {
         querySQL.setSiteid(siteid);
         querySQL.setSiteid(siteid);
         querySQL.setWhere("t1.sa_aftersalesmagid", sa_aftersalesmagid);
         querySQL.setWhere("t1.sa_aftersalesmagid", sa_aftersalesmagid);
         Rows rows = querySQL.query();
         Rows rows = querySQL.query();
-        for(Row row :rows){
-            if(StringUtils.isBlank(row.getString("machinecode"))){
-                row.put("cardno","");
-            }else{
-                Rows warrantycardrows = dbConnect.runSqlQuery("select cardno from sa_warrantycard where sku='"+row.getString("machinecode")+"'");
-                if(warrantycardrows.isEmpty()){
-                    row.put("cardno","");
-                }else{
-                    row.put("cardno",warrantycardrows.get(0).getString("cardno"));
+        for (Row row : rows) {
+            if (StringUtils.isBlank(row.getString("machinecode"))) {
+                row.put("cardno", "");
+            } else {
+                Rows warrantycardrows = dbConnect.runSqlQuery("select cardno from sa_warrantycard where sku='" + row.getString("machinecode") + "'");
+                if (warrantycardrows.isEmpty()) {
+                    row.put("cardno", "");
+                } else {
+                    row.put("cardno", warrantycardrows.get(0).getString("cardno"));
                 }
                 }
 
 
             }
             }
@@ -451,7 +453,10 @@ public class aftersalesmag extends Controller {
     }
     }
 
 
     @API(title = "撤回反撤回", apiversion = R.ID2025061316113303.v1.class)
     @API(title = "撤回反撤回", apiversion = R.ID2025061316113303.v1.class)
-    @CACHEING_CLEAN(apiClass = {aftersalesmag.class, aftersalesmagItems.class, restcontroller.sale.aftersalesmag.aftersalesmag.class})
+    @CACHEING_CLEAN(apiClass = {
+            aftersalesmag.class,
+            aftersalesmagItems.class,
+            restcontroller.sale.aftersalesmag.aftersalesmag.class})
     public String chehui() throws YosException {
     public String chehui() throws YosException {
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         boolean ischehui = content.getBooleanValue("ischehui");
         boolean ischehui = content.getBooleanValue("ischehui");
@@ -539,7 +544,10 @@ public class aftersalesmag extends Controller {
 
 
 
 
     @API(title = "审核反审核", apiversion = R.ID20230104161103.v1.class)
     @API(title = "审核反审核", apiversion = R.ID20230104161103.v1.class)
-    @CACHEING_CLEAN(apiClass = {aftersalesmag.class, aftersalesmagItems.class, restcontroller.sale.aftersalesmag.aftersalesmag.class})
+    @CACHEING_CLEAN(apiClass = {
+            aftersalesmag.class,
+            aftersalesmagItems.class,
+            restcontroller.sale.aftersalesmag.aftersalesmag.class})
     public String check() throws YosException {
     public String check() throws YosException {
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         boolean ischeck = content.getBooleanValue("ischeck");
         boolean ischeck = content.getBooleanValue("ischeck");
@@ -589,8 +597,8 @@ public class aftersalesmag extends Controller {
         }
         }
         SQLList sqlList = new SQLList();
         SQLList sqlList = new SQLList();
         SQLFactory sqlFactoryupdate;
         SQLFactory sqlFactoryupdate;
-        long st_stockbillid =0;
-        Rows departmenthrrows =dbConnect.runSqlQuery("select * from sys_departmenthrid where hrid="+hrid);
+        long st_stockbillid = 0;
+        Rows departmenthrrows = dbConnect.runSqlQuery("select * from sys_departmenthrid where hrid=" + hrid);
         if (ischeck) {
         if (ischeck) {
             InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "st_stockbill");
             InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "st_stockbill");
             st_stockbillid = createTableID("st_stockbill");
             st_stockbillid = createTableID("st_stockbill");
@@ -602,7 +610,7 @@ public class aftersalesmag extends Controller {
             insertSQL.setValue("sys_enterpriseid", rows.get(0).getLong("sys_enterpriseid"));
             insertSQL.setValue("sys_enterpriseid", rows.get(0).getLong("sys_enterpriseid"));
             insertSQL.setValue("rb", 1);
             insertSQL.setValue("rb", 1);
             insertSQL.setValue("sourceobject", "sa_aftersalesmag");
             insertSQL.setValue("sourceobject", "sa_aftersalesmag");
-            insertSQL.setValue("departmentid", departmenthrrows.isNotEmpty()?departmenthrrows.get(0).getLong("departmentid"):0);
+            insertSQL.setValue("departmentid", departmenthrrows.isNotEmpty() ? departmenthrrows.get(0).getLong("departmentid") : 0);
             insertSQL.setValue("sourceid", sa_aftersalesmagid);
             insertSQL.setValue("sourceid", sa_aftersalesmagid);
             insertSQL.setValue("stockid", stockid);
             insertSQL.setValue("stockid", stockid);
             insertSQL.setValue("remarks", rows.get(0).getString("remarks"));
             insertSQL.setValue("remarks", rows.get(0).getString("remarks"));
@@ -639,7 +647,7 @@ public class aftersalesmag extends Controller {
                 long st_stockbill_items_skuid = createTableID("st_stockbill_items_sku");
                 long st_stockbill_items_skuid = createTableID("st_stockbill_items_sku");
                 insertSQL.setUniqueid(st_stockbill_items_skuid);
                 insertSQL.setUniqueid(st_stockbill_items_skuid);
                 insertSQL.setSiteid(siteid);
                 insertSQL.setSiteid(siteid);
-                insertSQL.setValue("stockid",stockid);
+                insertSQL.setValue("stockid", stockid);
                 insertSQL.setValue("itemid", row.getLong("itemid"));
                 insertSQL.setValue("itemid", row.getLong("itemid"));
                 insertSQL.setValue("sku", row.getString("machinecode"));
                 insertSQL.setValue("sku", row.getString("machinecode"));
                 insertSQL.setValue("st_stockbillid", st_stockbillid);
                 insertSQL.setValue("st_stockbillid", st_stockbillid);
@@ -692,7 +700,11 @@ public class aftersalesmag extends Controller {
     }
     }
 
 
     @API(title = "复核", apiversion = R.ID20230104160903.v1.class)
     @API(title = "复核", apiversion = R.ID20230104160903.v1.class)
-    @CACHEING_CLEAN(apiClass = {aftersalesmag.class, aftersalesmagItems.class, cashbill.class, restcontroller.sale.aftersalesmag.aftersalesmag.class})
+    @CACHEING_CLEAN(apiClass = {
+            aftersalesmag.class,
+            aftersalesmagItems.class,
+            cashbill.class,
+            restcontroller.sale.aftersalesmag.aftersalesmag.class})
     public String recheck() throws YosException {
     public String recheck() throws YosException {
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         Long sa_accountclassid = content.getLongValue("sa_accountclassid");
         Long sa_accountclassid = content.getLongValue("sa_accountclassid");
@@ -763,13 +775,13 @@ public class aftersalesmag extends Controller {
                 cashbillEntity.setSource("退货单复核");
                 cashbillEntity.setSource("退货单复核");
 
 
                 if (sa_accountclassid == 0) {
                 if (sa_accountclassid == 0) {
-                    JSONObject cashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, rows.get(0).getLong("sa_accountclassid"), cashbillEntity, true);
-                    sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                    SQLList cashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, rows.get(0).getLong("sa_accountclassid"), cashbillEntity, true);
+                    sqlList.addAll(cashbillPay);
                     sa_cashbillid = cashbillPay.getLong("sa_cashbillid");
                     sa_cashbillid = cashbillPay.getLong("sa_cashbillid");
                 } else {
                 } else {
                     sqlList.add("update sa_aftersalesmag set sa_accountclassid=" + sa_accountclassid + " where sa_aftersalesmagid=" + sa_aftersalesmagid + " and siteid='" + siteid + "'");
                     sqlList.add("update sa_aftersalesmag set sa_accountclassid=" + sa_accountclassid + " where sa_aftersalesmagid=" + sa_aftersalesmagid + " and siteid='" + siteid + "'");
-                    JSONObject cashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, sa_accountclassid, cashbillEntity, true);
-                    sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                    SQLList cashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, sa_accountclassid, cashbillEntity, true);
+                    sqlList.addAll(cashbillPay);
                     sa_cashbillid = cashbillPay.getLong("sa_cashbillid");
                     sa_cashbillid = cashbillPay.getLong("sa_cashbillid");
                 }
                 }
 
 
@@ -835,7 +847,14 @@ public class aftersalesmag extends Controller {
     }
     }
 
 
     @API(title = "反复核", apiversion = R.ID20230523085403.v1.class)
     @API(title = "反复核", apiversion = R.ID20230523085403.v1.class)
-    @CACHEING_CLEAN(apiversions = {R.ID20230104160603.v1.class, R.ID20230104160703.v1.class, R.ID20230105110903.class, R.ID20230105161503.v1.class}, apiClass = {aftersalesmag.class, aftersalesmagItems.class, cashbill.class})
+    @CACHEING_CLEAN(apiversions = {
+            R.ID20230104160603.v1.class,
+            R.ID20230104160703.v1.class,
+            R.ID20230105110903.class,
+            R.ID20230105161503.v1.class}, apiClass = {
+            aftersalesmag.class,
+            aftersalesmagItems.class,
+            cashbill.class})
     public String unrecheck() throws YosException {
     public String unrecheck() throws YosException {
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         Long sa_orderid = 0L;
         Long sa_orderid = 0L;
@@ -902,8 +921,8 @@ public class aftersalesmag extends Controller {
 //                        sqlList.add("update sa_orderitems set returnqty=returnqty-" + returnqty + " where sa_orderitemsid=" + row.getString("sa_orderitemsid"));
 //                        sqlList.add("update sa_orderitems set returnqty=returnqty-" + returnqty + " where sa_orderitemsid=" + row.getString("sa_orderitemsid"));
 //                    }
 //                    }
 //                }
 //                }
-                JSONObject cashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, rows.get(0).getLong("sa_accountclassid"), cashbillEntity, true);
-                sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                SQLList cashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, rows.get(0).getLong("sa_accountclassid"), cashbillEntity, true);
+                sqlList.addAll(cashbillPay);
                 sa_cashbillid = cashbillPay.getLong("sa_cashbillid");
                 sa_cashbillid = cashbillPay.getLong("sa_cashbillid");
             }
             }
         }
         }
@@ -930,7 +949,14 @@ public class aftersalesmag extends Controller {
 
 
 
 
     @API(title = "关闭", apiversion = R.ID20230522090403.v1.class)
     @API(title = "关闭", apiversion = R.ID20230522090403.v1.class)
-    @CACHEING_CLEAN(apiversions = {R.ID20230104160603.v1.class, R.ID20230104160703.v1.class, R.ID20230105110903.class, R.ID20230105161503.v1.class}, apiClass = {aftersalesmag.class, aftersalesmagItems.class, cashbill.class})
+    @CACHEING_CLEAN(apiversions = {
+            R.ID20230104160603.v1.class,
+            R.ID20230104160703.v1.class,
+            R.ID20230105110903.class,
+            R.ID20230105161503.v1.class}, apiClass = {
+            aftersalesmag.class,
+            aftersalesmagItems.class,
+            cashbill.class})
     public String close() throws YosException {
     public String close() throws YosException {
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         Long sa_orderid = 0L;
         Long sa_orderid = 0L;
@@ -1036,7 +1062,14 @@ public class aftersalesmag extends Controller {
     }
     }
 
 
     @API(title = "反复核", apiversion = R.ID20230104161003.v1.class)
     @API(title = "反复核", apiversion = R.ID20230104161003.v1.class)
-    @CACHEING_CLEAN(apiversions = {R.ID20230104160603.v1.class, R.ID20230104160703.v1.class, R.ID20230105110903.class, R.ID20230105161503.v1.class}, apiClass = {aftersalesmag.class, aftersalesmagItems.class, cashbill.class})
+    @CACHEING_CLEAN(apiversions = {
+            R.ID20230104160603.v1.class,
+            R.ID20230104160703.v1.class,
+            R.ID20230105110903.class,
+            R.ID20230105161503.v1.class}, apiClass = {
+            aftersalesmag.class,
+            aftersalesmagItems.class,
+            cashbill.class})
     public String uncheck() throws YosException {
     public String uncheck() throws YosException {
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
         Long sa_orderid = 0L;
         Long sa_orderid = 0L;
@@ -1083,8 +1116,8 @@ public class aftersalesmag extends Controller {
                 cashbillEntity.setRemarks("退货单号:" + rows.get(0).getString("billno") + ";订单号:" + rows.get(0).getString("sonum"));
                 cashbillEntity.setRemarks("退货单号:" + rows.get(0).getString("billno") + ";订单号:" + rows.get(0).getString("sonum"));
                 cashbillEntity.setSource("退货单反复核");
                 cashbillEntity.setSource("退货单反复核");
 
 
-                JSONObject cashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, rows.get(0).getLong("sa_accountclassid"), cashbillEntity, true);
-                sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                SQLList cashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, rows.get(0).getLong("sa_accountclassid"), cashbillEntity, true);
+                sqlList.addAll(cashbillPay);
                 sa_cashbillid = cashbillPay.getLong("sa_cashbillid");
                 sa_cashbillid = cashbillPay.getLong("sa_cashbillid");
             }
             }
         }
         }

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

@@ -2916,8 +2916,8 @@ public class Order extends Controller {
                 if (!Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount)) {
                 if (!Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount)) {
                     return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, sa_accountclassid, amount) + "元!").toString();
                     return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, sa_accountclassid, amount) + "元!").toString();
                 }
                 }
-                JSONObject rateBillMap = useRateBill(row, "订单提交");
-                sqlList.addAll(rateBillMap.getJSONArray("sqlList").toJavaList(String.class));
+                SQLList rateBillMap = useRateBill(row, "订单提交");
+                sqlList.addAll(rateBillMap);
                 sa_cashbillidList.add(rateBillMap.getLong("sa_cashbillid"));
                 sa_cashbillidList.add(rateBillMap.getLong("sa_cashbillid"));
             } else {
             } else {
 
 
@@ -2937,20 +2937,18 @@ public class Order extends Controller {
                                 } else {
                                 } else {
                                     jsonObject.put("balance", jsonObject.getBigDecimal("balance").subtract(amount1));
                                     jsonObject.put("balance", jsonObject.getBigDecimal("balance").subtract(amount1));
                                 }
                                 }
-                                JSONObject cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), entity, true);
+                                SQLList cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), entity, true);
 //                                sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
 //                                sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
-                                ArrayList<String> sqlList2 = (ArrayList<String>) cashbillPay.getJSONArray("sqlList").toJavaList(String.class);
-                                dbConnect.runSqlUpdate(sqlList2);
-                                sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
+                                dbConnect.runSqlUpdate(cashbillPay);
+                                sa_cashbillidList.add((Long) cashbillPay.getLong("sa_cashbillid"));
 
 
 
 
                                 //定制费用
                                 //定制费用
 
 
                                 CashbillEntity entityCost = getCashbillEntity(getDate_Str(), costamount, sa_orderid, "订单提交", sonum, "由" + sonum + "【定制费用】订单提交时自动产生");
                                 CashbillEntity entityCost = getCashbillEntity(getDate_Str(), costamount, sa_orderid, "订单提交", sonum, "由" + sonum + "【定制费用】订单提交时自动产生");
-                                JSONObject cashbillPayCost = Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entityCost, true);
-                                sqlList.addAll(cashbillPayCost.getJSONArray("sqlList").toJavaList(String.class));
-                                sa_cashbillidList.add(cashbillPayCost.getLong("sa_cashbillid"));
-
+                                SQLList cashbillPayCost = Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entityCost, true);
+                                sqlList.addAll(cashbillPayCost);
+                                sa_cashbillidList.add((Long) cashbillPayCost.getLong("sa_cashbillid"));
 
 
                             } else {
                             } else {
                                 return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), amount1.add(costamount)) + "元!").toString();
                                 return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), amount1.add(costamount)) + "元!").toString();
@@ -2964,9 +2962,9 @@ public class Order extends Controller {
                                 } else {
                                 } else {
                                     jsonObject.put("balance", jsonObject.getBigDecimal("balance").subtract(amount1));
                                     jsonObject.put("balance", jsonObject.getBigDecimal("balance").subtract(amount1));
                                 }
                                 }
-                                JSONObject cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), entity, true);
-                                sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
-                                sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
+                                SQLList cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), entity, true);
+                                sqlList.addAll(cashbillPay);
+                                sa_cashbillidList.add((Long) cashbillPay.getLong("sa_cashbillid"));
                             } else {
                             } else {
                                 return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), amount1) + "元!").toString();
                                 return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), amount1) + "元!").toString();
                             }
                             }
@@ -2976,17 +2974,16 @@ public class Order extends Controller {
                 } else {
                 } else {
                     if (Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount.add(costamount))) {
                     if (Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount.add(costamount))) {
                         CashbillEntity entity = getCashbillEntity(getDate_Str(), amount, sa_orderid, "订单提交", sonum, "由" + sonum + "订单提交时自动产生");
                         CashbillEntity entity = getCashbillEntity(getDate_Str(), amount, sa_orderid, "订单提交", sonum, "由" + sonum + "订单提交时自动产生");
-                        JSONObject cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true);
+                        SQLList cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true);
 //                        sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
 //                        sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
-                        ArrayList<String> sqlList2 = (ArrayList<String>) cashbillPay.getJSONArray("sqlList").toJavaList(String.class);
-                        dbConnect.runSqlUpdate(sqlList2);
+                        dbConnect.runSqlUpdate(cashbillPay);
                         sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
                         sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
 
 
                         //定制费用
                         //定制费用
                         if (costamount.compareTo(BigDecimal.ZERO) > 0) {
                         if (costamount.compareTo(BigDecimal.ZERO) > 0) {
                             CashbillEntity entityCost = getCashbillEntity(getDate_Str(), costamount, sa_orderid, "订单提交", sonum, "由" + sonum + "【定制费用】订单提交时自动产生");
                             CashbillEntity entityCost = getCashbillEntity(getDate_Str(), costamount, sa_orderid, "订单提交", sonum, "由" + sonum + "【定制费用】订单提交时自动产生");
-                            JSONObject cashbillPayCost = Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entityCost, true);
-                            sqlList.addAll(cashbillPayCost.getJSONArray("sqlList").toJavaList(String.class));
+                            SQLList cashbillPayCost = Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entityCost, true);
+                            sqlList.addAll(cashbillPayCost);
                             sa_cashbillidList.add(cashbillPayCost.getLong("sa_cashbillid"));
                             sa_cashbillidList.add(cashbillPayCost.getLong("sa_cashbillid"));
                         }
                         }
 
 
@@ -3098,22 +3095,19 @@ public class Order extends Controller {
      * @return
      * @return
      * @throws YosException
      * @throws YosException
      */
      */
-    public JSONObject useRateBill(Row orderRow, String source) throws YosException {
+    public SQLList useRateBill(Row orderRow, String source) throws YosException {
         SQLList sqlList = new SQLList();
         SQLList sqlList = new SQLList();
         Long sa_orderid = orderRow.getLong("sa_orderid");
         Long sa_orderid = orderRow.getLong("sa_orderid");
         Long pay_enterpriseid = orderRow.getLong("pay_enterpriseid");
         Long pay_enterpriseid = orderRow.getLong("pay_enterpriseid");
         Long sa_accountclassid = orderRow.getLong("sa_accountclassid");
         Long sa_accountclassid = orderRow.getLong("sa_accountclassid");
         BigDecimal rebateamount = orderRow.getBigDecimal("rebateamount");
         BigDecimal rebateamount = orderRow.getBigDecimal("rebateamount");
         String sonum = orderRow.getString("sonum");
         String sonum = orderRow.getString("sonum");
-
-
-        JSONObject jsonObject = new JSONObject();
         //金额=金额-返利金金额
         //金额=金额-返利金金额
         BigDecimal amount = beans.order.Order.getAmount(this, sa_orderid);
         BigDecimal amount = beans.order.Order.getAmount(this, sa_orderid);
         //创建支出凭证
         //创建支出凭证
         CashbillEntity entity = getCashbillEntity(getDate_Str(), amount, sa_orderid, source, sonum, "由" + sonum + source + "时自动产生");
         CashbillEntity entity = getCashbillEntity(getDate_Str(), amount, sa_orderid, source, sonum, "由" + sonum + source + "时自动产生");
-        JSONObject cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true);
-        sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+        SQLList cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true);
+        sqlList.addAll(cashbillPay);
         Long sa_cashbillid1 = cashbillPay.getLong("sa_cashbillid");
         Long sa_cashbillid1 = cashbillPay.getLong("sa_cashbillid");
 
 
         //创建返利金支出凭证
         //创建返利金支出凭证
@@ -3159,11 +3153,9 @@ public class Order extends Controller {
 
 
             sqlList.add(updateCashbillSql(sa_cashbillid, rebate_balance));
             sqlList.add(updateCashbillSql(sa_cashbillid, rebate_balance));
             count++;
             count++;
-
         }
         }
-        jsonObject.put("sqlList", sqlList);
-        jsonObject.put("sa_cashbillid", sa_cashbillid1);
-        return jsonObject;
+        sqlList.put("sa_cashbillid", sa_cashbillid1);
+        return sqlList;
     }
     }
 
 
 
 
@@ -3247,8 +3239,8 @@ public class Order extends Controller {
                 if (!Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount)) {
                 if (!Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount)) {
                     return getErrReturnObject().setErrMsg("账户余额不足").toString();
                     return getErrReturnObject().setErrMsg("账户余额不足").toString();
                 }
                 }
-                JSONObject rateBillMap = useRateBill(row, "订单审核");
-                sqlList.addAll(rateBillMap.getJSONArray("sqlList").toJavaList(String.class));
+                SQLList rateBillMap = useRateBill(row, "订单审核");
+                sqlList.addAll(rateBillMap);
                 sa_cashbillidList.add(rateBillMap.getLong("sa_cashbillid"));
                 sa_cashbillidList.add(rateBillMap.getLong("sa_cashbillid"));
             } else {
             } else {
                 if (!accountclassinfos.isEmpty()) {
                 if (!accountclassinfos.isEmpty()) {
@@ -3257,8 +3249,8 @@ public class Order extends Controller {
                         if (Accountbalance.judgeBalance(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), jsonObject.getBigDecimal("amount"))) {
                         if (Accountbalance.judgeBalance(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), jsonObject.getBigDecimal("amount"))) {
                             CashbillEntity entity = getCashbillEntity(getDate_Str(), jsonObject.getBigDecimal("amount"), sa_orderid, "订单审核", sonum, "由订单号" + sonum + "审核时生成");
                             CashbillEntity entity = getCashbillEntity(getDate_Str(), jsonObject.getBigDecimal("amount"), sa_orderid, "订单审核", sonum, "由订单号" + sonum + "审核时生成");
                             jsonObject.put("balance", jsonObject.getBigDecimal("balance").subtract(jsonObject.getBigDecimal("amount")));
                             jsonObject.put("balance", jsonObject.getBigDecimal("balance").subtract(jsonObject.getBigDecimal("amount")));
-                            JSONObject createCashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), entity, true);
-                            sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                            SQLList createCashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), entity, true);
+                            sqlList.addAll(createCashbillPay);
                             sa_cashbillidList.add(createCashbillPay.getLong("sa_cashbillid"));
                             sa_cashbillidList.add(createCashbillPay.getLong("sa_cashbillid"));
                         } else {
                         } else {
                             return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), jsonObject.getBigDecimal("amount")) + "元!").toString();
                             return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, jsonObject.getLong("sa_accountclassid"), jsonObject.getBigDecimal("amount")) + "元!").toString();
@@ -3267,8 +3259,8 @@ public class Order extends Controller {
                 } else {
                 } else {
                     if (Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount)) {
                     if (Accountbalance.judgeBalance(this, pay_enterpriseid, sa_accountclassid, amount)) {
                         CashbillEntity entity = getCashbillEntity(getDate_Str(), amount, sa_orderid, "订单审核", sonum, "由" + sonum + "订单审核时自动产生");
                         CashbillEntity entity = getCashbillEntity(getDate_Str(), amount, sa_orderid, "订单审核", sonum, "由" + sonum + "订单审核时自动产生");
-                        JSONObject cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true);
-                        sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                        SQLList cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true);
+                        sqlList.addAll(cashbillPay);
                         sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
                         sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
                     } else {
                     } else {
                         return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, sa_accountclassid, amount) + "元!").toString();
                         return getErrReturnObject().setErrMsg("账户余额不足,还差" + Accountbalance.InsufficientBalance(this, pay_enterpriseid, sa_accountclassid, amount) + "元!").toString();
@@ -3338,8 +3330,8 @@ public class Order extends Controller {
         String order_paymentnode = Parameter.getString(siteid, "order_paymentnode");
         String order_paymentnode = Parameter.getString(siteid, "order_paymentnode");
         Long sa_cashbillid = 0L;
         Long sa_cashbillid = 0L;
         if (order_paymentnode.equals("2")) {
         if (order_paymentnode.equals("2")) {
-            JSONObject jsonObject = returnPayBill(row, "订单反审核", sonum, "由" + sonum + "订单反审核时自动产生");
-            sqlList.addAll(jsonObject.getJSONArray("sqlList").toJavaList(String.class));
+            SQLList jsonObject = returnPayBill(row, "订单反审核", sonum, "由" + sonum + "订单反审核时自动产生");
+            sqlList.addAll(jsonObject);
             sa_cashbillid = jsonObject.getLong("sa_cashbillid");
             sa_cashbillid = jsonObject.getLong("sa_cashbillid");
         }
         }
 
 
@@ -3619,8 +3611,8 @@ public class Order extends Controller {
 //            CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, "订单退回", "由" + sonum + "订单退回时自动产生");
 //            CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, "订单退回", "由" + sonum + "订单退回时自动产生");
 //            sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true));
 //            sqlList.addAll(Accountbalance.createCashbillPay(this, pay_enterpriseid, sa_accountclassid, entity, true));
 //        }
 //        }
-        JSONObject jsonObject = returnPayBill(row, "订单退回", sonum, "由订单号" + sonum + "退回时生成");
-        sqlList.addAll(jsonObject.getJSONArray("sqlList").toJavaList(String.class));
+        SQLList jsonObject = returnPayBill(row, "订单退回", sonum, "由订单号" + sonum + "退回时生成");
+        sqlList.addAll(jsonObject);
         Long sa_cashbillid = jsonObject.getLong("sa_cashbillid");
         Long sa_cashbillid = jsonObject.getLong("sa_cashbillid");
 
 
         String message = "您的订单【" + sonum + "】已退回,退款金额为【" + amount + "】 已转入到您的资金账户";
         String message = "您的订单【" + sonum + "】已退回,退款金额为【" + amount + "】 已转入到您的资金账户";
@@ -3870,8 +3862,8 @@ public class Order extends Controller {
         String order_paymentnode = Parameter.getString(siteid, "order_paymentnode");
         String order_paymentnode = Parameter.getString(siteid, "order_paymentnode");
         Long sa_cashbillid = 0L;
         Long sa_cashbillid = 0L;
         if (order_paymentnode.equals("2")) {
         if (order_paymentnode.equals("2")) {
-            JSONObject jsonObject = returnPayBill(row, "订单_交期撤回", sonum, "由" + sonum + "订单交期撤回时自动产生");
-            sqlList.addAll(jsonObject.getJSONArray("sqlList").toJavaList(String.class));
+            SQLList jsonObject = returnPayBill(row, "订单_交期撤回", sonum, "由" + sonum + "订单交期撤回时自动产生");
+            sqlList.addAll(jsonObject);
             sa_cashbillid = jsonObject.getLong("sa_cashbillid");
             sa_cashbillid = jsonObject.getLong("sa_cashbillid");
         }
         }
 
 
@@ -3885,8 +3877,8 @@ public class Order extends Controller {
     }
     }
 
 
 
 
-    public JSONObject returnPayBill(Row orderrow, String source, String sourcenotes, String remarks) throws YosException {
-        JSONObject cashJsonObject = new JSONObject();
+    public SQLList returnPayBill(Row orderrow, String source, String sourcenotes, String remarks) throws YosException {
+
         Long sa_orderid = orderrow.getLong("sa_orderid");
         Long sa_orderid = orderrow.getLong("sa_orderid");
         JSONArray sa_accountclassinfos = orderrow.getJSONArray("sa_accountclassinfos");
         JSONArray sa_accountclassinfos = orderrow.getJSONArray("sa_accountclassinfos");
         //Long sa_accountclassid = orderrow.getLong("sa_accountclassid");
         //Long sa_accountclassid = orderrow.getLong("sa_accountclassid");
@@ -3927,17 +3919,16 @@ public class Order extends Controller {
                 }
                 }
                 if (amount.compareTo(BigDecimal.ZERO) > 0) {
                 if (amount.compareTo(BigDecimal.ZERO) > 0) {
                     CashbillEntity entity = getCashbillEntity(getDate_Str(), amount.negate(), sa_orderid, source, sourcenotes, remarks);
                     CashbillEntity entity = getCashbillEntity(getDate_Str(), amount.negate(), sa_orderid, source, sourcenotes, remarks);
-                    JSONObject cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, row.getLong("sa_accountclassid"), entity, true);
-                    sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
-                    cashJsonObject.put("sa_cashbillid", cashbillPay.getLongValue("sa_cashbillid"));
+                    SQLList cashbillPay = Accountbalance.createCashbillPay(this, pay_enterpriseid, row.getLong("sa_accountclassid"), entity, true);
+                    sqlList.addAll(cashbillPay);
+                    sqlList.put("sa_cashbillid", cashbillPay.getLong("sa_cashbillid"));
                 }
                 }
             }
             }
 
 
 
 
         }
         }
         sqlList.add("update sa_order set sa_accountclassinfos='" + sa_accountclassinfos + "' where sa_orderid=" + sa_orderid + " and siteid='" + siteid + "'");
         sqlList.add("update sa_order set sa_accountclassinfos='" + sa_accountclassinfos + "' where sa_orderid=" + sa_orderid + " and siteid='" + siteid + "'");
-        cashJsonObject.put("sqlList", sqlList);
-        return cashJsonObject;
+        return sqlList;
     }
     }
 
 
     /**
     /**
@@ -4903,8 +4894,8 @@ public class Order extends Controller {
                 entity.setRemarks("由订单号" + orderRow.get(0).getString("sonum") + "手工关闭时生成");
                 entity.setRemarks("由订单号" + orderRow.get(0).getString("sonum") + "手工关闭时生成");
                 entity.setType("普通费用");
                 entity.setType("普通费用");
                 entity.setTypemx("订单关闭退款");
                 entity.setTypemx("订单关闭退款");
-                JSONObject cashbillPay = Accountbalance.createCashbillPay2(this, sys_enterpriseid, orderaccountclassinfo.getLongValue("sa_accountclassid"), entity, true);
-                sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                SQLList cashbillPay = Accountbalance.createCashbillPay2(this, sys_enterpriseid, orderaccountclassinfo.getLongValue("sa_accountclassid"), entity, true);
+                sqlList.addAll(cashbillPay);
                 sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
                 sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
                 sqlList.add("update sa_promotion_auth set saledamount=saledamount-" + totalprice + " where sa_promotion_authid=" + sa_promotion_authid);
                 sqlList.add("update sa_promotion_auth set saledamount=saledamount-" + totalprice + " where sa_promotion_authid=" + sa_promotion_authid);
             } else if (amount_orderaccount.compareTo(totalprice) < 0) {
             } else if (amount_orderaccount.compareTo(totalprice) < 0) {
@@ -4918,8 +4909,8 @@ public class Order extends Controller {
                 entity.setRemarks("由" + orderRow.get(0).getString("sonum") + "订单手工关闭时自动产生");
                 entity.setRemarks("由" + orderRow.get(0).getString("sonum") + "订单手工关闭时自动产生");
                 entity.setType("普通费用");
                 entity.setType("普通费用");
                 entity.setTypemx("订单关闭退款");
                 entity.setTypemx("订单关闭退款");
-                JSONObject cashbillPay = Accountbalance.createCashbillPay2(this, sys_enterpriseid, orderaccountclassinfo.getLongValue("sa_accountclassid"), entity, true);
-                sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                SQLList cashbillPay = Accountbalance.createCashbillPay2(this, sys_enterpriseid, orderaccountclassinfo.getLongValue("sa_accountclassid"), entity, true);
+                sqlList.addAll(cashbillPay);
                 sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
                 sa_cashbillidList.add(cashbillPay.getLong("sa_cashbillid"));
 
 
                 sqlList.add("update sa_promotion_auth set saledamount=saledamount-" + amount_orderaccount + " where sa_promotion_authid=" + sa_promotion_authid);
                 sqlList.add("update sa_promotion_auth set saledamount=saledamount-" + amount_orderaccount + " where sa_promotion_authid=" + sa_promotion_authid);
@@ -4934,8 +4925,8 @@ public class Order extends Controller {
                 promotionentity.setRemarks("由" + orderRow.get(0).getString("sonum") + "订单手工关闭时自动产生");
                 promotionentity.setRemarks("由" + orderRow.get(0).getString("sonum") + "订单手工关闭时自动产生");
                 promotionentity.setType("普通费用");
                 promotionentity.setType("普通费用");
                 promotionentity.setTypemx("订单关闭退款");
                 promotionentity.setTypemx("订单关闭退款");
-                JSONObject cashbillPay1 = Accountbalance.createCashbillPay2(this, sys_enterpriseid, promotionaccountclassinfo.getLongValue("sa_accountclassid"), promotionentity, true);
-                sqlList.addAll(cashbillPay1.getJSONArray("sqlList").toJavaList(String.class));
+                SQLList cashbillPay1 = Accountbalance.createCashbillPay2(this, sys_enterpriseid, promotionaccountclassinfo.getLongValue("sa_accountclassid"), promotionentity, true);
+                sqlList.addAll(cashbillPay1);
                 sa_cashbillidList.add(cashbillPay1.getLong("sa_cashbillid"));
                 sa_cashbillidList.add(cashbillPay1.getLong("sa_cashbillid"));
             }
             }
 
 

+ 2 - 2
src/custom/restcontroller/webmanage/sale/order/OrderItemsHelper.java

@@ -172,8 +172,8 @@ public class OrderItemsHelper extends BaseClass {
             entity.setRemarks(orderRows.get(0).getString("sonum") + "订单自动返利");
             entity.setRemarks(orderRows.get(0).getString("sonum") + "订单自动返利");
             entity.setType("公司支持");
             entity.setType("公司支持");
             entity.setTypemx("装修返利");
             entity.setTypemx("装修返利");
-            JSONObject cashbillIncome = Accountbalance.createCashbillIncome(controller, sys_enterpriseid, sa_accountclassid, entity, true, true);
-            sqlList.addAll(cashbillIncome.getJSONArray("sqlList").toJavaList(String.class));
+            SQLList cashbillIncome = Accountbalance.createCashbillIncome(controller, sys_enterpriseid, sa_accountclassid, entity, true, true);
+            sqlList.addAll(cashbillIncome);
 
 
             dbConnect.runSqlUpdate(sqlList);
             dbConnect.runSqlUpdate(sqlList);
         }
         }

+ 2 - 2
src/custom/restcontroller/webmanage/sale/paybill/Paybill.java

@@ -274,9 +274,9 @@ public class Paybill extends Controller {
         for (Row row : accountclassRows) {
         for (Row row : accountclassRows) {
             BigDecimal amount = row.getBigDecimal("amount");
             BigDecimal amount = row.getBigDecimal("amount");
             CashbillEntity cashbillEntity = new CashbillEntity(amount, BigDecimal.ZERO, remarks, "打款凭证", billno, "sa_paybill", sa_paybillid, "货款", "");
             CashbillEntity cashbillEntity = new CashbillEntity(amount, BigDecimal.ZERO, remarks, "打款凭证", billno, "sa_paybill", sa_paybillid, "货款", "");
-            JSONObject cashbillIncome = Accountbalance.createCashbillIncome(this, sys_enterpriseid, row.getLong("sa_accountclassid"), cashbillEntity, false, true);
+            SQLList cashbillIncome = Accountbalance.createCashbillIncome(this, sys_enterpriseid, row.getLong("sa_accountclassid"), cashbillEntity, false, true);
             sqlList = new SQLList();
             sqlList = new SQLList();
-            sqlList.addAll(cashbillIncome.getJSONArray("sqlList").toJavaList(String.class));
+            sqlList.addAll(cashbillIncome);
             Long sa_cashbillid = cashbillIncome.getLong("sa_cashbillid");
             Long sa_cashbillid = cashbillIncome.getLong("sa_cashbillid");
             dbConnect.runSqlUpdate(sqlList);
             dbConnect.runSqlUpdate(sqlList);
 
 

+ 3 - 3
src/custom/restcontroller/webmanage/sale/promotion/promotion.java

@@ -807,9 +807,9 @@ public class promotion extends Controller {
                 entity.setSource("返利");
                 entity.setSource("返利");
                 entity.setSourcenote("经销商【" + agentnum + "】,【" + promotionauthRows.get(0).getString("promname") + "】方案返利促销");
                 entity.setSourcenote("经销商【" + agentnum + "】,【" + promotionauthRows.get(0).getString("promname") + "】方案返利促销");
                 entity.setRemarks("由活动单号" + promotionauthRows.get(0).getString("promnum") + "结算时生成");
                 entity.setRemarks("由活动单号" + promotionauthRows.get(0).getString("promnum") + "结算时生成");
-                JSONObject cashbillIncome = Accountbalance.createCashbillIncome(this, sys_enterpriseid, sa_accountclassid, entity, true, true);
-                sqlList.addAll(cashbillIncome.getJSONArray("sqlList").toJavaList(String.class));
-                sa_cashbillid = cashbillIncome.getLong("sa_cashbillid");
+                SQLList cashbillIncome = Accountbalance.createCashbillIncome(this, sys_enterpriseid, sa_accountclassid, entity, true, true);
+                sqlList.addAll(cashbillIncome);
+                sa_cashbillid = (Long) cashbillIncome.getLong("sa_cashbillid");
                 sendRemind = true;
                 sendRemind = true;
                 sqlList.add("update sa_promotion_auth set settlestatus=1 where sa_promotion_authid=" + sa_promotion_authid + " and siteid='" + siteid + "'");
                 sqlList.add("update sa_promotion_auth set settlestatus=1 where sa_promotion_authid=" + sa_promotion_authid + " and siteid='" + siteid + "'");
             }
             }

+ 7 - 6
src/custom/restcontroller/webmanage/sale/rebateaccount/rebateaccounthead.java

@@ -14,6 +14,7 @@ import common.annotation.API;
 import common.annotation.CACHEING;
 import common.annotation.CACHEING;
 import common.annotation.CACHEING_CLEAN;
 import common.annotation.CACHEING_CLEAN;
 import common.data.*;
 import common.data.*;
+import common.data.db.SQL;
 import common.data.db.SQLList;
 import common.data.db.SQLList;
 import restcontroller.R;
 import restcontroller.R;
 
 
@@ -498,9 +499,9 @@ public class rebateaccounthead extends Controller {
                     entity.setSource("返利");
                     entity.setSource("返利");
                     entity.setSourcenote(rows.get(0).getString("billno") + "结算单返利");
                     entity.setSourcenote(rows.get(0).getString("billno") + "结算单返利");
                     entity.setRemarks(rows.get(0).getString("billno") + "结算单装修补贴返利");
                     entity.setRemarks(rows.get(0).getString("billno") + "结算单装修补贴返利");
-                    JSONObject cashbillIncome = Accountbalance.createCashbillIncome(this, row.getLong("sys_enterpriseid"), sa_accountclassid, entity, true, true);
-                    sqlList.addAll(cashbillIncome.getJSONArray("sqlList").toJavaList(String.class));
-                    sa_cashbillidList.add(cashbillIncome.getLong("sa_cashbillid"));
+                    SQLList cashbillIncome = Accountbalance.createCashbillIncome(this, row.getLong("sys_enterpriseid"), sa_accountclassid, entity, true, true);
+                    sqlList.addAll(cashbillIncome);
+                    sa_cashbillidList.add((Long) cashbillIncome.getLong("sa_cashbillid"));
                     sqlList.addAll(Accountbalance.rebateupdate(this, row.getLong("sys_enterpriseid"), true, row.getBigDecimal("approvedamount")));
                     sqlList.addAll(Accountbalance.rebateupdate(this, row.getLong("sys_enterpriseid"), true, row.getBigDecimal("approvedamount")));
                 }
                 }
 
 
@@ -516,9 +517,9 @@ public class rebateaccounthead extends Controller {
                     entity.setSource("返利");
                     entity.setSource("返利");
                     entity.setSourcenote(rows.get(0).getString("billno") + "结算单反审核");
                     entity.setSourcenote(rows.get(0).getString("billno") + "结算单反审核");
                     entity.setRemarks("装修补贴返利反审核生成");
                     entity.setRemarks("装修补贴返利反审核生成");
-                    JSONObject cashbillIncome = Accountbalance.createCashbillIncome(this, row.getLong("sys_enterpriseid"), sa_accountclassid, entity, true, true);
-                    sqlList.addAll(cashbillIncome.getJSONArray("sqlList").toJavaList(String.class));
-                    sa_cashbillidList.add(cashbillIncome.getLong("sa_cashbillid"));
+                    SQLList cashbillIncome = Accountbalance.createCashbillIncome(this, row.getLong("sys_enterpriseid"), sa_accountclassid, entity, true, true);
+                    sqlList.addAll(cashbillIncome);
+                    sa_cashbillidList.add((Long) cashbillIncome.getLong("sa_cashbillid"));
                     sqlList.addAll(Accountbalance.rebateupdate(this, row.getLong("sys_enterpriseid"), false, row.getBigDecimal("approvedamount")));
                     sqlList.addAll(Accountbalance.rebateupdate(this, row.getLong("sys_enterpriseid"), false, row.getBigDecimal("approvedamount")));
                 }
                 }
 
 

+ 6 - 6
src/custom/restcontroller/webmanage/sale/sendrepair/sendrepair.java

@@ -668,8 +668,8 @@ public class sendrepair extends Controller {
                     cashbillEntity.setRemarks("该单由送修单" + row.getString("billno") + "审核时自动生成");
                     cashbillEntity.setRemarks("该单由送修单" + row.getString("billno") + "审核时自动生成");
                     cashbillEntity.setSource("送修单审核");
                     cashbillEntity.setSource("送修单审核");
                     cashbillEntity.setType("维修费");
                     cashbillEntity.setType("维修费");
-                    JSONObject cashbillPay = Accountbalance.createCashbillPay(this, row.getLong("sys_enterpriseid"), sa_accountclassid, cashbillEntity, true);
-                    sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                    SQLList cashbillPay = Accountbalance.createCashbillPay(this, row.getLong("sys_enterpriseid"), sa_accountclassid, cashbillEntity, true);
+                    sqlList.addAll(cashbillPay);
                     sqlList.add("update sa_sendrepair_detail set practicalamount=ifnull(practicalamount,0)+" + totalamount + " where sa_sendrepairid=" + sa_sendrepairid);
                     sqlList.add("update sa_sendrepair_detail set practicalamount=ifnull(practicalamount,0)+" + totalamount + " where sa_sendrepairid=" + sa_sendrepairid);
 
 
                 } else {
                 } else {
@@ -681,8 +681,8 @@ public class sendrepair extends Controller {
                     cashbillEntity.setRemarks("该单由送修单" + row.getString("billno") + "反审核时自动生成");
                     cashbillEntity.setRemarks("该单由送修单" + row.getString("billno") + "反审核时自动生成");
                     cashbillEntity.setSource("送修单反审核");
                     cashbillEntity.setSource("送修单反审核");
                     cashbillEntity.setType("维修费");
                     cashbillEntity.setType("维修费");
-                    JSONObject cashbillPay = Accountbalance.createCashbillPay(this, row.getLong("sys_enterpriseid"), sa_accountclassid, cashbillEntity, true);
-                    sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                    SQLList cashbillPay = Accountbalance.createCashbillPay(this, row.getLong("sys_enterpriseid"), sa_accountclassid, cashbillEntity, true);
+                    sqlList.addAll(cashbillPay);
                     sqlList.add("update sa_sendrepair_detail set practicalamount=ifnull(practicalamount,0)-" + totalamount + " where sa_sendrepairid=" + sa_sendrepairid);
                     sqlList.add("update sa_sendrepair_detail set practicalamount=ifnull(practicalamount,0)-" + totalamount + " where sa_sendrepairid=" + sa_sendrepairid);
                 }
                 }
             }
             }
@@ -790,8 +790,8 @@ public class sendrepair extends Controller {
                 cashbillEntity.setRemarks("该单由送修单" + row.getString("billno") + (ischeck ? "审核" : "反审核") + "时自动生成");
                 cashbillEntity.setRemarks("该单由送修单" + row.getString("billno") + (ischeck ? "审核" : "反审核") + "时自动生成");
                 cashbillEntity.setSource("送修单" + (ischeck ? "审核" : "反审核"));
                 cashbillEntity.setSource("送修单" + (ischeck ? "审核" : "反审核"));
                 cashbillEntity.setType("整机退款");
                 cashbillEntity.setType("整机退款");
-                JSONObject cashbillPay = Accountbalance.createCashbillPay(this, row.getLong("sys_enterpriseid"), sa_accountclassid, cashbillEntity, true);
-                sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+                SQLList cashbillPay = Accountbalance.createCashbillPay(this, row.getLong("sys_enterpriseid"), sa_accountclassid, cashbillEntity, true);
+                sqlList.addAll(cashbillPay);
             }
             }
             /*********** 售后开始 ************/
             /*********** 售后开始 ************/
             Rows zprkrows = dbConnect.runSqlQuery("select t2.* from st_stockbill t1 inner join st_stockbill_items t2 on t1.st_stockbillid=t2.st_stockbillid and t1.siteid=t2.siteid " +
             Rows zprkrows = dbConnect.runSqlQuery("select t2.* from st_stockbill t1 inner join st_stockbill_items t2 on t1.st_stockbillid=t2.st_stockbillid and t1.siteid=t2.siteid " +

+ 2 - 2
src/custom/restcontroller/webmanage/sale/toolbill/ToolBill.java

@@ -669,8 +669,8 @@ public class ToolBill extends Controller {
 
 
         BigDecimal amount = getAmount(sa_orderid);
         BigDecimal amount = getAmount(sa_orderid);
         CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, "押金收入凭证", "由" + sonum + "工具借用反单审核时自动产生");
         CashbillEntity entity = getCashbillEntity(amount.negate(), sa_orderid, "押金收入凭证", "由" + sonum + "工具借用反单审核时自动产生");
-        JSONObject cashbillIncome = Accountbalance.createCashbillIncome(this, pay_enterpriseid, sa_accountclassid, entity, true, false);
-        sqlList.addAll(cashbillIncome.getJSONArray("sqlList").toJavaList(String.class));
+        SQLList cashbillIncome = Accountbalance.createCashbillIncome(this, pay_enterpriseid, sa_accountclassid, entity, true, false);
+        sqlList.addAll(cashbillIncome);
         Long sa_cashbillid = cashbillIncome.getLong("sa_cashbillid");
         Long sa_cashbillid = cashbillIncome.getLong("sa_cashbillid");
 
 
         //操作记录
         //操作记录

+ 6 - 6
src/custom/restcontroller/webmanage/sale/transferbill/Transferbill.java

@@ -129,15 +129,15 @@ public class Transferbill extends Controller {
         CashbillEntity cashbillEntity = new CashbillEntity(amount.negate(),BigDecimal.ZERO, "", "转账单", rows.get(0).getString("billno"), "sa_transferbill", sa_transferbillid, "货款", "");
         CashbillEntity cashbillEntity = new CashbillEntity(amount.negate(),BigDecimal.ZERO, "", "转账单", rows.get(0).getString("billno"), "sa_transferbill", sa_transferbillid, "货款", "");
         cashbillEntity.setPeriod(rows.get(0).getString("billno"));
         cashbillEntity.setPeriod(rows.get(0).getString("billno"));
 
 
-        JSONObject cashbillIncome = Accountbalance.createCashbillIncome(this, sys_enterpriseid, sa_accountclassid, cashbillEntity, true, false);
-        sqlList.addAll(cashbillIncome.getJSONArray("sqlList").toJavaList(String.class));
-        sa_cashbillidList.add(cashbillIncome.getLong("sa_cashbillid"));
+        SQLList cashbillIncome = Accountbalance.createCashbillIncome(this, sys_enterpriseid, sa_accountclassid, cashbillEntity, true, false);
+        sqlList.addAll(cashbillIncome);
+        sa_cashbillidList.add((Long) cashbillIncome.getLong("sa_cashbillid"));
 
 
         cashbillEntity.setAmount(amount);
         cashbillEntity.setAmount(amount);
         cashbillEntity.setDiscountamountamount(BigDecimal.ZERO);
         cashbillEntity.setDiscountamountamount(BigDecimal.ZERO);
-        JSONObject cashbillIncome1 = Accountbalance.createCashbillIncome(this, sys_enterpriseid, inaccountclassid, cashbillEntity, true, false);
-        sqlList.addAll(cashbillIncome1.getJSONArray("sqlList").toJavaList(String.class));
-        sa_cashbillidList.add(cashbillIncome1.getLong("sa_cashbillid"));
+        SQLList cashbillIncome1 = Accountbalance.createCashbillIncome(this, sys_enterpriseid, inaccountclassid, cashbillEntity, true, false);
+        sqlList.addAll(cashbillIncome1);
+        sa_cashbillidList.add((Long) cashbillIncome1.getLong("sa_cashbillid"));
         dbConnect.runSqlUpdate(sqlList);
         dbConnect.runSqlUpdate(sqlList);
 
 
         String billdate = rows.get(0).getString("billdate");
         String billdate = rows.get(0).getString("billdate");