|
@@ -15,6 +15,7 @@ import restcontroller.R;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.ListIterator;
|
|
|
|
|
|
public class promotion extends Controller {
|
|
|
|
|
@@ -59,6 +60,22 @@ public class promotion extends Controller {
|
|
|
sqlFactory2.addParameter("sys_enterpriseid", sys_enterpriseid);
|
|
|
Rows openPromotionsRows = dbConnect.runSqlQuery(sqlFactory2.getSQL());
|
|
|
RowsMap openPromotionsRowsMap = openPromotionsRows.toRowsMap("sa_promotionid");
|
|
|
+
|
|
|
+ ListIterator<Row> iterator = rows.listIterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ Row row = iterator.next();
|
|
|
+ if(row.getLong("sa_openpromotionid")!=0){
|
|
|
+ if(sumAmountRowsMap.containsKey(row.getString("sa_promotionid"))){
|
|
|
+ BigDecimal sumamount = sumAmountRowsMap.get(row.getString("sa_promotionid")).get(0).getBigDecimal("sumamount");
|
|
|
+ if(sumamount.compareTo(row.getBigDecimal("openamount"))>=0){
|
|
|
+ if(openPromotionsRowsMap.containsKey(row.getString("sa_openpromotionid"))){
|
|
|
+ iterator.add(openPromotionsRowsMap.get(row.getString("sa_openpromotionid")).get(0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for (Row row : rows) {
|
|
|
if ((attRowsMap.getOrDefault(row.getString("sa_promotionid"), new Rows())).isEmpty()) {
|
|
|
row.put("attinfos", defaultImageRows);
|
|
@@ -70,16 +87,16 @@ public class promotion extends Controller {
|
|
|
} else {
|
|
|
row.put("tradefield", new JSONArray());
|
|
|
}
|
|
|
- if(row.getLong("sa_openpromotionid")!=0){
|
|
|
- if(sumAmountRowsMap.containsKey(row.getString("sa_promotionid"))){
|
|
|
- BigDecimal sumamount = sumAmountRowsMap.get(row.getString("sa_promotionid")).get(0).getBigDecimal("sumamount");
|
|
|
- if(sumamount.compareTo(row.getBigDecimal("openamount"))>=0){
|
|
|
- if(openPromotionsRowsMap.containsKey(row.getString("sa_openpromotionid"))){
|
|
|
- rows.add(openPromotionsRowsMap.get(row.getString("sa_openpromotionid")).get(0));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// if(row.getLong("sa_openpromotionid")!=0){
|
|
|
+// if(sumAmountRowsMap.containsKey(row.getString("sa_promotionid"))){
|
|
|
+// BigDecimal sumamount = sumAmountRowsMap.get(row.getString("sa_promotionid")).get(0).getBigDecimal("sumamount");
|
|
|
+// if(sumamount.compareTo(row.getBigDecimal("openamount"))>=0){
|
|
|
+// if(openPromotionsRowsMap.containsKey(row.getString("sa_openpromotionid"))){
|
|
|
+// rows.add(openPromotionsRowsMap.get(row.getString("sa_openpromotionid")).get(0));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
|