|
|
@@ -65,6 +65,7 @@ public class OrderFeeCalculatePlan1 extends DataFunction {
|
|
|
|
|
|
for (Row dfRow : dfRows) {
|
|
|
String sys_datafunctionid = dfRow.getString("sys_datafunctionid");
|
|
|
+ System.err.println(sys_datafunctionid);
|
|
|
Rows itemRows = itemRowsMap.getOrDefault(sys_datafunctionid, new Rows());
|
|
|
if (itemRows.isEmpty()) {
|
|
|
continue;
|
|
|
@@ -147,7 +148,8 @@ public class OrderFeeCalculatePlan1 extends DataFunction {
|
|
|
// System.err.println(sqlList);
|
|
|
dbConnect.runSqlUpdate(sqlList);
|
|
|
//调整最后一行数据
|
|
|
- adjustLastData(itemRows, totalprice);
|
|
|
+ System.err.println(sqlList);
|
|
|
+ adjustLastData(itemRows, totalprice,sys_datafunctionid);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -206,7 +208,7 @@ public class OrderFeeCalculatePlan1 extends DataFunction {
|
|
|
}
|
|
|
|
|
|
//调整第一行数据
|
|
|
- public void adjustLastData(Rows itemRows, BigDecimal totalprice) throws YosException {
|
|
|
+ public void adjustLastData(Rows itemRows, BigDecimal totalprice,String sys_datafunctionid) throws YosException {
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "统计订单明细费用");
|
|
|
sqlFactory.addParameter_in("sa_orderitemsid", itemRows.toArray("sa_orderitemsid"));
|
|
|
Rows costamountrows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -215,12 +217,12 @@ public class OrderFeeCalculatePlan1 extends DataFunction {
|
|
|
Long sa_orderitemsid = itemRows.get(0).getLong("sa_orderitemsid");
|
|
|
if (costamount.compareTo(totalprice) > 0) {
|
|
|
BigDecimal temp = costamount.subtract(totalprice);
|
|
|
- String sql = "UPDATE sa_order_cost SET costamount=costamount-" + temp + " WHERE sa_orderitemsid= " + sa_orderitemsid;
|
|
|
+ String sql = "UPDATE sa_order_cost SET costamount=costamount-" + temp + " WHERE sa_orderitemsid= " + sa_orderitemsid +" and sys_datafunctionid="+sys_datafunctionid;
|
|
|
dbConnect.runSqlUpdate(sql);
|
|
|
}
|
|
|
if (costamount.compareTo(totalprice) < 0) {
|
|
|
BigDecimal temp = totalprice.subtract(costamount);
|
|
|
- String sql = "UPDATE sa_order_cost SET costamount=costamount+" + temp + " WHERE sa_orderitemsid= " + sa_orderitemsid;
|
|
|
+ String sql = "UPDATE sa_order_cost SET costamount=costamount+" + temp + " WHERE sa_orderitemsid= " + sa_orderitemsid+" and sys_datafunctionid="+sys_datafunctionid;
|
|
|
dbConnect.runSqlUpdate(sql);
|
|
|
}
|
|
|
}
|
|
|
@@ -237,7 +239,7 @@ public class OrderFeeCalculatePlan1 extends DataFunction {
|
|
|
insertSQL.setValue("sys_datafunctionid", row.getLong("sys_datafunctionid"));
|
|
|
insertSQL.setValue("functionname", functionname);
|
|
|
insertSQL.setValue("costamount", costamount);
|
|
|
-
|
|
|
+ System.err.println(insertSQL.getSQL());
|
|
|
return insertSQL;
|
|
|
}
|
|
|
|