Parcourir la source

促销方案列表领域字段改为jsonarray

hu il y a 3 ans
Parent
commit
7a586bea87
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  1. 7 0
      src/custom/restcontroller/sale/promotion/promotion.java

+ 7 - 0
src/custom/restcontroller/sale/promotion/promotion.java

@@ -1,5 +1,6 @@
 package restcontroller.sale.promotion;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import common.Controller;
 import common.YosException;
@@ -9,6 +10,7 @@ import common.data.Row;
 import common.data.Rows;
 import common.data.RowsMap;
 import common.data.SQLFactory;
+import org.apache.commons.lang.StringUtils;
 import restcontroller.R;
 
 import java.math.BigDecimal;
@@ -56,6 +58,11 @@ public class promotion extends Controller {
         RowsMap openPromotionsRowsMap = openPromotionsRows.toRowsMap("sa_promotionid");
         for (Row row : rows) {
             row.put("attinfos", attRowsMap.getOrDefault(row.getString("sa_promotionid"), new Rows()));
+            if (!StringUtils.isBlank(row.getString("tradefield"))) {
+                row.put("tradefield", JSONArray.parseArray(row.getString("tradefield")));
+            } 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");