|
|
@@ -6,16 +6,15 @@ import beans.enterprise.Enterprise;
|
|
|
import beans.itemclass.ItemClass;
|
|
|
import beans.itemgroup.Itemgroup;
|
|
|
import beans.itemprice.ItemPrice;
|
|
|
+import beans.parameter.Parameter;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-
|
|
|
import common.Controller;
|
|
|
import common.YosException;
|
|
|
import common.annotation.API;
|
|
|
import common.annotation.CACHEING;
|
|
|
import common.data.*;
|
|
|
-
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import restcontroller.R;
|
|
|
import restcontroller.sale.promotion.promotion;
|
|
|
@@ -53,55 +52,36 @@ public class itemgroup extends Controller {
|
|
|
@API(title = "查询", apiversion = R.ID20220926142203.v1.class)
|
|
|
@CACHEING
|
|
|
public String queryItemgroup() throws YosException {
|
|
|
- long ismodule = content.getLongValue("ismodule");
|
|
|
if (content.containsKey("sys_enterpriseid")) {
|
|
|
sys_enterpriseid = content.getLongValue("sys_enterpriseid");
|
|
|
}
|
|
|
- /*
|
|
|
- * * 过滤条件设置
|
|
|
- */
|
|
|
- String where = " 1=1 ";
|
|
|
- String where1 = "";
|
|
|
- String itemclasssql = "select itemclassid from plm_itemclass where siteid='" + siteid + "'";
|
|
|
+
|
|
|
+ double pricegrade = Parameter.getInteger(siteid, "defaultlevelprice");//价格等级
|
|
|
+ boolean saleclassauth = false;//是否需要经营授权
|
|
|
if (sys_enterpriseid > 0) {
|
|
|
Row enterpriseRow = Enterprise.getEnterprise(this, sys_enterpriseid);
|
|
|
if (!enterpriseRow.isEmpty()) {
|
|
|
- //企业营销类别
|
|
|
- boolean saleclassauth = enterpriseRow.getBoolean("saleclassauth");
|
|
|
- if (saleclassauth) {
|
|
|
- itemclasssql = "select itemclassid from plm_itemclass where siteid='" + siteid + "' and itemclassid in ( SELECT itemclassid from sys_enterprise_saleclass WHERE sys_enterpriseid = " + sys_enterpriseid + " and siteid='" + siteid + "')";
|
|
|
- }
|
|
|
- //企业领域
|
|
|
- Rows tradefieldrows = dbConnect.runSqlQuery("SELECT tradefield from sys_enterprise_tradefield WHERE sys_enterpriseid =" + sys_enterpriseid + " and siteid ='" + siteid + "'");
|
|
|
- if (!tradefieldrows.isEmpty()) {
|
|
|
- for (Row row : tradefieldrows) {
|
|
|
- where1 = where1 + " (t1.tradefield like'%" + row.getString("tradefield") + "%') or ";
|
|
|
- }
|
|
|
- } else {
|
|
|
- where1 = where1 + " 1=2 ";
|
|
|
- }
|
|
|
- } else {
|
|
|
- where1 = " 1=2 ";
|
|
|
+ saleclassauth = enterpriseRow.getBoolean("saleclassauth");
|
|
|
}
|
|
|
|
|
|
- } else {
|
|
|
- where1 = " 1=1 ";
|
|
|
- }
|
|
|
- if (where1.contains("or")) {
|
|
|
- where1 = where1.substring(0, where1.lastIndexOf("or"));
|
|
|
+ Enterprise.EnterpriseGrade enterpriseGrade = Enterprise.getEnterpriseGrade(this, sys_enterpriseid);
|
|
|
+ if (enterpriseGrade != null) {
|
|
|
+ pricegrade = enterpriseGrade.getPricegrade();
|
|
|
+ }
|
|
|
}
|
|
|
- Rows itemclassRows = dbConnect.runSqlQuery(itemclasssql);
|
|
|
+ pricegrade = pricegrade <= 0 ? 1 : pricegrade;
|
|
|
|
|
|
- ArrayList<Long> itemclassList = new ArrayList<Long>();
|
|
|
- for (Row row : itemclassRows) {
|
|
|
- //System.out.println(row.getLong("itemclassid"));
|
|
|
- itemclassList.add(row.getLong("itemclassid"));
|
|
|
- itemclassList.addAll(ItemClass.getSubItemClassIds(this, row.getLong("itemclassid")));
|
|
|
- }
|
|
|
|
|
|
- SQLFactory factorygroupid = new SQLFactory(this, "查询授权范围内的商品组商品");
|
|
|
- factorygroupid.addParameter("siteid", siteid);
|
|
|
+ ArrayList<Long> itemclassList = new ArrayList<Long>();//授权的商品类别,包含下级商品类别,如果不需要授权则为空
|
|
|
+ if (saleclassauth) {
|
|
|
+ Rows itemclassRows = dbConnect.runSqlQuery("SELECT itemclassid from sys_enterprise_saleclass WHERE sys_enterpriseid = " + sys_enterpriseid + " and siteid='" + siteid + "'");
|
|
|
+ ArrayList<Long> auth_itemclassList = itemclassRows.toArrayList("itemclassid", new ArrayList<>());
|
|
|
+
|
|
|
+ itemclassList.addAll(auth_itemclassList);
|
|
|
+ itemclassList.addAll(ItemClass.getSubItemClassIds(this, auth_itemclassList));
|
|
|
+ }
|
|
|
|
|
|
+ String where = " 1=1 ";
|
|
|
if (content.containsKey("where")) {
|
|
|
JSONObject whereObject = content.getJSONObject("where");
|
|
|
|
|
|
@@ -119,152 +99,79 @@ public class itemgroup extends Controller {
|
|
|
if (whereObject.containsKey("tradefield") && !"".equals(whereObject.getString("tradefield"))) {
|
|
|
where = where + " and (t1.tradefield like'%" + whereObject.getString("tradefield") + "%') ";
|
|
|
}
|
|
|
-// else {
|
|
|
-// if (sys_enterpriseid > 0) {
|
|
|
-// where = where + " and (t1.tradefield in (SELECT tradefield from sys_enterprise_tradefield WHERE sys_enterpriseid = " + sys_enterpriseid + " and siteid='" + siteid + "') ) ";
|
|
|
-// }
|
|
|
-// }
|
|
|
if (whereObject.containsKey("standards") && !"".equals(whereObject.getString("standards"))) {
|
|
|
where = where
|
|
|
+ " and exists(select 1 from sa_itemgroupmx s1 left join plm_item s2 on s1.itemid=s2.itemid and s1.siteid=s2.siteid where s2.standards='"
|
|
|
+ whereObject.getString("standards") + "' and s1.sa_itemgroupid=t1.sa_itemgroupid) ";
|
|
|
}
|
|
|
if (whereObject.containsKey("itemclassid") && !"".equals(whereObject.getString("itemclassid"))) {
|
|
|
-
|
|
|
- ArrayList<Long> list = ItemClass.getSubItemClassIds(this, whereObject.getLong("itemclassid"));
|
|
|
- list.add(whereObject.getLong("itemclassid"));
|
|
|
- ArrayList<Long> listNew = new ArrayList<>();
|
|
|
- listNew.add((long) 0);
|
|
|
- for (long itemclassid : list) {
|
|
|
- if (itemclassList.contains(itemclassid)) {
|
|
|
- listNew.add(itemclassid);
|
|
|
- }
|
|
|
+ long itemclassid = whereObject.getLong("itemclassid");
|
|
|
+ ArrayList<Long> list = ItemClass.getSubItemClassIds(this, itemclassid);
|
|
|
+ list.add(itemclassid);
|
|
|
+ if (saleclassauth) {//如果需要授权,则只显示授权范围内的商品类别
|
|
|
+ itemclassList.removeIf(id -> !list.contains(id));
|
|
|
+ } else {//如果不需要授权,则显示所有指定的商品类别
|
|
|
+ itemclassList = list;
|
|
|
}
|
|
|
-
|
|
|
- factorygroupid.addParameter_in("itemclassid", listNew);
|
|
|
-
|
|
|
- } else {
|
|
|
- factorygroupid.addParameter_in("itemclassid",
|
|
|
- itemclassList);
|
|
|
}
|
|
|
- } else {
|
|
|
- factorygroupid.addParameter_in("itemclassid",
|
|
|
- itemclassList);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //品牌过滤
|
|
|
JSONArray brandids = content.getJSONArray("brandids");
|
|
|
if (brandids.isEmpty()) {
|
|
|
- Rows rows;
|
|
|
if (sys_enterpriseid > 0) {
|
|
|
- rows = Enterprise.getBrands(this, sys_enterpriseid);
|
|
|
- } else {
|
|
|
- rows = dbConnect.runSqlQuery("select sa_brandid from sa_brand where siteid='" + siteid + "'");
|
|
|
- }
|
|
|
- if (!rows.isEmpty()) {
|
|
|
- for (Row row : rows) {
|
|
|
- brandids.add(row.getLong("sa_brandid"));
|
|
|
- }
|
|
|
+ brandids = Enterprise.getBrands(this, sys_enterpriseid).toJsonArray("sa_brandid");
|
|
|
} else {
|
|
|
- brandids.add(0);
|
|
|
+ brandids = dbConnect.runSqlQuery("select sa_brandid from sa_brand where siteid='" + siteid + "'").toJsonArray("sa_brandid");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- factorygroupid.addParameter("siteid", siteid);
|
|
|
- Enterprise.EnterpriseGrade enterpriseGrade = Enterprise.getEnterpriseGrade(this, sys_enterpriseid);
|
|
|
- if (enterpriseGrade != null) {
|
|
|
- factorygroupid.addParameter("pricegrade", enterpriseGrade.getPricegrade());
|
|
|
- }else {
|
|
|
- Rows siteParameterRows =dbConnect.runSqlQuery("select defaultlevelprice from sys_site_parameter where siteid='"+siteid+"'");
|
|
|
- if(!siteParameterRows.isEmpty()){
|
|
|
- if(StringUtils.isBlank(siteParameterRows.get(0).getString("defaultlevelprice"))){
|
|
|
- factorygroupid.addParameter("pricegrade", "1");
|
|
|
- }else{
|
|
|
- factorygroupid.addParameter("pricegrade", siteParameterRows.get(0).getString("defaultlevelprice"));
|
|
|
- }
|
|
|
- }else{
|
|
|
- factorygroupid.addParameter("pricegrade", "1");
|
|
|
- }
|
|
|
- }
|
|
|
- Rows rowsgroupids = dbConnect.runSqlQuery(factorygroupid.getSQL());
|
|
|
- RowsMap itemgroupRowMap = rowsgroupids.toRowsMap("sa_itemgroupid");
|
|
|
/*
|
|
|
* SQL查询参数设置并查询
|
|
|
*/
|
|
|
-// SQLFactory factory = new SQLFactory(this, "商品组列表查询", pageSize, pageNumber, pageSorting);
|
|
|
-// factory.addParameter("siteid", siteid);
|
|
|
-// factory.addParameter_in("sa_brandid", brandids.toArray());
|
|
|
-// factory.addParameter_in("sa_itemgroupids", rowsgroupids.toArrayList("sa_itemgroupid", new ArrayList<Long>()));
|
|
|
-// factory.addParameter_SQL("where", where);
|
|
|
-// factory.addParameter_SQL("where1", where1);
|
|
|
-// String sql = factory.getSQL();
|
|
|
-// //System.out.println(sql);
|
|
|
-// Rows rows = dbConnect.runSqlQuery(sql);
|
|
|
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_itemgroup", "sa_itemgroupid","sa_brandid", "ispriorityshow",
|
|
|
- "istopping","changeby","createby","changedate","createdate","groupnum","itemno","groupname","tradefield","isonsale");
|
|
|
- querySQL.setTableAlias("t1");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "plm_item", "t2", "t1.itemno = t2.itemno AND t1.siteid = t2.siteid","itemid");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "sa_brand", "t3", "t3.sa_brandid = t1.sa_brandid AND t3.siteid = t1.siteid","brandname");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "plm_unit", "t6", "t6.unitid = t2.unitid AND t6.siteid = t2.siteid","unitname");
|
|
|
- querySQL.setSiteid(siteid);
|
|
|
- querySQL.setWhere("t1.isonsale=1");
|
|
|
- querySQL.setWhere("t2.ismodule="+ismodule);
|
|
|
- querySQL.setWhere("t1.sa_itemgroupid",rowsgroupids.toArrayList("sa_itemgroupid", new ArrayList<Long>()));
|
|
|
- querySQL.setWhere("t1.sa_brandid",brandids.toArray());
|
|
|
- querySQL.setWhere(where);
|
|
|
- querySQL.setWhere(where1);
|
|
|
- querySQL.setPage(pageSize, pageNumber);
|
|
|
- querySQL.setOrderBy(pageSorting);
|
|
|
- Rows rows = querySQL.query();
|
|
|
- ArrayList<Long> itemgroupids = rows.toArrayList("sa_itemgroupid", new ArrayList<>());
|
|
|
- RowsMap itemgroupScemeRowsMap = Itemgroup.getItemgroupScemeid(this, itemgroupids);
|
|
|
-
|
|
|
- for (Row row2 : rows) {
|
|
|
- long sa_itemgroupid = row2.getLong("sa_itemgroupid");
|
|
|
- ArrayList<String> list = DataTag.queryTag(this, "sa_itemgroup", sa_itemgroupid, false);
|
|
|
- row2.put("tag1", JSONArray.parseArray(JSON.toJSONString(list)));
|
|
|
-// HashMap<Long, ItemPrice> ItemPriceList = ItemPrice.getItemGroupPrice(this, sys_enterpriseid,
|
|
|
-// row2.getLong("sa_itemgroupid"));
|
|
|
-// BigDecimal max = new BigDecimal(0);
|
|
|
-// BigDecimal min = ((ItemPrice) ItemPriceList.values().toArray()[0]).getPrice();
|
|
|
-// for (ItemPrice itemPrice : ItemPriceList.values()) {
|
|
|
-// BigDecimal itemprice = itemPrice.getPrice();
|
|
|
-// if (itemprice.compareTo(max) >0) {
|
|
|
-// max = itemprice;
|
|
|
-// }
|
|
|
-// if (itemprice.compareTo(min) <0) {
|
|
|
-// min = itemprice;
|
|
|
-// }
|
|
|
-// }
|
|
|
- Rows rows1 = itemgroupRowMap.get(String.valueOf(sa_itemgroupid));
|
|
|
- if (rows1.isEmpty()) {
|
|
|
- row2.put("maxprice", 0);
|
|
|
- row2.put("minprice", 0);
|
|
|
- } else {
|
|
|
- row2.put("maxprice", rows1.get(0).getBigDecimal("maxprice"));
|
|
|
- row2.put("minprice", rows1.get(0).getBigDecimal("minprice"));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- Long id = sa_itemgroupid;
|
|
|
- if (itemgroupScemeRowsMap.get(id.toString()).isNotEmpty()) {
|
|
|
- if (itemgroupScemeRowsMap.get(id.toString()).get(0).getLong("sa_customschemeid") > 0) {
|
|
|
- row2.put("isscheme", true);
|
|
|
- } else {
|
|
|
- row2.put("isscheme", false);
|
|
|
- }
|
|
|
-
|
|
|
+ QuerySQL itemGroupQuery = SQLFactory.createQuerySQL(this, "sa_itemgroup", "sa_itemgroupid", "sa_brandid", "ispriorityshow",
|
|
|
+ "istopping", "changeby", "createby", "changedate", "createdate", "groupnum", "itemno", "groupname", "tradefield", "isonsale");
|
|
|
+ itemGroupQuery.setTableAlias("t1");
|
|
|
+ itemGroupQuery.addJoinTable(JOINTYPE.left, "plm_item", "t2", "t1.itemno = t2.itemno AND t1.siteid = t2.siteid", "itemid");
|
|
|
+ itemGroupQuery.addJoinTable(JOINTYPE.left, "sa_brand", "t3", "t3.sa_brandid = t1.sa_brandid AND t3.siteid = t1.siteid", "brandname");
|
|
|
+ itemGroupQuery.addJoinTable(JOINTYPE.left, "plm_unit", "t6", "t6.unitid = t2.unitid AND t6.siteid = t2.siteid", "unitname");
|
|
|
+ itemGroupQuery.setSiteid(siteid);
|
|
|
+ itemGroupQuery.setWhere("t1.isonsale=1");
|
|
|
+ itemGroupQuery.setWhere("t2.ismodule", content.getLongValue("ismodule"));
|
|
|
+ itemGroupQuery.setWhere("t1.sa_brandid", brandids.toArray());
|
|
|
+ itemGroupQuery.setWhere(where);
|
|
|
+ if (saleclassauth) {
|
|
|
+ if (itemclassList.isEmpty()) {
|
|
|
+ itemGroupQuery.setWhere("1=2");
|
|
|
} else {
|
|
|
- row2.put("isscheme", false);
|
|
|
+ itemGroupQuery.setWhere("exists(select * from sa_itemgroupmx inner join sa_itemsaleclass on sa_itemgroupmx.itemid=sa_itemsaleclass.itemid where sa_itemgroupmx.sa_itemgroupid=t1.sa_itemgroupid and sa_itemsaleclass.itemclassid in $itemclassid$)");
|
|
|
}
|
|
|
}
|
|
|
+ itemGroupQuery.addParameter("itemclassid", itemclassList);
|
|
|
+ itemGroupQuery.setPage(pageSize, pageNumber);
|
|
|
+ itemGroupQuery.setOrderBy(pageSorting);
|
|
|
+ Rows itemGroupRows = itemGroupQuery.query();
|
|
|
+
|
|
|
+ //商品组价格查询
|
|
|
+ QuerySQL itempriceQuery = SQLFactory.createQuerySQL(this, "sa_itemgroupmx", "sa_itemgroupid").setTableAlias("t1");
|
|
|
+ itempriceQuery.addJoinTable(JOINTYPE.inner, "sa_itemprice", "t2", "t1.itemid=t2.itemid");
|
|
|
+ itempriceQuery.addQueryFields("maxprice", "max(t2.price)");
|
|
|
+ itempriceQuery.addQueryFields("minprice", "min(t2.price)");
|
|
|
+ itempriceQuery.setWhere("t1.sa_itemgroupid", itemGroupRows.toArrayList("sa_itemgroupid"));
|
|
|
+ itempriceQuery.setWhere("t2.pricegrade", pricegrade);
|
|
|
+ itempriceQuery.addGroupBy("t1.sa_itemgroupid");
|
|
|
+ RowsMap itemGroupPriceRowsMap = itempriceQuery.query().toRowsMap("sa_itemgroupid");
|
|
|
+
|
|
|
+ ArrayList<Long> itemgroupids = itemGroupRows.toArrayList("sa_itemgroupid", new ArrayList<>());
|
|
|
+ RowsMap itemgroupScemeRowsMap = Itemgroup.getItemgroupScemeid(this, itemgroupids);
|
|
|
|
|
|
- ArrayList<Long> ids = rows.toArrayList("itemid", new ArrayList<>());
|
|
|
- /**
|
|
|
+ ArrayList<Long> itemgroupDefaultItems = itemGroupRows.toArrayList("itemid", new ArrayList<>());//商品组默认商品ID
|
|
|
+ /*
|
|
|
* 查询商品明细
|
|
|
*/
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "查询商品列表");
|
|
|
- sqlFactory.addParameter_in("itemids", ids);
|
|
|
+ sqlFactory.addParameter_in("itemids", itemgroupDefaultItems);
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
|
|
|
Rows itemrows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
@@ -277,50 +184,75 @@ public class itemgroup extends Controller {
|
|
|
row.put("gradeprice", itemPrice.getMarketprice());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
RowsMap itemRowsMap = itemrows.toRowsMap("itemid");
|
|
|
|
|
|
//默认商品图片
|
|
|
Rows defaultImageRows = Item.getItemdefaultImage(this);
|
|
|
// 封面cover
|
|
|
- RowsMap coverRowsMap = getAttachmentUrl("plm_item", ids, "cover");
|
|
|
+ RowsMap defaultItemCoverRowsMap = getAttachmentUrl("plm_item", itemgroupDefaultItems, "cover");
|
|
|
// 附件
|
|
|
- RowsMap attRowsMap = getAttachmentUrl("plm_item", ids);
|
|
|
+ RowsMap defaultItemAttRowsMap = getAttachmentUrl("plm_item", itemgroupDefaultItems);
|
|
|
// 附件
|
|
|
- RowsMap itemgroupRowsMap = getAttachmentUrl("sa_itemgroup", itemgroupids);
|
|
|
+ RowsMap itemgroupAttRowsMap = getAttachmentUrl("sa_itemgroup", itemgroupids);
|
|
|
|
|
|
|
|
|
- Rows rowsitemclass = dbConnect.runSqlQuery(
|
|
|
- " select t7.itemclassname,t6.itemid,t8.brandname,t7.itemclassfullname from sa_itemsaleclass t6 inner JOIN plm_itemclass t7 ON t7.itemclassid = t6.itemclassid AND t7.siteid = t6.siteid LEFT JOIN sa_brand t8 ON t8.sa_brandid = t7.sa_brandid AND t8.siteid = t7.siteid where t6.siteid='"
|
|
|
- + siteid + "'");
|
|
|
- RowsMap itemclassRowsMap = rowsitemclass.toRowsMap("itemid");
|
|
|
- for (Row row : rows) {
|
|
|
- Rows itemRows = itemRowsMap.get(row.getString("itemid"));
|
|
|
- row.put("item", itemRows);
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_itemsaleclass", "itemid").setTableAlias("t1");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.inner, "plm_itemclass", "t2", "t1.itemclassid = t2.itemclassid AND t1.siteid = t2.siteid", "itemclassname", "itemclassfullname");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.inner, "sa_brand", "t3", "t1.sa_brandid = t2.sa_brandid AND t1.siteid = t2.siteid", "brandname");
|
|
|
+ querySQL.setSiteid(siteid);
|
|
|
+ querySQL.setWhere("itemid", itemGroupRows.toArrayList("itemid"));
|
|
|
+ RowsMap itemclassRowsMap = querySQL.query().toRowsMap("itemid");
|
|
|
|
|
|
- Rows coverRows = coverRowsMap.get(row.getString("itemid"));
|
|
|
- if (coverRows.isEmpty()) {
|
|
|
- if (!defaultImageRows.isEmpty()) {
|
|
|
- row.put("cover", defaultImageRows.get(0).getString("url"));
|
|
|
- } else {
|
|
|
- row.put("cover", "");
|
|
|
- }
|
|
|
+ for (Row itemGroupRow : itemGroupRows) {
|
|
|
+ long sa_itemgroupid = itemGroupRow.getLong("sa_itemgroupid");
|
|
|
+
|
|
|
+ //设置标签
|
|
|
+ itemGroupRow.put("tag1", DataTag.queryTag(this, "sa_itemgroup", sa_itemgroupid, false));
|
|
|
+
|
|
|
+ //设置商品组价格
|
|
|
+ Rows itemGroupPriceRows = itemGroupPriceRowsMap.get(String.valueOf(sa_itemgroupid));
|
|
|
+ if (itemGroupPriceRows.isEmpty()) {
|
|
|
+ itemGroupRow.put("maxprice", 0);
|
|
|
+ itemGroupRow.put("minprice", 0);
|
|
|
} else {
|
|
|
- row.put("cover", coverRows.get(0).getString("url"));
|
|
|
+ itemGroupRow.put("maxprice", itemGroupPriceRows.get(0).getBigDecimal("maxprice"));
|
|
|
+ itemGroupRow.put("minprice", itemGroupPriceRows.get(0).getBigDecimal("minprice"));
|
|
|
}
|
|
|
|
|
|
- if ((itemgroupRowsMap.getOrDefault(row.getString("sa_itemgroupid"), new Rows())).isNotEmpty()) {
|
|
|
- row.put("attinfos", itemgroupRowsMap.getOrDefault(row.getString("sa_itemgroupid"), new Rows()));
|
|
|
+ //设置方案
|
|
|
+ if (itemgroupScemeRowsMap.containsKey(String.valueOf(sa_itemgroupid)) && itemgroupScemeRowsMap.get(String.valueOf(sa_itemgroupid)).get(0).getLong("sa_customschemeid") > 0) {
|
|
|
+ itemGroupRow.put("isscheme", true);
|
|
|
} else {
|
|
|
- if ((attRowsMap.getOrDefault(row.getString("itemid"), new Rows())).isEmpty()) {
|
|
|
- row.put("attinfos", defaultImageRows);
|
|
|
- } else {
|
|
|
- row.put("attinfos", attRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
|
|
|
- }
|
|
|
+ itemGroupRow.put("isscheme", false);
|
|
|
}
|
|
|
- row.put("itemclass", itemclassRowsMap.get(row.getString("itemid")));
|
|
|
+
|
|
|
+ //设置默认商品详情
|
|
|
+ itemGroupRow.put("item", itemRowsMap.get(itemGroupRow.getString("itemid")));
|
|
|
+
|
|
|
+ //设置默认商品图片
|
|
|
+ Rows coverRows = defaultItemCoverRowsMap.get(itemGroupRow.getString("itemid"));
|
|
|
+ if (coverRows.isNotEmpty()) {
|
|
|
+ itemGroupRow.put("cover", coverRows.get(0).getString("url"));
|
|
|
+ } else if (defaultImageRows.isNotEmpty()) {
|
|
|
+ itemGroupRow.put("cover", defaultImageRows.get(0).getString("url"));
|
|
|
+ } else {
|
|
|
+ itemGroupRow.put("cover", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((itemgroupAttRowsMap.getOrDefault(itemGroupRow.getString("sa_itemgroupid"), new Rows())).isNotEmpty()) {
|
|
|
+ itemGroupRow.put("attinfos", itemgroupAttRowsMap.get(itemGroupRow.getString("sa_itemgroupid")));
|
|
|
+ } else if ((defaultItemAttRowsMap.getOrDefault(itemGroupRow.getString("itemid"), new Rows())).isNotEmpty()) {
|
|
|
+ itemGroupRow.put("attinfos", defaultItemAttRowsMap.get(itemGroupRow.getString("itemid")));
|
|
|
+ } else {
|
|
|
+ itemGroupRow.put("attinfos", defaultImageRows);
|
|
|
+ }
|
|
|
+
|
|
|
+ itemGroupRow.put("itemclass", itemclassRowsMap.get(itemGroupRow.getString("itemid")));
|
|
|
}
|
|
|
|
|
|
- return getSucReturnObject().setData(rows).toString();
|
|
|
+ return getSucReturnObject().setData(itemGroupRows).toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -368,11 +300,11 @@ public class itemgroup extends Controller {
|
|
|
// Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_itemgroupmx", "sa_itemgroupmxid", "sequence");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
- querySQL.addJoinTable(JOINTYPE.inner, "plm_item", "t2", "t1.itemid = t2.itemid and ifnull(t2.isonsale,0)=1 AND t1.siteid = t2.siteid","*");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "plm_unit", "t6", "t6.unitid = t2.unitid AND t6.siteid = t2.siteid","unitname");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "st_invbal_sale", "t3", "t2.siteid = t3.siteid AND t2.itemid = t3.itemid","accountname");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.inner, "plm_item", "t2", "t1.itemid = t2.itemid and ifnull(t2.isonsale,0)=1 AND t1.siteid = t2.siteid", "*");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "plm_unit", "t6", "t6.unitid = t2.unitid AND t6.siteid = t2.siteid", "unitname");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "st_invbal_sale", "t3", "t2.siteid = t3.siteid AND t2.itemid = t3.itemid", "accountname");
|
|
|
querySQL.addJoinTable(JOINTYPE.inner, "sa_itemgroup", "t4", "t1.siteid = t4.siteid and t1.sa_itemgroupid = t4.sa_itemgroupid");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "sa_brand", "t5", "t4.siteid = t5.siteid and t4.sa_brandid = t5.sa_brandid","brandname");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_brand", "t5", "t4.siteid = t5.siteid and t4.sa_brandid = t5.sa_brandid", "brandname");
|
|
|
querySQL.addQueryFields("candispatchqty", "ifnull(t3.candispatchqty, 0)");
|
|
|
querySQL.addQueryFields("cansaleqty", "ifnull(t3.cansaleqty, 0)");
|
|
|
querySQL.addQueryFields("totalaty", " ifnull(t3.qty, 0) ");
|
|
|
@@ -381,7 +313,7 @@ public class itemgroup extends Controller {
|
|
|
" when t3.cansaleqty <= t2.stockstatus2 then '缺货'\n" +
|
|
|
" else '紧缺' end))");
|
|
|
querySQL.setSiteid(siteid);
|
|
|
- querySQL.setWhere("t1.sa_itemgroupid",sa_itemgroupid);
|
|
|
+ querySQL.setWhere("t1.sa_itemgroupid", sa_itemgroupid);
|
|
|
querySQL.setWhere(where);
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
querySQL.setOrderBy(pageSorting);
|
|
|
@@ -414,14 +346,14 @@ public class itemgroup extends Controller {
|
|
|
SQLFactory priceSqlFactory = new SQLFactory(this, "查询商品原价");
|
|
|
priceSqlFactory.addParameter("sa_itemgroupid", sa_itemgroupid);
|
|
|
priceSqlFactory.addParameter("siteid", siteid);
|
|
|
- Rows siteParameterRows =dbConnect.runSqlQuery("select defaultlevelprice from sys_site_parameter where siteid='"+siteid+"'");
|
|
|
- if(!siteParameterRows.isEmpty()){
|
|
|
- if(StringUtils.isBlank(siteParameterRows.get(0).getString("defaultlevelprice"))){
|
|
|
+ Rows siteParameterRows = dbConnect.runSqlQuery("select defaultlevelprice from sys_site_parameter where siteid='" + siteid + "'");
|
|
|
+ if (!siteParameterRows.isEmpty()) {
|
|
|
+ if (StringUtils.isBlank(siteParameterRows.get(0).getString("defaultlevelprice"))) {
|
|
|
priceSqlFactory.addParameter("pricegrade", "1");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
priceSqlFactory.addParameter("pricegrade", siteParameterRows.get(0).getString("defaultlevelprice"));
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
priceSqlFactory.addParameter("pricegrade", "1");
|
|
|
}
|
|
|
Rows pricerows = dbConnect.runSqlQuery(priceSqlFactory);
|
|
|
@@ -433,13 +365,13 @@ public class itemgroup extends Controller {
|
|
|
if (sys_enterpriseid > 0 || (usertype == 21 || usertype == 22)) {
|
|
|
row.put("gradeprice", itemPrice.getContractprice());
|
|
|
} else {
|
|
|
- if(pricerowsMap.containsKey(row.getString("itemid"))){
|
|
|
- if(pricerowsMap.get(row.getString("itemid")).isNotEmpty()){
|
|
|
+ if (pricerowsMap.containsKey(row.getString("itemid"))) {
|
|
|
+ if (pricerowsMap.get(row.getString("itemid")).isNotEmpty()) {
|
|
|
row.put("gradeprice", pricerowsMap.get(row.getString("itemid")).get(0).getBigDecimal("price"));
|
|
|
- }else{
|
|
|
- row.put("gradeprice",0);
|
|
|
+ } else {
|
|
|
+ row.put("gradeprice", 0);
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
row.put("gradeprice", 0);
|
|
|
}
|
|
|
}
|
|
|
@@ -531,7 +463,7 @@ public class itemgroup extends Controller {
|
|
|
listAll.addAll(listParmNotBlank);
|
|
|
factory.addParameter_SQL("where", "1=1");
|
|
|
rows = dbConnect.runSqlQuery(factory.getSQL());
|
|
|
- Rows rowsall=rows;
|
|
|
+ Rows rowsall = rows;
|
|
|
for (Row row : rows) {
|
|
|
for (String value : listAll) {
|
|
|
if (value.equals("color")) {
|
|
|
@@ -737,7 +669,7 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
|
|
|
factory.addParameter_SQL("where", " 1=1 " + colorwhere + specwhere + materialwhere + cheekwhere);
|
|
|
- } else if(listParmNotBlank.size()==1){
|
|
|
+ } else if (listParmNotBlank.size() == 1) {
|
|
|
String where = " 1=1 ";
|
|
|
for (String value : listParmNotBlank) {
|
|
|
if (value.equals("color")) {
|
|
|
@@ -853,12 +785,12 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
}
|
|
|
if (!isexistParm) {
|
|
|
- if(list.get(0).equals("color")){
|
|
|
+ if (list.get(0).equals("color")) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("parm", firstcolor);
|
|
|
jsonObject.put("flag", true);
|
|
|
colormap.add(jsonObject);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("parm", firstcolor);
|
|
|
jsonObject.put("flag", false);
|
|
|
@@ -876,12 +808,12 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
}
|
|
|
if (!isexistParm) {
|
|
|
- if(list.get(0).equals("spec")){
|
|
|
+ if (list.get(0).equals("spec")) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("parm", firstspec);
|
|
|
jsonObject.put("flag", true);
|
|
|
specmap.add(jsonObject);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("parm", firstspec);
|
|
|
jsonObject.put("flag", false);
|
|
|
@@ -899,12 +831,12 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
}
|
|
|
if (!isexistParm) {
|
|
|
- if(list.get(0).equals("material")){
|
|
|
+ if (list.get(0).equals("material")) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("parm", firstmaterial);
|
|
|
jsonObject.put("flag", true);
|
|
|
materialmap.add(jsonObject);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("parm", firstmaterial);
|
|
|
jsonObject.put("flag", false);
|
|
|
@@ -922,12 +854,12 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
}
|
|
|
if (!isexistParm) {
|
|
|
- if(list.get(0).equals("cheek")){
|
|
|
+ if (list.get(0).equals("cheek")) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("parm", firstcheek);
|
|
|
jsonObject.put("flag", true);
|
|
|
cheekmap.add(jsonObject);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("parm", firstcheek);
|
|
|
jsonObject.put("flag", false);
|
|
|
@@ -935,7 +867,7 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
String where = " 1=1 ";
|
|
|
for (String value : listParmNotBlank) {
|
|
|
if (value.equals("color")) {
|
|
|
@@ -1040,10 +972,10 @@ public class itemgroup extends Controller {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(customschemeItems1RowsMap.containsKey("color")){
|
|
|
- where=" 1=1 ";
|
|
|
+ if (customschemeItems1RowsMap.containsKey("color")) {
|
|
|
+ where = " 1=1 ";
|
|
|
for (String value : listParmNotBlank) {
|
|
|
- if(!value.equals("color")){
|
|
|
+ if (!value.equals("color")) {
|
|
|
where = where + " and " + value + "='" + content.getString(value) + "' ";
|
|
|
}
|
|
|
}
|
|
|
@@ -1073,7 +1005,7 @@ public class itemgroup extends Controller {
|
|
|
colormap.add(jsonObject);
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
for (String firstcolor : firstcolorList) {
|
|
|
boolean isexistParm = false;
|
|
|
for (Object object : colormap) {
|
|
|
@@ -1091,10 +1023,10 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(customschemeItems1RowsMap.containsKey("spec")){
|
|
|
- where=" 1=1 ";
|
|
|
+ if (customschemeItems1RowsMap.containsKey("spec")) {
|
|
|
+ where = " 1=1 ";
|
|
|
for (String value : listParmNotBlank) {
|
|
|
- if(!value.equals("spec")){
|
|
|
+ if (!value.equals("spec")) {
|
|
|
where = where + " and " + value + "='" + content.getString(value) + "' ";
|
|
|
}
|
|
|
}
|
|
|
@@ -1124,7 +1056,7 @@ public class itemgroup extends Controller {
|
|
|
specmap.add(jsonObject);
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
for (String firstspec : firstspecList) {
|
|
|
boolean isexistParm = false;
|
|
|
for (Object object : specmap) {
|
|
|
@@ -1142,10 +1074,10 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(customschemeItems1RowsMap.containsKey("material")){
|
|
|
- where=" 1=1 ";
|
|
|
+ if (customschemeItems1RowsMap.containsKey("material")) {
|
|
|
+ where = " 1=1 ";
|
|
|
for (String value : listParmNotBlank) {
|
|
|
- if(!value.equals("material")){
|
|
|
+ if (!value.equals("material")) {
|
|
|
where = where + " and " + value + "='" + content.getString(value) + "' ";
|
|
|
}
|
|
|
}
|
|
|
@@ -1175,7 +1107,7 @@ public class itemgroup extends Controller {
|
|
|
materialmap.add(jsonObject);
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
for (String firstmaterial : firstmaterialList) {
|
|
|
boolean isexistParm = false;
|
|
|
for (Object object : materialmap) {
|
|
|
@@ -1193,10 +1125,10 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(customschemeItems1RowsMap.containsKey("cheek")){
|
|
|
- where=" 1=1 ";
|
|
|
+ if (customschemeItems1RowsMap.containsKey("cheek")) {
|
|
|
+ where = " 1=1 ";
|
|
|
for (String value : listParmNotBlank) {
|
|
|
- if(!value.equals("cheek")){
|
|
|
+ if (!value.equals("cheek")) {
|
|
|
where = where + " and " + value + "='" + content.getString(value) + "' ";
|
|
|
}
|
|
|
}
|
|
|
@@ -1226,7 +1158,7 @@ public class itemgroup extends Controller {
|
|
|
cheekmap.add(jsonObject);
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
for (String firstcheek : firstcheekList) {
|
|
|
boolean isexistParm = false;
|
|
|
for (Object object : cheekmap) {
|
|
|
@@ -1323,14 +1255,14 @@ public class itemgroup extends Controller {
|
|
|
SQLFactory priceSqlFactory = new SQLFactory(this, "查询商品原价");
|
|
|
priceSqlFactory.addParameter("sa_itemgroupid", content.getString("sa_itemgroupid"));
|
|
|
priceSqlFactory.addParameter("siteid", siteid);
|
|
|
- Rows siteParameterRows =dbConnect.runSqlQuery("select defaultlevelprice from sys_site_parameter where siteid='"+siteid+"'");
|
|
|
- if(!siteParameterRows.isEmpty()){
|
|
|
- if(StringUtils.isBlank(siteParameterRows.get(0).getString("defaultlevelprice"))){
|
|
|
+ Rows siteParameterRows = dbConnect.runSqlQuery("select defaultlevelprice from sys_site_parameter where siteid='" + siteid + "'");
|
|
|
+ if (!siteParameterRows.isEmpty()) {
|
|
|
+ if (StringUtils.isBlank(siteParameterRows.get(0).getString("defaultlevelprice"))) {
|
|
|
priceSqlFactory.addParameter("pricegrade", "1");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
priceSqlFactory.addParameter("pricegrade", siteParameterRows.get(0).getString("defaultlevelprice"));
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
priceSqlFactory.addParameter("pricegrade", "1");
|
|
|
}
|
|
|
Rows pricerows = dbConnect.runSqlQuery(priceSqlFactory);
|
|
|
@@ -1345,37 +1277,37 @@ public class itemgroup extends Controller {
|
|
|
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "plm_item", "*");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "plm_unit", "t2", "t2.unitid = t1.unitid AND t2.siteid = t1.siteid","unitname");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "st_invbal_sale", "t3", "t3.siteid = t1.siteid AND t3.itemid = t1.itemid","candispatchqty","cansaleqty","qty");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "plm_itemextend", "t8", "t8.itemid= t1.itemid AND t8.siteid = t1.siteid","caliber","pressure","material","butterflyplatedrive"
|
|
|
- ,"connection","valveplatematerial","bodymaterial","actuatortype","actuatorbrand","isbutterfly","erpitemno","erpitemname","specalnote","prodline","device");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "sa_favorites", "t5", "t5.itemid = t1.itemid and t5.siteid = t1.siteid and t5.sys_enterpriseid="+sys_enterpriseid,"iscollection");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "plm_unit", "t2", "t2.unitid = t1.unitid AND t2.siteid = t1.siteid", "unitname");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "st_invbal_sale", "t3", "t3.siteid = t1.siteid AND t3.itemid = t1.itemid", "candispatchqty", "cansaleqty", "qty");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "plm_itemextend", "t8", "t8.itemid= t1.itemid AND t8.siteid = t1.siteid", "caliber", "pressure", "material", "butterflyplatedrive"
|
|
|
+ , "connection", "valveplatematerial", "bodymaterial", "actuatortype", "actuatorbrand", "isbutterfly", "erpitemno", "erpitemname", "specalnote", "prodline", "device");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_favorites", "t5", "t5.itemid = t1.itemid and t5.siteid = t1.siteid and t5.sys_enterpriseid=" + sys_enterpriseid, "iscollection");
|
|
|
querySQL.setSiteid(siteid);
|
|
|
- querySQL.setWhere("t1.itemno",itemno);
|
|
|
+ querySQL.setWhere("t1.itemno", itemno);
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
querySQL.setOrderBy(pageSorting);
|
|
|
Rows itemrows = querySQL.query();
|
|
|
for (Row row : itemrows) {
|
|
|
- row.put("customschemeItems",customschemeItems);
|
|
|
+ row.put("customschemeItems", customschemeItems);
|
|
|
ItemPrice itemPrice = ItemPrice.getItemPrice(this, sys_enterpriseid, row.getLong("itemid"));
|
|
|
row.put("oldprice", itemPrice.getPrice());
|
|
|
if (sys_enterpriseid > 0 || (usertype == 21 || usertype == 22)) {
|
|
|
row.put("gradeprice", itemPrice.getContractprice());
|
|
|
} else {
|
|
|
- if(pricerowsMap.containsKey(row.getString("itemid"))){
|
|
|
- if(pricerowsMap.get(row.getString("itemid")).isNotEmpty()){
|
|
|
+ if (pricerowsMap.containsKey(row.getString("itemid"))) {
|
|
|
+ if (pricerowsMap.get(row.getString("itemid")).isNotEmpty()) {
|
|
|
row.put("gradeprice", pricerowsMap.get(row.getString("itemid")).get(0).getBigDecimal("price"));
|
|
|
- }else{
|
|
|
- row.put("gradeprice",0);
|
|
|
+ } else {
|
|
|
+ row.put("gradeprice", 0);
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
row.put("gradeprice", 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//判断商品是否参与活动:当前经销商参与的有效的活动
|
|
|
- if(listAll.size()==listParmNotBlank.size()){
|
|
|
+ if (listAll.size() == listParmNotBlank.size()) {
|
|
|
SQLFactory activitysqlFactory = new SQLFactory(new promotion(new JSONObject()), "促销方案列表查询");
|
|
|
activitysqlFactory.addParameter("siteid", siteid);
|
|
|
activitysqlFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
|
|
|
@@ -1385,23 +1317,23 @@ public class itemgroup extends Controller {
|
|
|
SQLFactory sqlFactory1 = new SQLFactory(new promotion(new JSONObject()), "促销订单金额合计查询");
|
|
|
sqlFactory1.addParameter("siteid", siteid);
|
|
|
sqlFactory1.addParameter("sys_enterpriseid", sys_enterpriseid);
|
|
|
- Rows sumAmountRows = dbConnect.runSqlQuery(sqlFactory1.getSQL());
|
|
|
+ Rows sumAmountRows = dbConnect.runSqlQuery(sqlFactory1.getSQL());
|
|
|
RowsMap sumAmountRowsMap = sumAmountRows.toRowsMap("sa_promotionid");
|
|
|
|
|
|
SQLFactory sqlFactory2 = new SQLFactory(new promotion(new JSONObject()), "促销方案列表查询(触发的促销方案)");
|
|
|
sqlFactory2.addParameter("siteid", siteid);
|
|
|
sqlFactory2.addParameter("sys_enterpriseid", sys_enterpriseid);
|
|
|
- Rows openPromotionsRows = dbConnect.runSqlQuery(sqlFactory2.getSQL());
|
|
|
+ Rows openPromotionsRows = dbConnect.runSqlQuery(sqlFactory2.getSQL());
|
|
|
RowsMap openPromotionsRowsMap = openPromotionsRows.toRowsMap("sa_promotionid");
|
|
|
|
|
|
ListIterator<Row> iterator = activityrows.listIterator();
|
|
|
while (iterator.hasNext()) {
|
|
|
- Row activityrow = iterator.next();
|
|
|
- if(activityrow.getLong("sa_openpromotionid")!=0){
|
|
|
- if(sumAmountRowsMap.containsKey(activityrow.getString("sa_promotionid"))){
|
|
|
+ Row activityrow = iterator.next();
|
|
|
+ if (activityrow.getLong("sa_openpromotionid") != 0) {
|
|
|
+ if (sumAmountRowsMap.containsKey(activityrow.getString("sa_promotionid"))) {
|
|
|
BigDecimal sumamount = sumAmountRowsMap.get(activityrow.getString("sa_promotionid")).get(0).getBigDecimal("sumamount");
|
|
|
- if(sumamount.compareTo(activityrow.getBigDecimal("openamount"))>=0){
|
|
|
- if(openPromotionsRowsMap.containsKey(activityrow.getString("sa_openpromotionid"))){
|
|
|
+ if (sumamount.compareTo(activityrow.getBigDecimal("openamount")) >= 0) {
|
|
|
+ if (openPromotionsRowsMap.containsKey(activityrow.getString("sa_openpromotionid"))) {
|
|
|
iterator.add(openPromotionsRowsMap.get(activityrow.getString("sa_openpromotionid")).get(0));
|
|
|
}
|
|
|
}
|
|
|
@@ -1420,15 +1352,15 @@ public class itemgroup extends Controller {
|
|
|
querySQL1.addJoinTable(JOINTYPE.inner, "plm_item", "t3", "t2.itemid=t3.itemid and t2.siteid=t3.siteid");
|
|
|
querySQL1.setSiteid(siteid);
|
|
|
querySQL1.setWhere("t2.isonsale=1");
|
|
|
- querySQL1.setWhere("t3.itemno",itemno);
|
|
|
- querySQL1.setWhere("t1.sa_promotionid",activityrows.toArray("sa_promotionid"));
|
|
|
+ querySQL1.setWhere("t3.itemno", itemno);
|
|
|
+ querySQL1.setWhere("t1.sa_promotionid", activityrows.toArray("sa_promotionid"));
|
|
|
querySQL1.setPage(pageSize, pageNumber);
|
|
|
querySQL1.setOrderBy(pageSorting);
|
|
|
Rows promotionrows = querySQL1.query();
|
|
|
|
|
|
- row.put("canuseactivity",promotionrows);
|
|
|
- }else{
|
|
|
- row.put("canuseactivity",new Rows());
|
|
|
+ row.put("canuseactivity", promotionrows);
|
|
|
+ } else {
|
|
|
+ row.put("canuseactivity", new Rows());
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1476,36 +1408,36 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
JSONObject oject = new JSONObject();
|
|
|
oject.put("customschemeItems", customschemeItems.toJsonArray());
|
|
|
- if(customschemeItems.size()==1){
|
|
|
- if(customschemeItems.get(0).getString("value").equals("color")){
|
|
|
+ if (customschemeItems.size() == 1) {
|
|
|
+ if (customschemeItems.get(0).getString("value").equals("color")) {
|
|
|
RowsMap rowsMap = rowsall.toRowsMap("color");
|
|
|
for (parm parm : colorList) {
|
|
|
- if(rowsMap.containsKey(parm.getParm())){
|
|
|
+ if (rowsMap.containsKey(parm.getParm())) {
|
|
|
parm.setDelistingstatus(rowsMap.get(parm.getParm()).get(0).getString("delistingstatus"));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- if(customschemeItems.get(0).getString("value").equals("spec")){
|
|
|
+ if (customschemeItems.get(0).getString("value").equals("spec")) {
|
|
|
RowsMap rowsMap = rowsall.toRowsMap("spec");
|
|
|
for (parm parm : specList) {
|
|
|
- if(rowsMap.containsKey(parm.getParm())) {
|
|
|
+ if (rowsMap.containsKey(parm.getParm())) {
|
|
|
parm.setDelistingstatus(rowsMap.get(parm.getParm()).get(0).getString("delistingstatus"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(customschemeItems.get(0).getString("value").equals("material")){
|
|
|
+ if (customschemeItems.get(0).getString("value").equals("material")) {
|
|
|
RowsMap rowsMap = rowsall.toRowsMap("material");
|
|
|
for (parm parm : materialList) {
|
|
|
- if(rowsMap.containsKey(parm.getParm())) {
|
|
|
+ if (rowsMap.containsKey(parm.getParm())) {
|
|
|
parm.setDelistingstatus(rowsMap.get(parm.getParm()).get(0).getString("delistingstatus"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(customschemeItems.get(0).getString("value").equals("cheek")){
|
|
|
+ if (customschemeItems.get(0).getString("value").equals("cheek")) {
|
|
|
RowsMap rowsMap = rowsall.toRowsMap("cheek");
|
|
|
for (parm parm : cheekList) {
|
|
|
- if(rowsMap.containsKey(parm.getParm())) {
|
|
|
+ if (rowsMap.containsKey(parm.getParm())) {
|
|
|
parm.setDelistingstatus(rowsMap.get(parm.getParm()).get(0).getString("delistingstatus"));
|
|
|
}
|
|
|
}
|